Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: set order of players #143

Closed
cphyc opened this issue Jun 27, 2019 · 5 comments
Closed

Feature Request: set order of players #143

cphyc opened this issue Jun 27, 2019 · 5 comments

Comments

@cphyc
Copy link

cphyc commented Jun 27, 2019

Hi,
Thank you very much for the amazing tool!

It would be great to have an option on the cli to set the order in which players should be considered. One way to do so would be to add a flag when listing the players. For example

playerctl -p spotify,ANY next

would trigger the next action on spotify (if found). Otherwise, it tries with any other player.
Internally, I guess this could be done by sorting and then push the selected players to the top of the list in the order they appear in the CLI.

@acrisci
Copy link
Member

acrisci commented Jun 27, 2019

We could generalize and implement a wildcard character. The obvious choice is *, but since that's a shell character, maybe sql style with %.

playerctl -p spotify,% next
# select a player that begins with "s"
playerctl -p s% next

@cphyc
Copy link
Author

cphyc commented Jun 27, 2019

That would do the trick. As for *, it is also possible to pass it if it is escaped, something like

playerctl -p 'spotify,*'

@crobe87
Copy link

crobe87 commented Aug 14, 2019

I agree on this issue. Chrome is a PITA these days, as there's a video in nearly every web pages... after a recent update the browser is always in front of my media players. I would like to give priority back to my media players.

@Gleek
Copy link

Gleek commented Oct 17, 2019

For somebody stumbling here I have a small script that does it for me.

  • Create a file defining priority ($HOME/.player-priority) with the following example content:
spotify
vlc
DeaDBeeF
mpv
mpd

The higher players in the list have higher priority. Any players not in the list will have a lower priority than every player in the file.
Get the names from playerctl -l

  • Create a file pplayerctl in you PATH such as /usr/local/bin with the following contents
#!/usr/bin/env bash
playerctl --player=$((cat ~/.player-priority 2>/dev/null; echo; playerctl -l)|awk '!x[$0]++'|paste -sd,) $*
  • Use pplayerctl play-pause to play-pause the player with highest priority. You can change the priority anytime by re-ordering the contents of your $HOME/.player-priority file

Anyways, this wouldn't be required once the feature is implemented as suggested in the comments above.

@acrisci
Copy link
Member

acrisci commented Jan 11, 2020

If you're interested in better player selection, please join the discussion at #161.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants