Files
dotfiles/.scripts/waybar-toggle.sh
2025-06-22 11:57:35 +02:00

32 lines
566 B
Bash
Executable File

#!/bin/env bash
function close() {
if pgrep -x "waybar" > /dev/null; then
killall -q waybar
# Wait until the processes have been shut down
while pgrep -x waybar >/dev/null; do sleep 1; done
fi
}
function open() {
waybar &
}
if [ -z "$1" ]; then
close
open
elif [ "$1" = "close" ]; then
if ! pgrep -x "waybar" > /dev/null; then
exit 1
fi
close
elif [ "$1" = "open" ]; then
if pgrep -x "waybar" > /dev/null; then
exit 1
fi
open
else
echo "Usage: $0 [close|open]"
exit 1
fi