diff --git a/.config/doom/config.el b/.config/doom/config.el index 6395b2d..2669ed2 100644 --- a/.config/doom/config.el +++ b/.config/doom/config.el @@ -22,8 +22,19 @@ doom-font (font-spec :family "monospace" :size 24 :weight 'semi-light) doom-variable-pitch-font (font-spec :family "sans" :size 24)) -; TODO how to treat sequencep as string? - theme toggle -;(s-chop-suffixes '("-light" "-dark") doom-theme) +(defun load-theme-string (theme) + (if (-contains? (custom-available-themes) (intern theme)) (load-theme (intern theme)))) +(defun toggle-theme (&optional suffix) + "Heuristically toggle between light and dark themes." + (interactive) + (let* ((theme (s-replace-all '(("light" . "dark") ("dark" . "light") + ("black" . "white") ("white" . "black") + ("day" . "night") ("night" . "day")) + (symbol-name doom-theme))) + (theme-base (s-replace-regexp "-[^-]*$" "" theme))) + (or (if suffix (or (load-theme-string (concat theme "-" suffix)) (load-theme-string (concat theme-base "-" suffix)))) (load-theme-string (if (and (not suffix) (equal theme (symbol-name doom-theme))) (concat theme "-light") theme)) (load-theme-string theme-base)) + ) + ) (setq display-line-numbers-type 'relative scroll-margin 6 diff --git a/.config/shell/graphical b/.config/shell/graphical index a85bb0c..06acdf4 100644 --- a/.config/shell/graphical +++ b/.config/shell/graphical @@ -40,7 +40,8 @@ test "$XDG_CURRENT_DESKTOP" = "KDE" || return 0 # Fix errors regarding broken mim database alias fixmime='sudo rm /usr/share/mime/packages/kde.xml && sudo update-mime-database /usr/share/mime' -# Switch theme across KDE system and taskwarrior +# Switch theme across system: KDE, Konsole, taskwarrior, bat +# WIP: Emacs, Mozilla, diffr (git pager) theme_save="$XDG_CACHE_HOME/theme" #theme_default="$(d=$(date +%H) && test $d -gt 7 && test $d -lt 19 && echo light || echo dark)" theme_default="dark" @@ -50,6 +51,9 @@ theme() { then kcmshell5 kcm_lookandfeel elif test "$theme" != "$THEME" -a "$2" != "q" then kcmshell5 kcm_lookandfeel & + # TODO theme diffr + bak $XDG_CONFIG_HOME/git/diffr + emacsclient -e "(toggle-theme \"$theme\")" fi export THEME="$theme" echo "$theme">"$theme_save"