aboutsummaryrefslogtreecommitdiffstats
path: root/config/hypr/scripts/WaybarStyles.sh
diff options
context:
space:
mode:
authorJaKooLit <jimmielovejay@gmail.com>2023-11-12 13:51:03 +0900
committerJaKooLit <jimmielovejay@gmail.com>2023-11-12 13:51:03 +0900
commitb3a7ac2b3f99f5a2ffb6574b5f2b4c80b15f63c3 (patch)
tree07ed057fd4fb222aa0a4b68d7068e4a4ebe87cdb /config/hypr/scripts/WaybarStyles.sh
parent022fa1b4f26d347bf976757f000af88521c49da1 (diff)
code clean up, no action if no wallpaper selected
Diffstat (limited to 'config/hypr/scripts/WaybarStyles.sh')
-rwxr-xr-xconfig/hypr/scripts/WaybarStyles.sh40
1 files changed, 22 insertions, 18 deletions
diff --git a/config/hypr/scripts/WaybarStyles.sh b/config/hypr/scripts/WaybarStyles.sh
index 0e714627..5051fa35 100755
--- a/config/hypr/scripts/WaybarStyles.sh
+++ b/config/hypr/scripts/WaybarStyles.sh
@@ -5,26 +5,32 @@ THEMEIS=$(realpath ~/.config/waybar/style.css | sed 's/.*-\(.*\)\.css/\1/')
# Array for the styles
STYLES=(
-"pywal"
-"dark"
-"light"
-"Black-&-White"
+"pywal"
+"dark"
+"light"
+"Black-&-White"
"colors"
-"colors-border"
-"colors-line"
-"colorful"
-"catppuccin-mocha"
-"catppuccin-latte"
- )
+"colors-border"
+"colors-line"
+"colorful"
+"catppuccin-mocha"
+"catppuccin-latte"
+)
# Build ROFI
SELECTED_STYLE=$(printf "%s\n" "${STYLES[@]}" | rofi -dmenu -config ~/.config/rofi/config-waybar.rasi "${#STYLES[@]}")
-# Here you verify the selected theme
+# Check if rofi is already running
+if pidof rofi > /dev/null; then
+ pkill rofi
+ exit 0
+fi
+
+# Verify the selected theme
if [[ " ${STYLES[@]} " =~ " $SELECTED_STYLE " ]]; then
SWITCHTO="${SELECTED_STYLE}"
else
- echo "It is not valid =c"
+ echo "Invalid selection"
exit 1
fi
@@ -32,17 +38,15 @@ fi
THEMEFILE="$HOME/.config/waybar/style/style-${SWITCHTO}.css"
if [ -f "$THEMEFILE" ]; then
ln -sf "$THEMEFILE" "$HOME/.config/waybar/style.css"
-
-
else
echo "Error: $THEMEFILE not found"
exit 1
fi
-_ps=(waybar mako dunst)
-for _prs in "${_ps[@]}"; do
- if [[ $(pidof ${_prs}) ]]; then
- pkill ${_prs}
+# Restart relevant processes
+for process in waybar mako dunst; do
+ if pidof "$process" > /dev/null; then
+ pkill "$process"
fi
done
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage