2023-02-22 19:24:09 +01:00
|
|
|
#!/bin/sh
|
2022-06-19 20:02:26 +02:00
|
|
|
|
|
|
|
# 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
|
|
|
|
|
2022-11-04 14:54:08 +01:00
|
|
|
load_config () {
|
2023-02-22 19:24:09 +01:00
|
|
|
. $HOME/.config/dmenu/config
|
|
|
|
}
|
|
|
|
|
|
|
|
menu () {
|
|
|
|
choice=$(playerctl -l | $DMENU -p 'Manage:')
|
|
|
|
[ -z "$choice" ] && exit
|
|
|
|
playerctl -p $choice $1
|
2022-11-04 14:54:08 +01:00
|
|
|
}
|
2022-07-17 11:03:13 +02:00
|
|
|
|
2022-11-04 14:54:08 +01:00
|
|
|
main () {
|
|
|
|
load_config
|
2022-06-19 20:02:26 +02:00
|
|
|
|
2022-11-04 14:54:08 +01:00
|
|
|
command="$@"
|
|
|
|
[ -z "$command" ] && exit
|
|
|
|
instances=$(playerctl -l | wc -l)
|
2022-08-01 17:51:43 +02:00
|
|
|
|
2023-02-22 19:24:09 +01:00
|
|
|
[ "$instances" = "0" ] && exit
|
|
|
|
|
|
|
|
[ "$instances" -lt "2" ] && playerctl $command || menu $command
|
2022-11-04 14:54:08 +01:00
|
|
|
}
|
2022-08-01 17:51:43 +02:00
|
|
|
|
2022-11-04 14:54:08 +01:00
|
|
|
main $@
|