about summary refs log tree commit diff
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2021-01-19T14·49+0300
committertazjin <mail@tazj.in>2021-01-19T15·04+0000
commitde64ebbbaa808ee9d6162de991d15300f3b12044 (patch)
tree6ed61a031081316e486a4fc15becdecf98a76bb9
parent8ab02db6c5d1e33a89677060bb31b1a3e961e78f (diff)
feat(tazjin/emacs): Reset keyboard layout before locking screen r/2135
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 <mail@tazj.in>
Tested-by: BuildkiteCI
-rw-r--r--users/tazjin/emacs/config/desktop.el16
1 files changed, 9 insertions, 7 deletions
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.