diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2024-09-14 13:46:20 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2024-09-14 13:46:20 +0800 |
| commit | a0ec345229e272af847b7c12213dab5f6829dfab (patch) | |
| tree | fd5dc06afcf7629b3acff3efb03df609f6e62f6c /hypridle.sh | |
| parent | a1fa306592b4733130367749f033b8eb5f479b1d (diff) | |
added oneline for pipe(remember to redirect stderr -> stdout) and updates
Diffstat (limited to 'hypridle.sh')
| -rwxr-xr-x | hypridle.sh | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/hypridle.sh b/hypridle.sh index f5384c3..d42d4f5 100755 --- a/hypridle.sh +++ b/hypridle.sh @@ -2,6 +2,8 @@ renice -n 19 $$ +XDG_CACHE_HOME=${XDG_CACHE_HOME:-$HOME/.cache} + # arguments with signal trap #trap idle SIGQUIT #trap stopidle SIGILL @@ -29,12 +31,14 @@ function idle() { if [ $pmusic ]; then if [[ $(playerctl status -p spotify) == "Playing" ]]; then - m=true + echo true > $XDG_CACHE_HOME/playing-music fi fi if [ $pmusic ]; then playerctl --all-players pause fi + brillio -O + brillio -S 0 } function stopidle() { @@ -55,10 +59,12 @@ function stopidle() { notify-send -u critical "Unable to get volume(sound) status: $(pactl get-sink-mute @DEFAULT_SINK@)" & fi /sbin/killall update.sh yay & - if [ $pmusic ] && [ "$m" ]; then + if [ $pmusic ] && [ -f $XDG_CACHE_HOME/playing-music ]; then playerctl play -p spotify unset m fi + rm -f $XDG_CACHE_HOME/playing-music + brillio -I } if [ "$1" ]; then |
