From de64ebbbaa808ee9d6162de991d15300f3b12044 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Tue, 19 Jan 2021 17:49:16 +0300 Subject: feat(tazjin/emacs): Reset keyboard layout before locking screen I managed to lock myself out by having the layout set to Russian while locking the screen. This prevents that from happening. Change-Id: I15780d2a626d96abe0af8db3736fad75034e66d8 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2424 Reviewed-by: tazjin Tested-by: BuildkiteCI --- users/tazjin/emacs/config/desktop.el | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'users/tazjin/emacs/config') diff --git a/users/tazjin/emacs/config/desktop.el b/users/tazjin/emacs/config/desktop.el index 7b3a5d4c4be6..1900299b2ae3 100644 --- a/users/tazjin/emacs/config/desktop.el +++ b/users/tazjin/emacs/config/desktop.el @@ -30,8 +30,17 @@ (shell-command "xbacklight -dec 5") (message "Brightness decreased")) +(defun set-xkb-layout (layout) + "Set the current X keyboard layout." + + (shell-command (format "setxkbmap %s" layout)) + (shell-command "setxkbmap -option caps:super") + (message "Set X11 keyboard layout to '%s'" layout)) + (defun lock-screen () (interactive) + (set-xkb-layout "us") + ;; A sudoers configuration is in place that lets me execute this ;; particular command without having to enter a password. ;; @@ -40,13 +49,6 @@ ;; is tied to suspend.target. (shell-command "/usr/bin/sudo /usr/bin/systemctl start xsecurelock.service")) -(defun set-xkb-layout (layout) - "Set the current X keyboard layout." - - (shell-command (format "setxkbmap %s" layout)) - (shell-command "setxkbmap -option caps:super") - (message "Set X11 keyboard layout to '%s'" layout)) - (defun create-window-name () "Construct window names to be used for EXWM buffers by inspecting the window's X11 class and title. -- cgit 1.4.1