From a8516f7a5477f06de47909db6ece8e0813a431a3 Mon Sep 17 00:00:00 2001 From: cronyakatsuki Date: Sun, 19 Jun 2022 20:02:26 +0200 Subject: [PATCH] Script to choose which player to control when multiple open. --- dmenu-playerctl | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 dmenu-playerctl diff --git a/dmenu-playerctl b/dmenu-playerctl new file mode 100755 index 0000000..ce40791 --- /dev/null +++ b/dmenu-playerctl @@ -0,0 +1,16 @@ +#!/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 + +command="$@" +instances=$(playerctl -l | wc -l) + +if [ "$instances" = "0" ]; then + exit +elif [ "$instances" -lt "2" ]; then + playerctl $command +else + choice=$(playerctl -l | dmenu -p 'Manage:') + playerctl -p $choice $command +fi