Add playerctl-wrapper

This commit is contained in:
Pavle Portic 2022-03-16 16:32:02 +01:00
parent e1f315c1eb
commit 0a7e725950
Signed by: TheEdgeOfRage
GPG Key ID: 66AD4BA646FBC0D2
1 changed files with 18 additions and 0 deletions

View File

@ -0,0 +1,18 @@
#!/bin/bash
#
# playerctl wrapper that controls the currently playing player
handler() {
players=$(playerctl -l)
for player in $players; do
player_status=$(playerctl -p $player status)
if [ $player_status == 'Playing' ]; then
playerctl -p $player $@
echo -n $player > /tmp/last_player
return
fi
done
last_player=$(cat /tmp/last_player)
playerctl -p $last_player $@
}
handler $@