From 488dec64b403ae4aba65cad0e46b4d2767f0b2dd Mon Sep 17 00:00:00 2001 From: Mitchell Riedstra Date: Thu, 27 Nov 2025 01:08:37 -0500 Subject: Automatic light/dark mode switching. What a pain. --- arch.sh | 3 ++ btop/btop.conf | 4 +-- foot/foot.ini | 22 +++++++++++++++ river/.gitignore | 1 + river/init | 38 +++++++++++++++++-------- river/theme_helper | 43 +++++++++++++++++++++++++++++ waybar/base.css | 73 ++++++++++++++++++++++++++++++++++++++++++++++++ waybar/config | 5 ---- waybar/custom/network | 2 +- waybar/style-dark.css | 20 ++++++++++++++ waybar/style-light.css | 20 ++++++++++++++ waybar/style.css | 75 -------------------------------------------------- waybar/theme.css | 18 ++++++++++++ waylandrc | 7 ++++- 14 files changed, 236 insertions(+), 95 deletions(-) create mode 100755 river/theme_helper create mode 100644 waybar/base.css create mode 100644 waybar/style-dark.css create mode 100644 waybar/style-light.css delete mode 100644 waybar/style.css create mode 100644 waybar/theme.css diff --git a/arch.sh b/arch.sh index 4adfacb..1d0cf9e 100755 --- a/arch.sh +++ b/arch.sh @@ -1,6 +1,7 @@ #!/bin/sh set -ex ./bldSession.sh +# GTK portal is for dark mode switching sudo pacman -S \ river \ foot \ @@ -15,4 +16,6 @@ sudo pacman -S \ slurp \ grim \ xdg-desktop-portal-wlr \ + xdg-desktop-portal-gtk \ + diff --git a/btop/btop.conf b/btop/btop.conf index d7e16e5..0c9bd91 100644 --- a/btop/btop.conf +++ b/btop/btop.conf @@ -2,10 +2,10 @@ #* Name of a btop++/bpytop/bashtop formatted ".theme" file, "Default" and "TTY" for builtin themes. #* Themes should be placed in "../share/btop/themes" relative to binary or "$HOME/.config/btop/themes" -color_theme = "/usr/share/btop/themes/gruvbox_dark_v2.theme" +color_theme = "TTY" #* If the theme set background should be shown, set to False if you want terminal background transparency. -theme_background = False +theme_background = True #* Sets if 24-bit truecolor should be used, will convert 24-bit colors to 256 color (6x6x6 color cube) if false. truecolor = True diff --git a/foot/foot.ini b/foot/foot.ini index 36d943d..e37bc7b 100644 --- a/foot/foot.ini +++ b/foot/foot.ini @@ -80,6 +80,28 @@ bright5=d3869b bright6=8ec07c bright7=ebdbb2 +# Gruvbox light +# -SIGUSR2 +[colors2] +background=fbf1c7 +foreground=3c3836 +regular0=fbf1c7 +regular1=cc241d +regular2=98971a +regular3=d79921 +regular4=458588 +regular5=b16286 +regular6=689d6a +regular7=7c6f64 +bright0=928374 +bright1=9d0006 +bright2=79740e +bright3=b57614 +bright4=076678 +bright5=8f3f71 +bright6=427b58 +bright7=3c3836 + # Nord # [colors] # cursor = 282C34 d8dee9 diff --git a/river/.gitignore b/river/.gitignore index 6275a75..f211f8c 100644 --- a/river/.gitignore +++ b/river/.gitignore @@ -1 +1,2 @@ padding_conf +theme_conf diff --git a/river/init b/river/init index 9bdd360..848403e 100755 --- a/river/init +++ b/river/init @@ -1,5 +1,6 @@ #!/bin/sh +XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}" # This is the example configuration file for river. # # If you wish to edit this, you will probably want to copy it to @@ -13,8 +14,12 @@ # Super+Shift+Return to start an instance of foot (https://codeberg.org/dnkl/foot) # riverctl map normal Super+Shift Return spawn foot # riverctl map normal Super Return spawn alacritty -riverctl map normal Super Return spawn foot -riverctl map normal Super+Shift Return spawn 'foot -c "$HOME/.config/foot/light.ini"' +# riverctl map normal Super Return spawn foot + +foot --server & +riverctl map normal Super Return spawn footclient +riverctl map normal Super M spawn "${XDG_CONFIG_HOME}"/river/theme_helper +riverctl map normal Super+Shift b spawn footclient btop # Super+Q to close the focused view riverctl map normal Super+Shift Q close @@ -172,11 +177,11 @@ riverctl rule-add -app-id "bar" csd riverctl default-layout rivertile rivertile -view-padding 10 -outer-padding 0 & -riverctl map normal Super Equal spawn "$HOME/.config/river/padding_helper 0 25" -riverctl map normal Super Minus spawn "$HOME/.config/river/padding_helper 0 -25" +riverctl map normal Super Equal spawn "${XDG_CONFIG_HOME}/river/padding_helper 0 25" +riverctl map normal Super Minus spawn "${XDG_CONFIG_HOME}/river/padding_helper 0 -25" -riverctl map normal Super+Shift Equal spawn "$HOME/.config/river/padding_helper 10 0" -riverctl map normal Super+Shift Minus spawn "$HOME/.config/river/padding_helper -10 0" +riverctl map normal Super+Shift Equal spawn "${XDG_CONFIG_HOME}/river/padding_helper 10 0" +riverctl map normal Super+Shift Minus spawn "${XDG_CONFIG_HOME}/river/padding_helper -10 0" riverctl map normal Super+Control L spawn swaylock riverctl map normal Super D spawn bemenu-run @@ -203,15 +208,23 @@ if ! pgrep waybar >/dev/null 2>&1 ; then waybar & fi -"$HOME"/.config/river/pointer +"${XDG_CONFIG_HOME}"/river/pointer if ! pgrep swaybg >/dev/null 2>&1 ; then - swaybg -i .wallpaper.jpg & + echo "" + # swaybg -i .wallpaper.jpg & fi # If Chromium dialogs aren't working these are suspect dbus-update-activation-environment --systemd WAYLAND_DISPLAY "XDG_CURRENT_DESKTOP=$XDG_CURRENT_DESKTOP" systemctl --user restart xdg-desktop-portal +# I hate calling this directly but the systemd unit is bugged on arch at +# least, running it by hand appears to work just fine +_gtk_portal=/usr/lib/xdg-desktop-portal-gtk +if [ -x "$_gtk_portal" ] ; then + "$_gtk_portal" & +fi + riverctl rule-add -title '*Firefox*' ssd riverctl rule-add -app-id '*chromium*' ssd riverctl rule-add -title '*paypal*' float @@ -224,6 +237,9 @@ riverctl rule-add -app-id "*evolution*" tags $((1 << (8 - 1))) riverctl rule-add -app-id "*pavu*" ssd riverctl rule-add -app-id "*blueman*" ssd -. ~/.kshrc -checkSSHAgent -k -checkSSHAgent +if [ -e ~/.kshrc ] ; then + . ~/.kshrc + checkSSHAgent -k + checkSSHAgent +fi + diff --git a/river/theme_helper b/river/theme_helper new file mode 100755 index 0000000..398910d --- /dev/null +++ b/river/theme_helper @@ -0,0 +1,43 @@ +#!/bin/sh +set -ex +exec >/tmp/theme.log 2>&1 +XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}" +conf="$XDG_CONFIG_HOME/river/theme_conf" + +gnomeSet() { + gsettings set org.gnome.desktop.interface color-scheme "$1" +} + +bgcolor_dark=0x282828 +bgcolor_light=0xfbf1c7 + +if ! [ -e "$conf" ] ; then +cat > "$conf" < "$conf" <