Pause on Lock is a simple script that can pause music on Ubuntu when the lock screen kicks in.
When you return to your desktop and log back in whatever you were listening to resumes, with playback picking up exactly where it left off.
I find it useful when I’m listening to a podcast in a coffee shop— listening through my earphones, I should add; I’m not one of those people — but want to nip down to order another drink. Instead of needing to pause Rhythmbox and then press my lock screen shortcut (
L) I simply press the latter and the music is automatically paused.
When, when I come back up, I pop my ear buds in, smack in my password, and I’m back in stereo.
Naturally you’ll need to have screen lock enabled on Ubuntu to make use of this little script. Lock screen automatically kicks in after a set period on new installs, and can also be assigned to a keyboard shortcut. You’ll also find a ‘lock’ options available in the power indicator.
Lock screen ≠ as login screen; this script does not pause/resume if you log out and back in.
You’ll also need to use a supported music player. Out-of-the-box this script can work with Clementine, Rhythmbox and Spotify for Linux Preview.
If your player of choice — be it Pragha, Guayadeque or Cmus — isn’t supported you can grab the code and add it yourself as the developer says his script is ‘easily extendable for any player that uses the MPRIS D-Bus Interface’.
Does this script scratch a niche itch? Absolutely — but it scratches it so damn well!
You can learn more and download the current version from Github.