Created
February 28, 2019 23:34
-
-
Save GermaniumSystem/d6eb8ac507f219acae1ee8630e12eb03 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/bin/bash | |
DEBUG=1 | |
# Indicator string as seen in dbus messages. Will probably change frequently. | |
DM_INDICATOR='chrome_app_indicator2_5dc5a4d4fc9f0cfd05f90bfbb2390e06' | |
function debugEcho { | |
if [ "$DEBUG" -eq 1 ] ; then | |
echo "$@" | |
fi | |
} | |
# Force the LED off on startup. | |
xset -led 3 | |
# Monitor the session dbus for messages indicating that Slack's icon changed. | |
dbus-monitor "type=method_return" | grep --line-buffered -Eo 'chrome_app_indicator2_[^"]+' | while read indicator ; do | |
# If the new icon equals the known DM_INDICATOR icon, turn on the light. | |
if [[ "$indicator" == "$DM_INDICATOR" ]] ; then | |
debugEcho "[[ \"$indicator\" == \"$DM_INDICATOR\" ]]" | |
xset led 3 | |
# Otherwise, turn it off. | |
else | |
debugEcho "[[ \"$indicator\" != \"$DM_INDICATOR\" ]]" | |
xset -led 3 | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment