Skip to content

Instantly share code, notes, and snippets.

Last active January 22, 2016 09:06
What would you like to do?
Pause/Play audio on screen lock/unlock
#!/usr/bin/env bash
# This script pauses music on Ubuntu when screen is locked (cmd+l)
# My other script 'playdog' is required.
# It gives you seamless controls to vlc, spotify and mocp
# You should add this script to startup scripts
# Get playdog here:
dbus-monitor --session "type='signal',interface='com.ubuntu.Upstart0_6'" |
while read x; do
$(echo $x | grep "desktop-lock" &> /dev/null) && playdog -pause &> /dev/null;
$(echo $x | grep "desktop-unlock" &> /dev/null) && playdog -playpause &> /dev/null;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment