153 lines
4.6 KiB
Org Mode
153 lines
4.6 KiB
Org Mode
#+TITLE: EXWM Configuration
|
|
Using Emacs as a window manager.
|
|
|
|
* Config Functions
|
|
This Config is not actually mine, so I don't fully understand it either
|
|
|
|
#+begin_src emacs-lisp
|
|
|
|
(defun exwm-config--fix/ido-buffer-window-other-frame ()
|
|
"Fix `ido-buffer-window-other-frame'."
|
|
(defalias 'exwm-config-ido-buffer-window-other-frame
|
|
(symbol-function #'ido-buffer-window-other-frame))
|
|
(defun ido-buffer-window-other-frame (buffer)
|
|
"This is a version redefined by EXWM.
|
|
|
|
You can find the original one at `exwm-config-ido-buffer-window-other-frame'."
|
|
(with-current-buffer (window-buffer (selected-window))
|
|
(if (and (derived-mode-p 'exwm-mode)
|
|
exwm--floating-frame)
|
|
;; Switch from a floating frame.
|
|
(with-current-buffer buffer
|
|
(if (and (derived-mode-p 'exwm-mode)
|
|
exwm--floating-frame
|
|
(eq exwm--frame exwm-workspace--current))
|
|
;; Switch to another floating frame.
|
|
(frame-root-window exwm--floating-frame)
|
|
;; Do not switch if the buffer is not on the current workspace.
|
|
(or (get-buffer-window buffer exwm-workspace--current)
|
|
(selected-window))))
|
|
(with-current-buffer buffer
|
|
(when (derived-mode-p 'exwm-mode)
|
|
(if (eq exwm--frame exwm-workspace--current)
|
|
(when exwm--floating-frame
|
|
;; Switch to a floating frame on the current workspace.
|
|
(frame-selected-window exwm--floating-frame))
|
|
;; Do not switch to exwm-mode buffers on other workspace (which
|
|
;; won't work unless `exwm-layout-show-all-buffers' is set)
|
|
(unless exwm-layout-show-all-buffers
|
|
(selected-window)))))))))
|
|
|
|
#+end_src
|
|
|
|
* Start EXWM
|
|
|
|
#+begin_src emacs-lisp
|
|
|
|
(use-package exwm
|
|
:config
|
|
;; Set the default number of workspaces
|
|
(setq exwm-workspace-number 10)
|
|
|
|
;; When window "class" updates, use it to set the buffer name
|
|
(add-hook 'exwm-update-class-hook
|
|
(lambda ()
|
|
(exwm-workspace-rename-buffer exwm-class-name)))
|
|
|
|
|
|
;; Set the screen resolution (update this to be the correct resolution for your screen!)
|
|
(require 'exwm-randr)
|
|
|
|
;; (setq exwm-randr-workspace-output-plist
|
|
;; '(0 "HDMI1" 1 "eDP1" 2 "HDMI1" 3 "eDP1" 4 "HDMI1" 5 "eDP1" 6 "HDMI1" 7 "eDP1" 8 "HDMI1" 9 "eDP1"))
|
|
|
|
;; (add-hook 'exwm-randr-screen-change-hook
|
|
;; (lambda ()
|
|
;; (start-process-shell-command
|
|
;; "xrandr" nil "xrandr --output HDMI1 --primary --mode 1920x1080 --output eDP1 --left-of HDMI1 --mode 1366x768 --rotate left")))
|
|
|
|
(exwm-randr-enable)
|
|
|
|
;; Load the system tray before exwm-init
|
|
(require 'exwm-systemtray)
|
|
(exwm-systemtray-enable)
|
|
|
|
;; make emacs input method available to other programs
|
|
(require 'exwm-xim)
|
|
(exwm-xim-enable)
|
|
|
|
(require 'org-crypt)
|
|
(org-crypt-use-before-save-magic)
|
|
|
|
;; as the name suggests
|
|
;; (exwm-enable-ido-workaround)
|
|
|
|
;; These keys should always pass through to Emacs
|
|
(setq exwm-input-prefix-keys
|
|
'(?\C-x
|
|
?\C-u
|
|
?\C-h
|
|
?\M-x
|
|
?\M-`
|
|
?\M-&
|
|
?\M-:
|
|
?\C-\\ ;; backslash
|
|
?\C-\M-j ;; Buffer list
|
|
?\C-\ ;; ctrl-space
|
|
?\s-a ;; audio binding
|
|
?\s-m )) ;; music binding
|
|
|
|
;; Set up global key bindippngs. These always work, no matter the input state!
|
|
;; Keep in mind that changing this list after EXWM initializes has no effect.
|
|
(setq exwm-input-global-keys
|
|
`(
|
|
;; Reset to line-mode (C-c C-k switches to char-mode via exwm-input-release-keyboard)p
|
|
([?\s-w ?\C-r] . exwm-reset)
|
|
|
|
;; Move between windows
|
|
([?\s-w ?\s-b] . windmove-left)
|
|
([?\s-w ?\s-f] . windmove-right)
|
|
([?\s-w ?\s-p] . windmove-up)
|
|
([?\s-w ?\s-n] . windmove-down)
|
|
|
|
;; Launch applications via shell command
|
|
([?\s-&] . (lambda (command)
|
|
(interactive (list (read-shell-command "$ ")))
|
|
(start-process-shell-command command nil command)))
|
|
|
|
;; toggle modeline
|
|
([?\s-w ?\t] . exwm-layout-toggle-mode-line)
|
|
|
|
;; Switch workspace
|
|
([?\s-w ?\w] . exwm-workspace-switch)
|
|
([?\s-w ?\m] . exwm-workspace-move-window)))
|
|
;; 's-N': Switch to certain workspace with Super (Win) plus a number key (0 - 9)
|
|
;; ,@(mapcar (lambda (i)
|
|
;; `(,(kbd (format "s-w %d" i)) .
|
|
;; (lambda ()
|
|
;; (interactive)
|
|
;; (exwm-workspace-switch-create ,i))))
|
|
;; (number-sequence 0 9))))
|
|
|
|
(setq exwm-input-simulation-keys
|
|
'(([?\C-b] . [left])
|
|
([?\C-f] . [right])
|
|
([?\C-p] . [up])
|
|
([?\C-n] . [down])
|
|
([?\C-a] . [home])
|
|
([?\C-e] . [end])
|
|
([?\C-\ ] . [?\C-a])
|
|
([?\M-v] . [prior])
|
|
([?\C-v] . [next])
|
|
([?\C-d] . [delete])
|
|
([?\C-k] . [S-end delete])
|
|
([?\C-s] . [?\C-f])
|
|
([?\C-x ?\h] . [?\C-h])
|
|
([?\C-y] . [?\C-v])
|
|
([?\C-g] . [escape])))
|
|
|
|
;; (exwm-enable)
|
|
(add-hook 'exwm-init-hook #'exwm-config--fix/ido-buffer-window-other-frame))
|
|
|
|
#+end_src
|