sway:dark-mode
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
sway:dark-mode [2020/10/14 16:32] – admin | sway:dark-mode [2021/01/07 23:54] (current) – admin | ||
---|---|---|---|
Line 3: | Line 3: | ||
Unlike Desktop Environments like Gnome and KDE, Window Managers like | Unlike Desktop Environments like Gnome and KDE, Window Managers like | ||
- | sway do not come with all the tools you might need or want. It's up to | + | **sway** do not come with all the tools you might need or want. It's up to |
the user to perceive a need, do the research and then install, | the user to perceive a need, do the research and then install, | ||
configure and use the appropriate tools for the job. Notwithstanding | configure and use the appropriate tools for the job. Notwithstanding | ||
Line 29: | Line 29: | ||
customising and a script that I use to do the flick. | customising and a script that I use to do the flick. | ||
- | All of this is on Fedora-31. | + | All of this is on Fedora-31 |
Apologies if this is all obvious and well documented elsewhere. It was a journey for me and non-trivial. | Apologies if this is all obvious and well documented elsewhere. It was a journey for me and non-trivial. | ||
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.txt · Last modified: 2021/01/07 23:54 by admin