diff --git a/dot_local/bin/executable_playerctl-wrapper b/dot_local/bin/executable_playerctl-wrapper new file mode 100644 index 0000000..9f87f16 --- /dev/null +++ b/dot_local/bin/executable_playerctl-wrapper @@ -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 $@