Add StumpWM command and keybindings to run wal

This commit is contained in:
Jeremy Dormitzer 2020-03-29 23:13:17 -04:00
parent 30bc951552
commit 6ea6b8e7fd

View File

@ -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")