better structure

This commit is contained in:
2025-10-19 00:14:19 +02:00
parent 057afc086e
commit 8733656ed9
630 changed files with 81 additions and 137 deletions

43
scripts/waybar-toggle Executable file
View File

@@ -0,0 +1,43 @@
#!/usr/bin/env bash
lyrics_widget_closed=0
function close() {
killall -q waybar
# Also close the lyrics widget if open
if eww active-windows | grep -q "lyrics-single"; then
eww close lyrics-single
lyrics_widget_closed=1
fi
}
function open() {
# the system tray will not work with kded6 started
if killall -q -9 "kded6"; then
while pgrep -u "$USER" -x "kded6" >/dev/null; do
sleep 0.2
done
fi
nohup waybar >/dev/null 2>/dev/null &
# Reopen the lyrics widget if it was previously closed
if [ $lyrics_widget_closed -eq 1 ]; then
eww open lyrics-single
fi
}
if [ "$1" = "restart" ]; then
close
while pgrep -u "$USER" -x "waybar" >/dev/null; do
sleep 0.2
done
open
elif pgrep -u "$USER" -x "waybar" >/dev/null; then
close
elif ! pgrep -u "$USER" -x "waybar" >/dev/null; then
open
else
echo "Usage: $0 [restart]"
exit 1
fi