User Tools

Site Tools


sway:dark-mode

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
sway:dark-mode [2020/10/13 17:49] adminsway: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 **fvwm****fluxbox****i3wm** and now **sway** I've never
 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 but should be similar for other Linux distros.
  
 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 163: Line 163:
 Thanks to redditor r/progandy for this: Thanks to redditor r/progandy for this:
  
-''**qt5ct**(1)'' is the key.+''**qt5ct**(1)'' is the key - install it (Fedora) with: 
 + 
 +<code> 
 +sudo dnf install qt5ct 
 +</code>
  
 This needs to be in the session environment: This needs to be in the session environment:
Line 185: Line 189:
 ===dark-mode=== ===dark-mode===
  
-Here is the result of all this rambling: +Here is the result of all this rambling: https://gitlab.com/wef/dotfiles/-/blob/master/bin/dark-mode
  
-<code> 
-#!/usr/bin/env bash 
- 
-# 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="dichromacy-bh" 
-light_emacs_modeline_theme="smart-mode-line-light" 
-#dark_emacs_theme="manoj-dark-bh" 
-dark_emacs_theme="dichromacy-dark-bh" 
-dark_emacs_modeline_theme="smart-mode-line-dark" 
-case "$1" in 
-    off|stop|reset|end|light) 
-        # light mode 
-        new_emacs_theme="$light_emacs_theme" 
-        prev_emacs_theme="$dark_emacs_theme" 
-        new_emacs_modeline_theme="$light_emacs_modeline_theme" 
-        prev_emacs_modeline_theme="$dark_emacs_modeline_theme" 
- 
-        new_gtk_theme='Adwaita' 
-        new_fg='black' 
-        new_bg='white' 
-        BRIGHTNESS=100 
-        TERM_BACKGROUND=light 
-        ;; 
-    *) 
-        # dark mode 
-        new_emacs_theme="$dark_emacs_theme" 
-        prev_emacs_theme="$light_emacs_theme" 
-        new_emacs_modeline_theme="$dark_emacs_modeline_theme" 
-        prev_emacs_modeline_theme="$light_emacs_modeline_theme" 
- 
-        new_gtk_theme='Adwaita-dark' 
-        new_fg='white' 
-        new_bg='black' 
-        BRIGHTNESS=0 
-        TERM_BACKGROUND=dark 
-        ;; 
-esac 
- 
-( 
-    # look for an emacs running as this user: 
-    emacs_pid=$(pgrep -u $USER emacs | head -n 1) 
-    [[ "$emacs_pid" ]] && 
-        emacsclient --eval " 
-          (progn 
-            (disable-theme '$prev_emacs_theme) 
-            (disable-theme '$prev_emacs_modeline_theme) 
-            (load-theme '$new_emacs_theme) 
-            (load-theme '$new_emacs_modeline_theme))" 
- 
-    f=~/.gtkrc-2.0 
-    [[ -w $f ]] && 
-        sed -i "s/^gtk-theme-name=.*/gtk-theme-name=\"$new_gtk_theme\"/" $f 
-    gtkreload # gtk2 only! 
- 
-    f=~/.config/gtk-3.0/settings.ini 
-    [[ -w $f ]] && 
-        sed -i "s/^gtk-theme-name=.*/gtk-theme-name=$new_gtk_theme/" $f 
-    # /usr/libexec/gsd-xsettings notifies gtk3 clients - start it in sway 
- 
-    # these two appear to be comletely equivalent: 
-    dconf write /org/gnome/desktop/interface/gtk-theme "'$new_gtk_theme'" 
-    #gsettings set org.gnome.desktop.interface gtk-theme $new_gtk_theme 
- 
-    [[ "$KITTY_WINDOW_ID" ]] && 
-        kitty @ set_colors --all foreground=$new_fg background=$new_bg 
- 
-    # from https://bbs.archlinux.org/viewtopic.php?id=134972: 
-    brightness $BRIGHTNESS 
-) >/dev/null 
- 
-echo "TERM_BACKGROUND=$TERM_BACKGROUND; setup_prompt" 
-</code> 
sway/dark-mode.1602632956.txt.gz · Last modified: 2020/10/13 17:49 by admin

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki