From 357d6f1f7c5735e4626d224f82d702dd5d09d194 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Tue, 18 Mar 2025 14:16:01 -0700 Subject: 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. --- oni/home/services/stumpwm/pop-os-config.lisp | 34 ++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) 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) -- cgit v1.3-2-g0d8e