Merge branch 'ieure/default-simulation-keys' into externals/exwm

This commit is contained in:
Chris Feng 2019-02-06 00:00:00 +00:00
commit e157282038
2 changed files with 37 additions and 31 deletions

View file

@ -31,38 +31,44 @@
(defun exwm-config-default () (defun exwm-config-default ()
"Default configuration of EXWM." "Default configuration of EXWM."
;; Set the initial workspace number. ;; 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 ;; Make class name the buffer name
(add-hook 'exwm-update-class-hook (add-hook 'exwm-update-class-hook
(lambda () (lambda ()
(exwm-workspace-rename-buffer exwm-class-name))) (exwm-workspace-rename-buffer exwm-class-name)))
;; 's-r': Reset ;; Global keybindings.
(exwm-input-set-key (kbd "s-r") #'exwm-reset) (unless (get 'exwm-input-global-keys 'saved-value)
;; 's-w': Switch workspace (setq exwm-input-global-keys
(exwm-input-set-key (kbd "s-w") #'exwm-workspace-switch) `(
;; 's-N': Switch to certain workspace ;; 's-r': Reset (to line-mode).
(dotimes (i 10) ([?\s-r] . exwm-reset)
(exwm-input-set-key (kbd (format "s-%d" i)) ;; 's-w': Switch workspace.
`(lambda () ([?\s-w] . exwm-workspace-switch)
(interactive) ;; 's-&': Launch application.
(exwm-workspace-switch-create ,i)))) ([?\s-&] . (lambda (command)
;; 's-&': Launch application (interactive (list (read-shell-command "$ ")))
(exwm-input-set-key (kbd "s-&") (start-process-shell-command command nil command)))
(lambda (command) ;; 's-N': Switch to certain workspace.
(interactive (list (read-shell-command "$ "))) ,@(mapcar (lambda (i)
(start-process-shell-command command nil command))) `(,(kbd (format "s-%d" i)) .
(lambda ()
(interactive)
(exwm-workspace-switch-create ,i))))
(number-sequence 0 9)))))
;; Line-editing shortcuts ;; Line-editing shortcuts
(setq exwm-input-simulation-keys (unless (get 'exwm-input-simulation-keys 'saved-value)
'(([?\C-b] . [left]) (setq exwm-input-simulation-keys
([?\C-f] . [right]) '(([?\C-b] . [left])
([?\C-p] . [up]) ([?\C-f] . [right])
([?\C-n] . [down]) ([?\C-p] . [up])
([?\C-a] . [home]) ([?\C-n] . [down])
([?\C-e] . [end]) ([?\C-a] . [home])
([?\M-v] . [prior]) ([?\C-e] . [end])
([?\C-v] . [next]) ([?\M-v] . [prior])
([?\C-d] . [delete]) ([?\C-v] . [next])
([?\C-k] . [S-end delete]))) ([?\C-d] . [delete])
([?\C-k] . [S-end delete]))))
;; Enable EXWM ;; Enable EXWM
(exwm-enable) (exwm-enable)
;; Configure Ido ;; Configure Ido

View file

@ -915,8 +915,9 @@ Notes:
* The predefined examples in the Customize interface are not guaranteed to * The predefined examples in the Customize interface are not guaranteed to
work for all applications. This can be tweaked on a per application basis work for all applications. This can be tweaked on a per application basis
with `exwm-input-set-local-simulation-keys'." with `exwm-input-set-local-simulation-keys'."
:type '(alist :key-type (choice (key-sequence :tag "Original")) :type '(alist :key-type (key-sequence :tag "Original")
:value-type (choice (key-sequence :tag "Move left" [left]) :value-type (choice (key-sequence :tag "User-defined")
(key-sequence :tag "Move left" [left])
(key-sequence :tag "Move right" [right]) (key-sequence :tag "Move right" [right])
(key-sequence :tag "Move up" [up]) (key-sequence :tag "Move up" [up])
(key-sequence :tag "Move down" [down]) (key-sequence :tag "Move down" [down])
@ -928,8 +929,7 @@ Notes:
(key-sequence :tag "Paste" [C-v]) (key-sequence :tag "Paste" [C-v])
(key-sequence :tag "Delete" [delete]) (key-sequence :tag "Delete" [delete])
(key-sequence :tag "Delete to EOL" (key-sequence :tag "Delete to EOL"
[S-end delete]) [S-end delete])))
(key-sequence :tag "User-defined")))
:set (lambda (symbol value) :set (lambda (symbol value)
(set symbol value) (set symbol value)
(exwm-input--set-simulation-keys value))) (exwm-input--set-simulation-keys value)))