Generic update.
This commit is contained in:
parent
15ecb794d7
commit
1c0a265455
5 changed files with 84 additions and 21 deletions
|
@ -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 $@
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue