From f1412a6d54bab6ff2c560a2a3435b9559c93194e Mon Sep 17 00:00:00 2001 From: Jeremy Dormitzer Date: Sun, 29 Mar 2020 14:48:45 -0400 Subject: [PATCH] Use pywal for StumpWM theme colors --- stumpwm/.config/wal/hooks/10-stumpwm.sh | 1 + stumpwm/.stumpwm.d/init.lisp | 100 ++++++++++++++++-------- 2 files changed, 67 insertions(+), 34 deletions(-) create mode 100755 stumpwm/.config/wal/hooks/10-stumpwm.sh diff --git a/stumpwm/.config/wal/hooks/10-stumpwm.sh b/stumpwm/.config/wal/hooks/10-stumpwm.sh new file mode 100755 index 0000000..1fd7c56 --- /dev/null +++ b/stumpwm/.config/wal/hooks/10-stumpwm.sh @@ -0,0 +1 @@ +echo '(stumpwm::set-colors)' | stumpish -e eval diff --git a/stumpwm/.stumpwm.d/init.lisp b/stumpwm/.stumpwm.d/init.lisp index 2259530..09d3d56 100644 --- a/stumpwm/.stumpwm.d/init.lisp +++ b/stumpwm/.stumpwm.d/init.lisp @@ -7,25 +7,74 @@ :style swank:*communication-style* :dont-close t) +;; Colors +(defvar wal-colors-path "~/.cache/wal/colors") + +;; Solarized Light +(defvar default-colors + '("#002b36" + "#073642" + "#586e75" + "#657b83" + "#839496" + "#93a1a1" + "#eee8d5" + "#fdf6e3" + "#b58900" + "#cb4b16" + "#dc322f" + "#d33682" + "#6c71c4" + "#268bd2" + "#2aa198" + "#859900")) + +(defun get-color-palette () + (let ((wal-colors (when (probe-file wal-colors-path) + (uiop:read-file-lines wal-colors-path)))) + (or wal-colors default-colors))) + (defun get-color (name) - (let ((colors '(("base03" . "#002b36") - ("base02" . "#073642") - ("base01" . "#586e75") - ("base00" . "#657b83") - ("base0" . "#839496") - ("base1" . "#93a1a1") - ("base2" . "#eee8d5") - ("base3" . "#fdf6e3") - ("yellow" . "#b58900") - ("orange" . "#cb4b16") - ("red" . "#dc322f") - ("magenta" . "#d33682") - ("violet" . "#6c71c4") - ("blue" . "#268bd2") - ("cyan" . "#2aa198") - ("green" . "#859900")))) + (let ((colors (mapcar 'cons + '("base03" + "base02" + "base01" + "base00" + "base0" + "base1" + "base2" + "base3" + "yellow" + "orange" + "red" + "magenta" + "violet" + "blue" + "cyan" + "green") + (get-color-palette)))) (cdr (assoc name colors :test 'equal)))) +(defun set-colors () + (setq *colors* (list (get-color "base02") + (get-color "red") + (get-color "green") + (get-color "yellow") + (get-color "blue") + (get-color "magenta") + (get-color "cyan") + (get-color "base2"))) + (update-color-map (current-screen)) + (set-fg-color (get-color "base3")) + (set-bg-color (get-color "base03")) + (set-border-color (get-color "base02")) + (set-focus-color (get-color "base03")) + (set-unfocus-color (get-color "base03")) + (set-float-focus-color (get-color "base03")) + (set-float-unfocus-color (get-color "base03"))) + +(set-colors) + ;; StumpWM configs (setq *message-window-gravity* :center *input-window-gravity* :center @@ -37,28 +86,11 @@ *transient-border-width* 2 stumpwm::*float-window-border* 2 stumpwm::*float-window-title-height* 2 - *mouse-focus-policy* :click - *colors* (list (get-color "base02") - (get-color "red") - (get-color "green") - (get-color "yellow") - (get-color "blue") - (get-color "magenta") - (get-color "cyan") - (get-color "base2"))) + *mouse-focus-policy* :click) ;; Input/message bar -(set-fg-color (get-color "base00")) -(set-bg-color (get-color "base3")) -(set-border-color (get-color "base2")) (set-msg-border-width 2) -;; Windows -(set-focus-color (get-color "base2")) -(set-unfocus-color (get-color "base2")) -(set-float-focus-color (get-color "base2")) -(set-float-unfocus-color (get-color "base2")) - ;; Sudo (defcommand stumpwm-password (prompt) ((:string "prompt: ")) "Prompts the user for a password"