Pause/Play audio on screen lock/unlock
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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: https://gist.github.com/chanux/db01bd2c66effc7a259f | |
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; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment