Post #558319
2026-03-06 19:04 UTC
Replies (4)
-
@felsiq@piefed.zip 2026-03-07 02:27
If you don’t want a playerctl dependency you can use a dbus library to check for mpris players manually, though it’s a little less readable
-
@Maxy@lemmy.blahaj.zone 2026-03-07 06:58
That depends on your distro. On Debian/ubuntu(-based) distro’s, you can try apt list --installed playerctl, which will output nothing if the package isn’t yet installed, or the package name with version info if it is installed. To install it, run sudo apt install playerctl On arch(-based) distro’s, you can try pacman -Qi playerctl, which should return an error if there is no such package installed, or several lines of info if it is installed. To install it, run sudo pacman -S playerctl, ideally after running a full system upgrade with sudo pacman -Syu
-
@WronglyCommute@programming.dev 2026-03-07 08:44
You could always run whereis playerctl and parse the output with awk or sed
-
@floquant@lemmy.dbzer0.com 2026-03-07 11:27
You can test if a command exists in several ways, but the most portable one should be using command -v which is POSIX. if command -v playerctl &> /dev/null # do things else # warn and exit end