folixg / Pause On Lock
Programming Languages
Projects that are alternatives of or similar to Pause On Lock
pause-on-lock
Automatically pause your music player when the screen gets locked and resume playback, once the screen is unlocked again.
Supported desktop environments
Currently Unity,
Cinnamon,
GNOME, MATE,
KDE, POP!_OS and
XFCE are supported. The currently running desktop is
detected using $XDG_CURRENT_DESKTOP
.
Installation
Download the executable for the latest release and run
sudo install pause-on-lock /usr/local/bin/
If you don't have sudo rights or don't want a system-wide installation, change
the install destination directory to e.g. $HOME/bin
(and make sure that that
folder is in your $PATH
).
Usage
Rhythmbox and Spotify
By default pause-on-lock supports
Rhythmbox and
Spotify. If you use no other
players, no further configuration is needed, you can simply run
pause-on-lock
.
User defined player
With the --player
or -p
flag you can provide the name of one additional
player that pause-on-lock will then handle. The player needs to provide a
MPRIS D-Bus
interface (which is the case for most common media players) and the name you
provide needs to match the name used for the D-Bus interface. For example
vlc provides a D-Bus interface at
org.mpris.MediaPlayer2.vlc
so all you need to do is call pause-on-lock -p vlc
and pause-on-lock will pause any running vlc instance when you lock your
screen.
tl;dr pause-on-lock --player NAME
should work in most cases.
Playerctl
If you want support for many different players and you have
playerctl installed, you can use the
--playerctl
or -c
flag to enable playerctl support in pause-on-lock. Then
all players that playerctl can handle are supported, without the need for
further configuration.
Autostart
I strongly recommend to add the pause-on-lock executable to Startup Applications (or the equivalent for your desktop environment), so it is run every time you log in.