Re-grab global keys on keyboard update

* exwm-input.el (exwm-input--on-keysyms-update): New function for
re-grabbing global keys.
(exwm-input--init): Register it to XELB.
This commit is contained in:
Chris Feng 2017-11-26 20:26:57 +08:00
parent 76b567dddb
commit 2b183f2212

View file

@ -127,6 +127,10 @@ ARGS are additional arguments to CALLBACK."
(x-focus-frame (selected-frame)) (x-focus-frame (selected-frame))
(select-window (selected-window)))))) (select-window (selected-window))))))
(defun exwm-input--on-keysyms-update ()
(let ((exwm-input--global-prefix-keys nil))
(exwm-input--update-global-prefix-keys)))
(defun exwm-input--on-workspace-list-change () (defun exwm-input--on-workspace-list-change ()
"Run in `exwm-input--update-global-prefix-keys'." "Run in `exwm-input--update-global-prefix-keys'."
(dolist (f exwm-workspace--list) (dolist (f exwm-workspace--list)
@ -702,7 +706,7 @@ Its usage is the same with `exwm-input-set-simulation-keys'."
(defun exwm-input--init () (defun exwm-input--init ()
"Initialize the keyboard module." "Initialize the keyboard module."
;; Refresh keyboard mapping ;; Refresh keyboard mapping
(xcb:keysyms:init exwm--connection) (xcb:keysyms:init exwm--connection #'exwm-input--on-keysyms-update)
;; Create the X window and intern the atom used to fetch timestamp. ;; Create the X window and intern the atom used to fetch timestamp.
(setq exwm-input--timestamp-window (xcb:generate-id exwm--connection)) (setq exwm-input--timestamp-window (xcb:generate-id exwm--connection))
(xcb:+request exwm--connection (xcb:+request exwm--connection