Parent directory

executable_playerctl-wrapper

399 bytes
 1#!/bin/bash
 2#
 3# playerctl wrapper that controls the currently playing player
 4handler() {
 5	players=$(playerctl -l)
 6	for player in $players; do
 7		player_status=$(playerctl -p $player status)
 8		if [ $player_status == 'Playing' ]; then
 9			playerctl -p $player $@
10			echo -n $player > /tmp/last_player
11			return
12		fi
13	done
14	last_player=$(cat /tmp/last_player)
15	playerctl -p $last_player $@
16}
17
18handler $@