summaryrefslogtreecommitdiff
path: root/home-configuration.scm
diff options
context:
space:
mode:
authorTimo Wilken2022-12-19 14:17:17 +0100
committerTimo Wilken2022-12-19 14:17:17 +0100
commit92ff2e4e3a9c4e822e14ca7b9460b23cb488256c (patch)
tree305fc7606641ad85122c00a513b395bbf6cc4421 /home-configuration.scm
parent8fabb5505a97163fdc75134359662bb0713bbe9f (diff)
Add screen locking script
Diffstat (limited to 'home-configuration.scm')
-rw-r--r--home-configuration.scm15
1 files changed, 15 insertions, 0 deletions
diff --git a/home-configuration.scm b/home-configuration.scm
index fa266f90..74abf75d 100644
--- a/home-configuration.scm
+++ b/home-configuration.scm
@@ -48,6 +48,10 @@
;; relative to the working directory, not this file's directory.
#.(define catppuccin-theme-variant "mocha")
+;; "Base" colour from the active Catppuccin theme (see
+;; https://github.com/catppuccin/catppuccin).
+(define catppuccin-background-color "1e1e2e")
+
(define* (package-binary specification #:optional (binary specification))
"Get the path of BINARY inside the package referred to by SPECIFICATION."
(file-append (specification->package specification)
@@ -318,6 +322,17 @@ replacement spec (to which `regexp-substitute/global' is applied)."
(".local/bin/icat" ; kitty's "catimg" equivalent
,(program-file "icat" #~(apply execl #$(package-binary "kitty") "kitty"
"+kitten" "icat" (cdr (command-line)))))
+ (".local/bin/screenlock"
+ ,(program-file
+ "screenlock"
+ #~(begin ; Wrapper around i3lock to turn off the screen and pause notifications.
+ (system* #$(package-binary "dunst" "dunstctl") "set-paused" "true")
+ (system* #$(package-binary "xset") "dpms" "0" "0" "5")
+ ;; We mustn't use `package-binary' here, as we have to pick up the
+ ;; setuid binary for i3lock installed by the system config.
+ (system* "i3lock" "-nc" #$catppuccin-background-color)
+ (system* #$(package-binary "xset") "dpms" "0" "0" "0")
+ (system* #$(package-binary "dunst" "dunstctl") "set-paused" "false"))))
;; With #:recursive? #t, Guix keeps the files' permission bits, i.e. makes them executable.
(".local/bin/sessionmenu" ,(local-file "sessionmenu" #:recursive? #t)) ; rofi logout/reboot menu
(".local/bin/passmenu" ,(local-file "passmenu" #:recursive? #t)) ; rofi passwords menu