Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

Simple program that keeps the order of the last used players

Project description

lastplayer

Simple program that keeps track of the last used MPRIS2 players.

How?

It prints the order of the players, from most recent to last recent, on a single line on stdout any time a player appears or disappears. The most recent list of players is also written at /tmp/lastplayer.

Why?

You can use this program to control from keybinds the most recently opened multimedia player, using for example a program like playerctl.

Using the same technique, you may control another player based on the order of when it was started.

Example

Start lastplayer beforehand:

lastplayer &

Toggle the playing state of the most recent player:

#!/bin/sh

player="$(cat /tmp/lastplayer | head -n 1)"
playerctl -p $player play-pause

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for lastplayer, version 0.0.1
Filename, size File type Python version Upload date Hashes
Filename, size lastplayer-0.0.1-py3-none-any.whl (2.6 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size lastplayer-0.0.1.tar.gz (2.2 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page