Pause Music When Locking The Screen And Resume On Unlock For Spotify, Rhythmbox, Others

Ubuntu 18.04 Lock Screen

When you lock your computer screen (without suspending the system), most desktop audio players continue playback in the background, sometimes not emitting any sound ¹. Due to this you may unintentionally skip parts of podcasts or songs in a playlist, etc.

Enter pause-on-lock, a Bash script that pauses your music player when you lock the screen and resumes playback once the screen is unlocked.

pause-on-lock works on Unity, GNOME, Cinnamon, KDE Plasma and MATE desktop environments, and by default it supports Spotify and Rhythmbox. With the help of playerctl (a command line controller for controlling media players that support the MPRIS D-Bus interface), this script can extend its supported music players to many others, including Audacious, VLC, Cmus, and others.

0 Comments