commit 515a9e1cef815acffc168c9591d7ebe6cf86590a
parent 8a7053cc581b8c867936e595189ce9191f765a1f
Author: JayVii <jayvii[AT]posteo[DOT]de>
Date: Sun, 21 Dec 2025 11:13:19 +0100
fix: set env variables right at the beginning
Diffstat:
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/gnome-switch-theme.sh b/gnome-switch-theme.sh
@@ -3,6 +3,9 @@
# exit on error
set -eo pipefail
+export XDG_RUNTIME_DIR="/run/user/$(id -u)"
+export DBUS_SESSION_BUS_ADDRESS="unix:path=${XDG_RUNTIME_DIR}/bus"
+
# check whether input was given
if [ -z $1 ]; then
# get current GTK theme
@@ -11,9 +14,6 @@ else
target="$1"
fi
-export XDG_RUNTIME_DIR="/run/user/$(id -u)"
-export DBUS_SESSION_BUS_ADDRESS="unix:path=${XDG_RUNTIME_DIR}/bus"
-
# If we want a dark theme, but the current theme is not, switch theme to dark
if [[ "$target" == "'prefer-light'" ]] || [[ "$target" == "dark" ]]; then
gsettings set org.gnome.desktop.interface color-scheme "prefer-dark"