scripts/waybar/toggle.sh

34 lines
956 B
Bash
Raw Normal View History

#!/bin/bash
ARG=$1
if [[ $ARG == '' ]]; then
2023-01-06 19:41:31 +00:00
ARG="toggle"
fi
if [[ $ARG == 'toggle' ]]; then
if [[ -e '/home/jpm/.local/state/.waybar_hidden' ]]; then
rm '/home/jpm/.local/state/.waybar_hidden';
2023-01-06 19:41:31 +00:00
else
touch '/home/jpm/.local/state/.waybar_hidden';
2023-01-06 19:41:31 +00:00
fi
elif [[ $ARG == 'hide' ]]; then
if [[ ! -e '/home/jpm/.local/state/.waybar_hidden' ]]; then
touch '/home/jpm/.local/state/.waybar_hidden';
2023-01-06 19:41:31 +00:00
else
echo 'Already hidden. You may need to use the "invert" option if action is reversed';
exit;
fi
elif [[ $ARG == 'show' ]]; then
if [[ -e '/home/jpm/.local/state/.waybar_hidden' ]]; then
rm '/home/jpm/.local/state/.waybar_hidden';
2023-01-06 19:41:31 +00:00
else
echo 'Already shown. You may need to use the "invert" option if action is reversed';
exit;
fi
elif [[ $ARG != 'invert' ]]; then
2023-01-06 19:41:31 +00:00
echo "Invalid argument";
fi
BARS=$(pgrep waybar | cut -d ' ' -f 1)
kill -s SIGUSR1 $BARS