From a078cabc7123ef9082e01c8eab29adc34f4b0399 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sat, 16 May 2020 03:54:44 +0100 Subject: fix(tools/emacs): Configure xkb switching shortcuts on EXWM launch 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. --- tools/emacs/config/desktop.el | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/tools/emacs/config/desktop.el b/tools/emacs/config/desktop.el index 0534f819b9..aefff0125f 100644 --- a/tools/emacs/config/desktop.el +++ b/tools/emacs/config/desktop.el @@ -139,21 +139,25 @@ (exwm-input-set-key (kbd "") #'brightness-up) (exwm-input-set-key (kbd "") #'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 -- cgit 1.4.1