added slock support.
This commit is contained in:
parent
436a2b9505
commit
98b8616151
@ -6,13 +6,35 @@
|
||||
source $HOME/.config/dmenu/config
|
||||
|
||||
command="$@"
|
||||
[ -z "$command" ] && exit
|
||||
instances=$(playerctl -l | wc -l)
|
||||
|
||||
slock=$(ps -C slock | sed -n '1!p' | awk '{ print $4 }' | sed 's/slock/running/')
|
||||
|
||||
if [ "$instances" = "0" ]; then
|
||||
exit
|
||||
elif [ "$instances" -lt "2" ]; then
|
||||
playerctl $command
|
||||
elif [ "$slock" == "running" ]; then
|
||||
if [ "$command" == "play-pause" ]; then
|
||||
if playerctl status -a | grep -i "Playing" > /dev/null; then
|
||||
playerctl pause -a
|
||||
else
|
||||
playerctl -p mpd $command
|
||||
fi
|
||||
exit
|
||||
fi
|
||||
|
||||
players=$(paste <(playerctl -l) <(playerctl status -a) | grep -v -i mpd | awk '{print $1}')
|
||||
if [ ! -z "$players" ]; then
|
||||
for player in $players; do
|
||||
playerctl -p $player pause
|
||||
done
|
||||
fi
|
||||
|
||||
playerctl -p mpd $command
|
||||
else
|
||||
choice=$(playerctl -l | $DMENU -p 'Manage:')
|
||||
[ -z "$choice" ] && exit
|
||||
playerctl -p $choice $command
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user