From 6ea6b8e7fd76728124de719596cc83e4c04c2160 Mon Sep 17 00:00:00 2001 From: Jeremy Dormitzer Date: Sun, 29 Mar 2020 23:13:17 -0400 Subject: [PATCH] Add StumpWM command and keybindings to run wal --- stumpwm/.stumpwm.d/init.lisp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/stumpwm/.stumpwm.d/init.lisp b/stumpwm/.stumpwm.d/init.lisp index 09d3d56..bbc889d 100644 --- a/stumpwm/.stumpwm.d/init.lisp +++ b/stumpwm/.stumpwm.d/init.lisp @@ -102,6 +102,36 @@ ,collect-output-p)) ;; Commands +(defvar desktop-images-dir + (uiop:native-namestring "~/Dropbox/pictures/desktop/")) + +(define-stumpwm-type :desktop-image (input prompt) + (or (argument-pop-rest input) + (concatenate 'string desktop-images-dir + (completing-read (current-screen) + prompt + (mapcar 'file-namestring + (uiop:directory-files desktop-images-dir)))))) + +(defun run-wal (image &optional light?) + (run-shell-command + (concatenate 'string + "wal " + (when light? "-l ") + "-i " image " " + "-o " + "\"" (uiop:native-namestring "~/bin/run-wal-hooks.sh") "\""))) + +(defcommand wal-dark (image) ((:desktop-image "Set desktop background: ")) + (run-wal image)) + +(defcommand wal-light (image) ((:desktop-image "Set desktop background: ")) + (run-wal image )) + +(define-interactive-keymap wal nil + ((kbd "l") "wal-light" t) + ((kbd "d") "wal-dark" t)) + (defcommand shutdown () () (when (y-or-n-p (format nil "~@{~a~^~%~}" "You are about to shut down the computer." @@ -153,6 +183,7 @@ (define-key stumpwm:*root-map* (kbd "b") "battery") (define-key stumpwm:*root-map* (kbd "C-o") "org-capture") (define-key stumpwm:*root-map* (kbd "C-q") "quit-confirm") +(define-key stumpwm:*root-map* (kbd "T") "wal") (define-key *top-map* (kbd "M-TAB") "pull-hidden-next") (define-key *top-map* (kbd "XF86MonBrightnessDown") "exec light -U 5") (define-key *top-map* (kbd "XF86MonBrightnessUp") "exec light -A 5")