about summary refs log tree commit diff
path: root/tools
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2020-05-16T02·54+0100
committerVincent Ambo <tazjin@google.com>2020-05-16T02·55+0100
commita078cabc7123ef9082e01c8eab29adc34f4b0399 (patch)
treeb9e61b24ffdfab38d4dad2da5f8b0c01fafe8ae7 /tools
parentdd7e5e0377585b393c6e640001a21e16b9933405 (diff)
fix(tools/emacs): Configure xkb switching shortcuts on EXWM launch r/718
This enables half of the shortcuts for switching keyboard languages
when EXWM launches.

The cyrillic ones are commented out because Emacs doesn't start
otherwise, I've no idea why and don't care at the moment.
Diffstat (limited to 'tools')
-rw-r--r--tools/emacs/config/desktop.el34
1 files changed, 19 insertions, 15 deletions
diff --git a/tools/emacs/config/desktop.el b/tools/emacs/config/desktop.el
index 0534f819b908..aefff0125ffb 100644
--- a/tools/emacs/config/desktop.el
+++ b/tools/emacs/config/desktop.el
@@ -139,21 +139,25 @@
 (exwm-input-set-key (kbd "<XF86MonBrightnessUp>") #'brightness-up)
 (exwm-input-set-key (kbd "<XF86Display>") #'lock-screen)
 
-;; Keyboard layouts (these are bound separately in Cyrillic
-;; because I don't use reverse-im)
-;; (-map
-;;  (lambda (pair)
-;;    (exwm-input-set-key
-;;     (kbd (format "s-%s" (cadr pair)))
-;;     `(lambda () (interactive) (set-xkb-layout ,(car pair)))))
-;;  '(("de" "k d")
-;;    ("de" "л в")
-;;    ("no" "k n")
-;;    ("no" "л т")
-;;    ("ru" "k r")
-;;    ("ru" "л к")
-;;    ("us" "k u")
-;;    ("us" "л г")))
+;; Shortcuts for switching between keyboard layouts
+(defmacro bind-xkb (lang key)
+  `(exwm-input-set-key (kbd (format "s-%s" ,key))
+                       (lambda ()
+                         (interactive)
+                         (set-xkb-layout ,lang))))
+
+(bind-xkb "us" "k u")
+(bind-xkb "de" "k d")
+(bind-xkb "no" "k n")
+(bind-xkb "ru" "k r")
+
+;; These are commented out because Emacs no longer starts (??) if
+;; they're set at launch.
+;;
+;; (bind-xkb "us" "л г")
+;; (bind-xkb "de" "л в")
+;; (bind-xkb "no" "л т")
+;; (bind-xkb "ru" "л к")
 
 ;; Line-editing shortcuts
 (exwm-input-set-simulation-keys