playerctl icon indicating copy to clipboard operation
playerctl copied to clipboard

Prioritize and filter players based on playback status with a flag

Open acrisci opened this issue 4 years ago • 1 comments

There have been several requests to prioritize playing players over others when using the --follow command for status lines. Currently, players with the last interactivity are prioritized. This is more suited for the playback control use case so should not be changed.

Add a --status={status[,status]} flag you could use to filter or prioritize. For instance

# only select playing players
--status=playing

# prioritize playing but don't select stopped players
--status=playing,paused

# prioritize paused players and don't change the order of other players
--status=paused,%any

Status prioritization should take precedence over player prioritization, but still should not apply to filtered out players.

Duplicates: #217, #221

acrisci avatar Jan 18 '21 19:01 acrisci

That feature would definitely be great to have in playerctld.

I'm currently using a small external script to track the currently active player. Perhaps someone finds it useful:

#!/bin/bash

trap "trap - SIGTERM; active=0" SIGINT SIGTERM EXIT
active=1

while [ $active -ne 0 ]; do
	while playerctl status -a | grep Playing -qi && ! playerctl status | grep -qi "Playing"; do
		playerctld shift;
	done

	sleep 1 &
	wait $!
done

pkill -P $$

Jacajack avatar Sep 15 '24 10:09 Jacajack