feat(tazjin/emacs): Configurable screen lock & brightness adjustment

Change-Id: I749ce827c7d53ecf8dec66c1f62481e6ef44791d
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2645
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
This commit is contained in:
Vincent Ambo 2021-03-23 22:30:29 +02:00 committed by tazjin
parent 4057634a7a
commit 580d8fc37c

View file

@ -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