aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tom Willemse2025-03-18 14:16:01 -0700
committerGravatar Tom Willemse2025-03-18 14:19:12 -0700
commit357d6f1f7c5735e4626d224f82d702dd5d09d194 (patch)
treef7847ac2a2f2d5c1080e019a467640e0b7505440
parent24c5bcf68fa828305a981479af82311925c4ae26 (diff)
downloadnew-dotfiles-357d6f1f7c5735e4626d224f82d702dd5d09d194.tar.gz
new-dotfiles-357d6f1f7c5735e4626d224f82d702dd5d09d194.zip
pop-os/stumpwm: Automate some cleanup tasks
- Add a ‘distraction!’ command that lets other things register a function to disable something if a distraction comes by. This includes clocking out of what I'm working on and turning off any music that's playing. - Clock out, turn off music, and pause dunst when I lock my screen. Resume notifications from dunst when I unlock the screen. - Add a shortcut to start the Antares SQL client.
-rw-r--r--oni/home/services/stumpwm/pop-os-config.lisp34
1 files changed, 34 insertions, 0 deletions
diff --git a/oni/home/services/stumpwm/pop-os-config.lisp b/oni/home/services/stumpwm/pop-os-config.lisp
index 950a370..fbada5e 100644
--- a/oni/home/services/stumpwm/pop-os-config.lisp
+++ b/oni/home/services/stumpwm/pop-os-config.lisp
@@ -3,6 +3,40 @@
(define-key m (kbd "b") "exec gtk-launch app.zen_browser.zen")
(define-key m (kbd "s") "exec gtk-launch com.slack.Slack")
(define-key m (kbd "t") "exec gtk-launch org.wezfurlong.wezterm")
+ (define-key m (kbd "q") "exec gtk-launch it.fabiodistasio.AntaresSQL")
m))
(define-key *top-map* (kbd "s-a") '*application-bindings*)
+
+(defvar *distraction-hook* nil
+ "Hook where application scan register functions to call when I'm distracted.")
+
+(defcommand distraction! () ()
+ (run-hook *distraction-hook*))
+
+(define-key *top-map* (kbd "s-d") "distraction!")
+
+(defun clock-out ()
+ (sb-ext:run-program
+ *shell-program* '("-c" "emacsclient --no-wait --eval \"(org-clock-out)\"")))
+
+(add-hook *screen-locking-hook* 'clock-out)
+(add-hook *distraction-hook* 'clock-out)
+
+(defun pause-music ()
+ (sb-ext:run-program
+ *shell-program* '("-c" "[ \"$(playerctl status)\" = \"Playing\" ]] && playerctl pause")))
+
+(add-hook *screen-locking-hook* 'pause-music)
+(add-hook *distraction-hook* 'pause-music)
+
+(defun pause-notifications ()
+ (sb-ext:run-program
+ *shell-program* '("-c" "dunstctl set-paused true")))
+
+(defun resume-notifications ()
+ (sb-ext:run-program
+ *shell-program* '("-c" "dunstctl set-paused false")))
+
+(add-hook *screen-locking-hook* 'pause-notifications)
+(add-hook *screen-unlocked-hook* 'resume-notifications)