aboutsummaryrefslogtreecommitdiff
path: root/xmonad/scripts/playerctl-play-pause.sh
blob: a24733ae71ac9a89056207e7fde5bca3e5ec037e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/bin/sh

if [ -z "${1:-}" ]; then
	playerctl --player="$(cat ~/.cache/euandreh/mpris-player.txt)" play-pause
fi

if   [ "$(playerctl --player="$(cat ~/.cache/euandreh/mpris-player.txt)" status)" = 'Paused' ]; then
	cat ~/.cache/euandreh/mpris-player.txt >> ~/.cache/euandreh/mpris-player-xmobar.txt
elif [ "$(playerctl --player="$(cat ~/.cache/euandreh/mpris-player.txt)" status)" = 'Playing' ]; then
	printf '%s: %s\n' \
		"$(cat ~/.cache/euandreh/mpris-player.txt)" \
		"$(playerctl --player="$(cat ~/.cache/euandreh/mpris-player.txt)" metadata xesam:title)" \
		>> ~/.cache/euandreh/mpris-player-xmobar.txt
fi