aboutsummaryrefslogtreecommitdiff
path: root/river
diff options
context:
space:
mode:
authorMitchell Riedstra <mitch@riedstra.dev>2025-11-27 01:08:37 -0500
committerMitchell Riedstra <mitch@riedstra.dev>2025-11-27 01:08:37 -0500
commit488dec64b403ae4aba65cad0e46b4d2767f0b2dd (patch)
treea12d6319d4706fdfb25b5938fe76d1c2a9711482 /river
parenta9f6e9b1f1c0e4f0a628954e3427bf5020d486c0 (diff)
downloadrivercfg-488dec64b403ae4aba65cad0e46b4d2767f0b2dd.tar.gz
rivercfg-488dec64b403ae4aba65cad0e46b4d2767f0b2dd.tar.xz
Automatic light/dark mode switching. What a pain.
Diffstat (limited to 'river')
-rw-r--r--river/.gitignore1
-rwxr-xr-xriver/init38
-rwxr-xr-xriver/theme_helper43
3 files changed, 71 insertions, 11 deletions
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" <<EOF
+mode=light
+EOF
+fi
+
+. "$conf"
+
+case $mode in
+ light)
+ mode=dark
+ gnomeSet 'prefer-dark'
+ # Because GTK is an absolute disaster...
+ gsettings set org.gnome.desktop.interface gtk-theme Adwaita-dark
+ pkill -SIGUSR1 foot
+ riverctl background-color "$bgcolor_dark"
+ ;;
+ dark)
+ mode=light
+ gnomeSet 'prefer-light'
+ gsettings set org.gnome.desktop.interface gtk-theme Adwaita
+ pkill -SIGUSR2 foot
+ riverctl background-color "$bgcolor_light"
+ ;;
+esac
+
+cat > "$conf" <<EOF
+mode=$mode
+EOF
+