Skip to content

Latest commit

 

History

History
199 lines (158 loc) · 8 KB

README.org

File metadata and controls

199 lines (158 loc) · 8 KB

os/exwm

Table of Contents

Description

This module enables and provides sane defaults for the Emacs X Window Manager (EXWM).

  • Control applications as Emacs buffers.
  • Edit any application’s input field with Emacs.
  • Use Emacs input methods in other applications.
  • Use VIM keys in major web browsers like Firefox and Chrome.
  • Launch and control nested Emacs sessions within Emacs.

Maintainers

Module Flags

This module provides no flags.

Plugins

Hacks

When switching to a workspace where an EXWM buffer is focused, inputs do not get passed to the application. To work around this, I wrote a hook which briefly activates the minibuffer for input and then quits the minibuffer.

Prerequisites

This module has no prerequisites.

Features

  • Edit any application’s input field with C-c '.
  • Use Emacs input methods in other applications. Simply set the input method as usual with C-x RET C-\.
  • Open nested sessions of Emacs with alternate configurations.
  • Use Evil in any application! Specific browsers such as Google Chrome and Firefox have extended support for Evil keybindings. Simply install the link-hints extension/add-on and start VIM-ing!

Moreover, when this module is loaded, the following global keybindings are made:

KeybindingDescription
SPC $Open a GNU/Linux application
SPC o nOpen a nested Emacs session
SPC o NOpen a nested vanilla Emacs session
SPC f vFind file in vanilla Emacs
SPC f VFind this file in vanilla Emacs
C-c 'Edit input field in Emacs

Configuration

Setting up your xinitrc file.

In order to enable EXWM, Emacs needs to be running within X.Org without any window manager present. The recommended way to go about this is with the startx script. The EXWM wiki contains an example xinitrc file for use by startx.

Setting the default major mode for EXWM Edit.

By default, when you edit an application’s input field and no programming language can be detected in the text, org-mode will your major mode. If you would like to change this, set the +exwm-edit-default-major-mode variable:

(setq +exwm-edit-default-major-mode 'markdown-mode)

Setting up link hints for Chrome-based and Firefox-based web browsers

For users of Evil, the f and F keys are bound to special Link Hint commands within Chrome-based and Firefox-based web browsers. For these commands to work, you must have the Link Hint add-on/extension installed. For Chrome-based web browsers, install Link Hint through here. For Firefox-based web browsers, use this link instead.

Setting up multiple monitors

Currently this module does not provide any simplified setup for multi-head configurations. Please refer to https://github.com/ch11ng/exwm/wiki#randr-multi-screen for how to do this.

Setting up an alternate Emacs configuration for nested Emacs sessions

Although we provide a curated default vanilla-Emacs configuration (without Evil), you can write your own configuration file and evaluate

(setq +exwm-vanilla-emacs-config-file "/path/to/alternate-emacs-config.el")

Using i3-style keybindings

If you would like i3-style keybindings, I recommend adding the following paragraph to your private configuration:

;; i3-like keybindings for EXWM
(windmove-mode +1)
(when (featurep! :private exwm)
  (map! "s-j" #'windmove-left
        "s-k" #'windmove-down
        "s-l" #'windmove-up
        "s-;" #'windmove-right
        "s-J" #'windmove-swap-states-left
        "s-K" #'windmove-swap-states-down
        "s-L" #'windmove-swap-states-up
        "s-Q" #'delete-window
        "s-:" #'windmove-swap-states-right
        "s-v" #'split-window-right
        "s-h" #'split-window-below
        (:when (featurep! :ui workspaces)
         "s-1" #'+workspace/switch-to-0
         "s-2" #'+workspace/switch-to-1
         "s-3" #'+workspace/switch-to-2
         "s-4" #'+workspace/switch-to-3
         "s-5" #'+workspace/switch-to-4
         "s-6" #'+workspace/switch-to-5
         "s-7" #'+workspace/switch-to-6
         "s-8" #'+workspace/switch-to-7
         "s-9" #'+workspace/switch-to-8
         "s-0" #'+workspace/switch-to-final
         (:when (featurep! :term vterm)
          "s-<return>" (defun +run-or-raise-vterm ()
                         (interactive)
                         (+workspace-switch "Vterm" t)
                         (let ((display-buffer-alist))
                           (vterm most-positive-fixnum)))))
        "s-d" #'app-launcher-run-app
        "s-'" #'exwm-edit--compose)
  (after! exwm
    (dolist (key '(?\s-h ?\s-j ?\s-k ?\s-l ?\s-H ?\s-J ?\s-K ?\s-L ?\s-0 ?\s-1
                         ?\s-2 ?\s-3 ?\s-4 ?\s-5 ?\s-6 ?\s-7 ?\s-8 ?\s-9 ?\s-d
                         ?\s-\; ?\s-v ?\s-' ?\C-\[ ?\s-Q))
      (cl-pushnew key exwm-input-prefix-keys))))

Troubleshooting

How do I send escape or C-c to applications?

KeybindDescription
C-c C-iSend the escape key (only bound when Evil is enabled).
C-c C-cSend the C-c key.
C-c C-qSend the next key to the application.

When I mouse-click while in Evil’s normal state I get an error.

I (the author) do not know how to suppress or remove the, “evil-mouse-drag-region must be bound to an event with parameters” error. I recommend ignoring this error though as your clicks still register.

This bug is a result of a workaround I copied from this GitHub issue: walseb/exwm-firefox-evil#1

Future directions

  • [ ] Document workarounds for packages utilizing child frames.
  • [ ] Write a separate nested Emacs mode.
  • [ ] Add Evil to the nested vanilla Emacs configuration file.