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/12 19:38] – 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 11: | Line 11: | ||
satisfaction of knowing what's going on. | satisfaction of knowing what's going on. | ||
- | In my own history through fvwm, fluxbox, i3wm and now sway I've never | + | In my own history through |
really wanted to bother with themes. I just made terminals and emacs | really wanted to bother with themes. I just made terminals and emacs | ||
have a black background and other programs could do what ever they | have a black background and other programs could do what ever they | ||
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 86: | Line 86: | ||
I just wonder if this could be replaced by a simple script like the | I just wonder if this could be replaced by a simple script like the | ||
- | GK2 one? | + | GTK2 one? |
But that appears to be not the entire story. | But that appears to be not the entire story. | ||
Line 115: | Line 115: | ||
===emacs=== | ===emacs=== | ||
- | '' | + | '' |
wean myself off it. There are ' | wean myself off it. There are ' | ||
experiments but they are yet to hit the Fedora repositories outside | experiments but they are yet to hit the Fedora repositories outside | ||
Line 121: | Line 121: | ||
GTK signals. | GTK signals. | ||
- | In any case, for '' | + | In any case, for '' |
- | and '' | + | and '' |
couple of good themes and added some code to my script to flip from | couple of good themes and added some code to my script to flip from | ||
one theme to another. The script should be self explanatory. The | one theme to another. The script should be self explanatory. The | ||
Line 161: | Line 161: | ||
KDE/ | KDE/ | ||
- | Here be dragons. I have NO IDEA how to script | + | Thanks |
- | script a theme change, please let me know! | + | |
- | ===dark-mode=== | + | '' |
- | + | ||
- | Here is the result of all this rambling: | + | |
< | < | ||
- | #!/usr/bin/env bash | + | sudo dnf install qt5ct |
+ | </code> | ||
- | # dark-mode [on|off] | + | This needs to be in the session environment: |
- | # sets dark mode on or off | + | |
- | # best to run as: | + | < |
- | # eval $( dark-mode on ) | + | export QT_QPA_PLATFORMTHEME=qt5ct |
+ | </ | ||
- | # for emacs, these themes can be chosen from the standard ones (in | + | After running '' |
- | # custom-theme-load-path) or they can be installed in | + | |
- | # custom-theme-directory (usually | + | |
- | # They must have a filename of $THEMENAME-theme.el | + | |
- | light_emacs_theme=" | + | < |
- | light_emacs_modeline_theme=" | + | style=Adwaita |
- | # | + | </ |
- | 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=' | + | ... I can hit that with my script and the qt5 programs automatically change their appearance! |
- | 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='Adwaita-dark' | + | Oddly, there's a 4s delay after changing the style in the file before the new style takes effect. But that's OK. |
- | new_fg=' | + | |
- | new_bg=' | + | |
- | BRIGHTNESS=0 | + | |
- | TERM_BACKGROUND=dark | + | |
- | ;; | + | |
- | esac | + | |
- | ( | + | I also built [[https:// |
- | # look for an emacs running as this user: | + | |
- | emacs_pid=$(pgrep | + | |
- | [[ " | + | |
- | emacsclient --eval " | + | |
- | (progn | + | |
- | (disable-theme | + | |
- | (disable-theme ' | + | |
- | (load-theme ' | + | |
- | (load-theme ' | + | |
- | f=~/.gtkrc-2.0 | + | ===dark-mode=== |
- | [[ -w $f ]] && | + | |
- | sed -i " | + | |
- | gtkreload # gtk2 only! | + | |
- | f=~/.config/gtk-3.0/settings.ini | + | Here is the result of all this rambling: https://gitlab.com/wef/dotfiles/-/blob/master/bin/dark-mode |
- | [[ -w $f ]] && | + | |
- | sed -i "s/^gtk-theme-name=.*/gtk-theme-name=$new_gtk_theme/" $f | + | |
- | # /usr/libexec/gsd-xsettings notifies gtk3 clients | + | |
- | # these two appear to be comletely equivalent: | ||
- | dconf write / | ||
- | #gsettings set org.gnome.desktop.interface gtk-theme $new_gtk_theme | ||
- | |||
- | [[ " | ||
- | kitty @ set_colors --all foreground=$new_fg background=$new_bg | ||
- | |||
- | brightness $BRIGHTNESS | ||
- | ) >/ | ||
- | |||
- | echo " | ||
- | </ |
sway/dark-mode.1602553113.txt.gz · Last modified: 2020/10/12 19:38 by admin