- Notifications
You must be signed in to change notification settings - Fork16
Pause/Resume your music player when locking/unlocking your Linux desktop.
License
folixg/pause-on-lock
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Notice: I did a rewrite in python which can handle more players (probably yourfavorite among them) by default and is also able to handle multiple playersrunning at the same time (like if you're watching a video in your browser andlistening to music on your spotify or whatever you do). It's still an earlyrelease and I'd be happy if you gave it a try and let me know if somethingdoesn't work for you.
You can visit thegithub pageor just install viapip install pauseonlock
Automatically pause your music player when the screen gets locked and resumeplayback, once the screen is unlocked again.
CurrentlyUnity,Cinnamon,GNOME,MATE,KDE,POP!_OS andXFCE are supported. The currently running desktop isdetected using$XDG_CURRENT_DESKTOP
.
Download the executable for thelatestreleaseand run
sudo install pause-on-lock /usr/local/bin/
If you don't have sudo rights or don't want a system-wide installation, changethe install destination directory to e.g.$HOME/bin
(and make sure that thatfolder is in your$PATH
).
By default pause-on-lock supportsRhythmbox andSpotify. If you use no otherplayers, no further configuration is needed, you can simply runpause-on-lock
.
With the--player
or-p
flag you can provide the name of one additionalplayer that pause-on-lock will then handle. The player needs to provide aMPRIS D-Businterface (which is the case for most common media players) and the name youprovide needs to match the name used for the D-Bus interface. For examplevlc provides a D-Bus interface atorg.mpris.MediaPlayer2.vlc
so all you need to do is callpause-on-lock -p vlc
and pause-on-lock will pause any running vlc instance when you lock yourscreen.
tl;drpause-on-lock --player NAME
should work in most cases.
If you want support for many different players and you haveplayerctl installed, you can use the--playerctl
or-c
flag to enable playerctl support in pause-on-lock. Thenall players that playerctl can handle are supported, without the need forfurther configuration.
I strongly recommend to add the pause-on-lock executable toStartupApplications(or the equivalent for your desktop environment), so it is run every time youlog in.
About
Pause/Resume your music player when locking/unlocking your Linux desktop.