2021-12-31 15:47:35 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
ARG=$1
|
|
|
|
if [[ $ARG == '' ]]; then
|
2023-01-06 19:41:31 +00:00
|
|
|
ARG="toggle"
|
2021-12-31 15:47:35 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ $ARG == 'toggle' ]]; then
|
2024-03-08 19:11:04 +00:00
|
|
|
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
|
2024-03-08 19:11:04 +00:00
|
|
|
touch '/home/jpm/.local/state/.waybar_hidden';
|
2023-01-06 19:41:31 +00:00
|
|
|
fi
|
2021-12-31 15:47:35 +00:00
|
|
|
elif [[ $ARG == 'hide' ]]; then
|
2024-03-08 19:11:04 +00:00
|
|
|
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
|
2021-12-31 15:47:35 +00:00
|
|
|
elif [[ $ARG == 'show' ]]; then
|
2024-03-08 19:11:04 +00:00
|
|
|
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
|
2021-12-31 15:47:35 +00:00
|
|
|
elif [[ $ARG != 'invert' ]]; then
|
2023-01-06 19:41:31 +00:00
|
|
|
echo "Invalid argument";
|
2021-12-31 15:47:35 +00:00
|
|
|
fi
|
|
|
|
|
2024-03-08 19:11:04 +00:00
|
|
|
BARS=$(pgrep waybar | cut -d ' ' -f 1)
|
|
|
|
kill -s SIGUSR1 $BARS
|