sway:dark-mode
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
sway:dark-mode [2020/10/14 16:33] – admin | sway:dark-mode [2021/01/07 23:54] (current) – admin | ||
---|---|---|---|
Line 189: | Line 189: | ||
===dark-mode=== | ===dark-mode=== | ||
- | Here is the result of all this rambling: | + | Here is the result of all this rambling: |
- | < | ||
- | # | ||
- | |||
- | # dark-mode [on|off] | ||
- | # sets dark mode on or off | ||
- | |||
- | # best to run as: | ||
- | # eval $( dark-mode on ) | ||
- | |||
- | # for emacs, these themes can be chosen from the standard ones (in | ||
- | # custom-theme-load-path) or they can be installed in | ||
- | # custom-theme-directory (usually ~/.emacs.d) | ||
- | # They must have a filename of $THEMENAME-theme.el | ||
- | |||
- | light_emacs_theme=" | ||
- | light_emacs_modeline_theme=" | ||
- | # | ||
- | dark_emacs_theme=" | ||
- | dark_emacs_modeline_theme=" | ||
- | case " | ||
- | off|stop|reset|end|light) | ||
- | # light mode | ||
- | new_emacs_theme=" | ||
- | prev_emacs_theme=" | ||
- | new_emacs_modeline_theme=" | ||
- | prev_emacs_modeline_theme=" | ||
- | |||
- | new_gtk_theme=' | ||
- | new_fg=' | ||
- | new_bg=' | ||
- | BRIGHTNESS=100 | ||
- | TERM_BACKGROUND=light | ||
- | ;; | ||
- | *) | ||
- | # dark mode | ||
- | new_emacs_theme=" | ||
- | prev_emacs_theme=" | ||
- | new_emacs_modeline_theme=" | ||
- | prev_emacs_modeline_theme=" | ||
- | |||
- | new_gtk_theme=' | ||
- | new_fg=' | ||
- | new_bg=' | ||
- | BRIGHTNESS=0 | ||
- | TERM_BACKGROUND=dark | ||
- | ;; | ||
- | esac | ||
- | |||
- | ( | ||
- | # look for an emacs running as this user: | ||
- | emacs_pid=$(pgrep -u $USER emacs | head -n 1) | ||
- | [[ " | ||
- | emacsclient --eval " | ||
- | (progn | ||
- | (disable-theme ' | ||
- | (disable-theme ' | ||
- | (load-theme ' | ||
- | (load-theme ' | ||
- | |||
- | f=~/ | ||
- | [[ -w $f ]] && | ||
- | sed -i " | ||
- | gtkreload # gtk2 only! | ||
- | |||
- | f=~/ | ||
- | [[ -w $f ]] && | ||
- | sed -i " | ||
- | # / | ||
- | |||
- | # these two appear to be comletely equivalent: | ||
- | dconf write / | ||
- | #gsettings set org.gnome.desktop.interface gtk-theme $new_gtk_theme | ||
- | |||
- | f=~/ | ||
- | [[ -w $f ]] && | ||
- | sed -i " | ||
- | |||
- | [[ " | ||
- | kitty @ set_colors --all foreground=$new_fg background=$new_bg | ||
- | |||
- | # from https:// | ||
- | brightness $BRIGHTNESS | ||
- | ) >/ | ||
- | |||
- | echo " | ||
- | </ |
sway/dark-mode.1602714839.txt.gz · Last modified: 2020/10/14 16:33 by admin