From 6df182d45e523c08507f509ec5c6dc3c201a5d22 Mon Sep 17 00:00:00 2001 From: William Carroll Date: Sun, 4 Oct 2020 13:56:01 +0100 Subject: Move KBDs from window-manager.el to keybindings.el Assuming (hoping) that this doesn't break anything. --- emacs/.emacs.d/wpc/keybindings.el | 36 +++++++++++++++++++++++ emacs/.emacs.d/wpc/window-manager.el | 56 +----------------------------------- 2 files changed, 37 insertions(+), 55 deletions(-) (limited to 'emacs') diff --git a/emacs/.emacs.d/wpc/keybindings.el b/emacs/.emacs.d/wpc/keybindings.el index 9a9f35472fc6..2563b152359a 100644 --- a/emacs/.emacs.d/wpc/keybindings.el +++ b/emacs/.emacs.d/wpc/keybindings.el @@ -37,6 +37,7 @@ (require 'fonts) (require 'bookmark) (require 'constants) +(require 'window-manager) ;; Note: The following lines must be sorted this way. (setq evil-want-integration t) @@ -147,6 +148,41 @@ (keybindings-exwm (kbd-raw 'workspace "j") #'fonts-decrease-size) (keybindings-exwm (kbd-raw 'workspace "0") #'fonts-reset-size) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Window sizing +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(keybindings-exwm "C-M-=" #'balance-windows) +(keybindings-exwm "C-M-j" #'shrink-window) +(keybindings-exwm "C-M-k" #'enlarge-window) +(keybindings-exwm "C-M-h" #'shrink-window-horizontally) +(keybindings-exwm "C-M-l" #'enlarge-window-horizontally) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Window Management +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(keybindings-exwm "M-h" #'windmove-left) +(keybindings-exwm "M-j" #'windmove-down) +(keybindings-exwm "M-k" #'windmove-up) +(keybindings-exwm "M-l" #'windmove-right) +(keybindings-exwm "M-\\" #'evil-window-vsplit) +(keybindings-exwm "M--" #'evil-window-split) +(keybindings-exwm "M-q" #'delete-window) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Miscellaneous +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(keybindings-exwm "M-:" #'eval-expression) +(keybindings-exwm "M-SPC" #'ivy-helpers-run-external-command) +(keybindings-exwm "M-x" #'counsel-M-x) +(keybindings-exwm "" #'window-manager-next-workspace) +(keybindings-exwm "" #'window-manager-prev-workspace) +(keybindings-exwm "C-M-\\" #'ivy-pass) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Workspaces +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(keybindings-exwm (kbd-raw 'workspace "l") #'window-manager-logout) + (general-define-key :keymaps 'override "M-q" #'delete-window diff --git a/emacs/.emacs.d/wpc/window-manager.el b/emacs/.emacs.d/wpc/window-manager.el index 4da42d76efd5..000fca87a155 100644 --- a/emacs/.emacs.d/wpc/window-manager.el +++ b/emacs/.emacs.d/wpc/window-manager.el @@ -115,59 +115,7 @@ (list i (window-manager--named-workspace-display x)))) -flatten)) (evil-set-initial-state 'exwm-mode 'emacs) - (setq exwm-workspace-number - (list-length window-manager--named-workspaces)) - (let ((kbds `( - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - ;; Window sizing - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - (:key "C-M-=" :fn balance-windows) - ;; TODO: Make sure these don't interfere with LISP KBDs. - (:key "C-M-j" :fn shrink-window) - (:key "C-M-k" :fn enlarge-window) - (:key "C-M-h" :fn shrink-window-horizontally) - (:key "C-M-l" :fn enlarge-window-horizontally) - - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - ;; Window traversing - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - (:key "M-h" :fn windmove-left) - (:key "M-j" :fn windmove-down) - (:key "M-k" :fn windmove-up) - (:key "M-l" :fn windmove-right) - - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - ;; Window splitting - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - (:key "M-\\" :fn evil-window-vsplit) - (:key "M--" :fn evil-window-split) - - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - ;; Window deletion - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - (:key "M-q" :fn delete-window) - - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - ;; Miscellaneous - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - (:key "M-:" :fn eval-expression) - (:key "M-SPC" :fn ivy-helpers-run-external-command) - (:key "M-x" :fn counsel-M-x) - (:key "" :fn window-manager-next-workspace) - (:key "" :fn window-manager-prev-workspace) - (:key "" :fn window-manager-prev-workspace) - (:key "C-M-\\" :fn ivy-pass) - - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - ;; Workspaces - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - (:key ,(kbd-raw 'workspace "l") :fn window-manager-logout)))) - - (setq exwm-input-global-keys - (->> kbds - (-map (lambda (plist) - `(,(kbd (plist-get plist :key)) . - ,(plist-get plist :fn))))))) + (setq exwm-workspace-number (list-length window-manager--named-workspaces)) (setq exwm-input-simulation-keys ;; TODO: Consider supporting M-d and other readline style KBDs. '(([?\C-b] . [left]) @@ -184,8 +132,6 @@ ([?\C-c] . [C-c]))) (exwm-enable)) -;; TODO: Package workspace management in another module. - ;; Here is the code required to allow EXWM to cycle workspaces. (defconst window-manager--workspaces (->> window-manager--named-workspaces -- cgit 1.4.1