From 580d8fc37cb577d5027a288ce017bc73dc5d5b72 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Tue, 23 Mar 2021 22:30:29 +0200 Subject: feat(tazjin/emacs): Configurable screen lock & brightness adjustment Change-Id: I749ce827c7d53ecf8dec66c1f62481e6ef44791d Reviewed-on: https://cl.tvl.fyi/c/depot/+/2645 Reviewed-by: tazjin Tested-by: BuildkiteCI --- users/tazjin/emacs/config/desktop.el | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/users/tazjin/emacs/config/desktop.el b/users/tazjin/emacs/config/desktop.el index cbbad77990..a347133fae 100644 --- a/users/tazjin/emacs/config/desktop.el +++ b/users/tazjin/emacs/config/desktop.el @@ -12,6 +12,18 @@ (require 'exwm-randr) (require 'exwm-systemtray) +(defcustom tazjin--screen-lock-command "tazjin-screen-lock" + "Command to execute for locking the screen." + :group 'tazjin) + +(defcustom tazjin--backlight-increase-command "light -A 4" + "Command to increase screen brightness." + :group 'tazjin) + +(defcustom tazjin--backlight-decrease-command "light -U 4" + "Command to decrease screen brightness." + :group 'tazjin) + (defun pactl (cmd) (shell-command (concat "pactl " cmd)) (message "Volume command: %s" cmd)) @@ -22,12 +34,12 @@ (defun brightness-up () (interactive) - (shell-command "light -A 4") + (shell-command tazjin--backlight-increase-command) (message "Brightness increased")) (defun brightness-down () (interactive) - (shell-command "light -U 4") + (shell-command tazjin--backlight-decrease-command) (message "Brightness decreased")) (defun set-xkb-layout (layout) @@ -40,14 +52,7 @@ (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. - ;; - ;; The reason for things being set up this way is that I want - ;; xsecurelock.service to be started as a system-wide service that - ;; is tied to suspend.target. - (shell-command "/usr/bin/sudo /usr/bin/systemctl start xsecurelock.service")) + (shell-command tazjin--screen-lock-command)) (defun create-window-name () "Construct window names to be used for EXWM buffers by -- cgit 1.4.1