dotfiles/dot_local/bin/executable_playerctl-wrapper

19 lines
399 B
Bash

#!/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 $@