Generic update.

This commit is contained in:
Crony Akatsuki 2023-02-22 19:24:09 +01:00
parent 15ecb794d7
commit 1c0a265455
5 changed files with 84 additions and 21 deletions

View file

@ -1,10 +1,16 @@
#!/bin/env bash
#!/bin/sh
# script to run a menu prompt when having more than 2 players since
# playerctl is bad at managing more than one player at the same time
load_config () {
source $HOME/.config/dmenu/config
. $HOME/.config/dmenu/config
}
menu () {
choice=$(playerctl -l | $DMENU -p 'Manage:')
[ -z "$choice" ] && exit
playerctl -p $choice $1
}
main () {
@ -14,15 +20,9 @@ main () {
[ -z "$command" ] && exit
instances=$(playerctl -l | wc -l)
if [ "$instances" = "0" ]; then
exit
elif [ "$instances" -lt "2" ]; then
playerctl $command
else
choice=$(playerctl -l | $DMENU -p 'Manage:')
[ -z "$choice" ] && exit
playerctl -p $choice $command
fi
[ "$instances" = "0" ] && exit
[ "$instances" -lt "2" ] && playerctl $command || menu $command
}
main $@