aboutsummaryrefslogtreecommitdiffstats
path: root/oni
diff options
context:
space:
mode:
authorGravatar Tom Willemse2023-03-16 22:13:22 -0700
committerGravatar Tom Willemse2023-03-16 22:13:22 -0700
commit7d079e89736d723931abc2ac02f2284b893bc2a4 (patch)
tree8d62eeb0b803e79952c515750c07ea86ada0a3aa /oni
parent05ba6544e2548cda40b5b39938f66d168bf8fb0b (diff)
downloadnew-dotfiles-7d079e89736d723931abc2ac02f2284b893bc2a4.tar.gz
new-dotfiles-7d079e89736d723931abc2ac02f2284b893bc2a4.zip
Add screen locking to my stumpwm config
Diffstat (limited to 'oni')
-rw-r--r--oni/home/services/stumpwm/config22
1 files changed, 22 insertions, 0 deletions
diff --git a/oni/home/services/stumpwm/config b/oni/home/services/stumpwm/config
index 170f0db..544096c 100644
--- a/oni/home/services/stumpwm/config
+++ b/oni/home/services/stumpwm/config
@@ -5,6 +5,27 @@
(set-prefix-key (kbd "s-x"))
+(defvar *screen-locking-hook* nil
+ "Hook that gets called right before the screen gets locked.")
+
+(defvar *screen-unlocked-hook* nil
+ "Hook that gets called right after the screen is unlocked.")
+
+(defun run-screen-unlocked-hook (process)
+ "Run `*screen-unlocked-hook* if PROCESS' status is `:exited'."
+ (when (eq (sb-ext:process-status process) :exited)
+ (run-hook *screen-unlocked-hook*)))
+
+(defcommand lock-screen () ()
+ "Lock the screen using i3lock.
+Run `*screen-locking-hook*' before locking it and run `*screen-unlocked-hook*'
+after it has been unlocked."
+ (run-hook *screen-locking-hook*)
+ (sb-ext:run-program
+ "/usr/bin/i3lock" '("--nofork" "--color=000000")
+ :wait nil
+ :status-hook #'run-screen-unlocked-hook))
+
(defcommand raise-browser () ()
"Open or show my browser"
(run-or-raise "firefox" '(:class "firefox")))
@@ -17,6 +38,7 @@
"Open or show my terminal"
(run-or-raise "kitty" '(:class "kitty")))
+(define-key *top-map* (kbd "C-M-l") "lock-screen")
(define-key *top-map* (kbd "s-b") "raise-browser")
(define-key *top-map* (kbd "s-e") "raise-emacs")
(define-key *top-map* (kbd "s-t") "raise-terminal")