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 <mail@tazj.in>
Tested-by: BuildkiteCI
This commit is contained in:
Vincent Ambo 2021-01-19 17:49:16 +03:00 committed by tazjin
parent 8ab02db6c5
commit de64ebbbaa

View file

@ -30,8 +30,17 @@
(shell-command "xbacklight -dec 5") (shell-command "xbacklight -dec 5")
(message "Brightness decreased")) (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 () (defun lock-screen ()
(interactive) (interactive)
(set-xkb-layout "us")
;; A sudoers configuration is in place that lets me execute this ;; A sudoers configuration is in place that lets me execute this
;; particular command without having to enter a password. ;; particular command without having to enter a password.
;; ;;
@ -40,13 +49,6 @@
;; is tied to suspend.target. ;; is tied to suspend.target.
(shell-command "/usr/bin/sudo /usr/bin/systemctl start xsecurelock.service")) (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 () (defun create-window-name ()
"Construct window names to be used for EXWM buffers by "Construct window names to be used for EXWM buffers by
inspecting the window's X11 class and title. inspecting the window's X11 class and title.