diff options
author | Chris Feng <chris.w.feng@gmail.com> | 2019-02-06T00·00+0000 |
---|---|---|
committer | Chris Feng <chris.w.feng@gmail.com> | 2019-02-06T00·00+0000 |
commit | e15728203834ac85a51997366d0a019acef56d6f (patch) | |
tree | 8829269ae48b8a6636fd6b7afc75dac9923e8cf2 | |
parent | 0f7269c4ec666eb8bcf2616abbb5af46087cbdea (diff) | |
parent | 97b1fb7c13ad7505ffe144f15875b366f1619f29 (diff) |
Merge branch 'ieure/default-simulation-keys' into externals/exwm
-rw-r--r-- | exwm-config.el | 60 | ||||
-rw-r--r-- | exwm-input.el | 8 |
2 files changed, 37 insertions, 31 deletions
diff --git a/exwm-config.el b/exwm-config.el index 50f13664c48d..6635e4345db3 100644 --- a/exwm-config.el +++ b/exwm-config.el @@ -31,38 +31,44 @@ (defun exwm-config-default () "Default configuration of EXWM." ;; Set the initial workspace number. - (setq exwm-workspace-number 4) + (unless (get 'exwm-workspace-number 'saved-value) + (setq exwm-workspace-number 4)) ;; Make class name the buffer name (add-hook 'exwm-update-class-hook (lambda () (exwm-workspace-rename-buffer exwm-class-name))) - ;; 's-r': Reset - (exwm-input-set-key (kbd "s-r") #'exwm-reset) - ;; 's-w': Switch workspace - (exwm-input-set-key (kbd "s-w") #'exwm-workspace-switch) - ;; 's-N': Switch to certain workspace - (dotimes (i 10) - (exwm-input-set-key (kbd (format "s-%d" i)) - `(lambda () - (interactive) - (exwm-workspace-switch-create ,i)))) - ;; 's-&': Launch application - (exwm-input-set-key (kbd "s-&") - (lambda (command) - (interactive (list (read-shell-command "$ "))) - (start-process-shell-command command nil command))) + ;; Global keybindings. + (unless (get 'exwm-input-global-keys 'saved-value) + (setq exwm-input-global-keys + `( + ;; 's-r': Reset (to line-mode). + ([?\s-r] . exwm-reset) + ;; 's-w': Switch workspace. + ([?\s-w] . exwm-workspace-switch) + ;; 's-&': Launch application. + ([?\s-&] . (lambda (command) + (interactive (list (read-shell-command "$ "))) + (start-process-shell-command command nil command))) + ;; 's-N': Switch to certain workspace. + ,@(mapcar (lambda (i) + `(,(kbd (format "s-%d" i)) . + (lambda () + (interactive) + (exwm-workspace-switch-create ,i)))) + (number-sequence 0 9))))) ;; Line-editing shortcuts - (setq exwm-input-simulation-keys - '(([?\C-b] . [left]) - ([?\C-f] . [right]) - ([?\C-p] . [up]) - ([?\C-n] . [down]) - ([?\C-a] . [home]) - ([?\C-e] . [end]) - ([?\M-v] . [prior]) - ([?\C-v] . [next]) - ([?\C-d] . [delete]) - ([?\C-k] . [S-end delete]))) + (unless (get 'exwm-input-simulation-keys 'saved-value) + (setq exwm-input-simulation-keys + '(([?\C-b] . [left]) + ([?\C-f] . [right]) + ([?\C-p] . [up]) + ([?\C-n] . [down]) + ([?\C-a] . [home]) + ([?\C-e] . [end]) + ([?\M-v] . [prior]) + ([?\C-v] . [next]) + ([?\C-d] . [delete]) + ([?\C-k] . [S-end delete])))) ;; Enable EXWM (exwm-enable) ;; Configure Ido diff --git a/exwm-input.el b/exwm-input.el index 4f64d35dd63d..04020acfaf2e 100644 --- a/exwm-input.el +++ b/exwm-input.el @@ -915,8 +915,9 @@ Notes: * The predefined examples in the Customize interface are not guaranteed to work for all applications. This can be tweaked on a per application basis with `exwm-input-set-local-simulation-keys'." - :type '(alist :key-type (choice (key-sequence :tag "Original")) - :value-type (choice (key-sequence :tag "Move left" [left]) + :type '(alist :key-type (key-sequence :tag "Original") + :value-type (choice (key-sequence :tag "User-defined") + (key-sequence :tag "Move left" [left]) (key-sequence :tag "Move right" [right]) (key-sequence :tag "Move up" [up]) (key-sequence :tag "Move down" [down]) @@ -928,8 +929,7 @@ Notes: (key-sequence :tag "Paste" [C-v]) (key-sequence :tag "Delete" [delete]) (key-sequence :tag "Delete to EOL" - [S-end delete]) - (key-sequence :tag "User-defined"))) + [S-end delete]))) :set (lambda (symbol value) (set symbol value) (exwm-input--set-simulation-keys value))) |