Last active
March 2, 2019 05:26
-
-
Save bdavidhicks/cb0d6b74ad3296cfae501d15bd9991db to your computer and use it in GitHub Desktop.
systemd service configuration for user service to run on startup to unmute sound when Spotify notification occurs (i.e. when a song plays)
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 | |
interface=org.freedesktop.Notifications | |
member=Notify | |
dbus-monitor --profile "interface='$interface',member='$member',arg0='Spotify'" | | |
while read -r line; do | |
amixer -q -D pulse sset Master unmute; | |
done; |
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
[Unit] | |
After=network.target | |
[Service] | |
ExecStart=/home/bhix/spotify_unmuter.sh | |
[Install] | |
WantedBy=default.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
spotify_unmuter.sh
in your home directory, i.e./home/bhix
~/.config/systemd/user/
unmuter.service
in the~/.config/systemd/user/
directoryunmuter.service
and change the path forExecStart=
to be the full path of your home directory, i.e./home/YOUR_USER/spotify_unmuter.sh
sudo chmod 744 ~/spotify_unmuter.sh
to make it executablesudo chmod 664 ~/.config/systemd/user/unmuter.service
to make it readable/writeablesystemctl start --user unmuter.service
to start the service.systemctl enable --user unmuter.service
to enable it to start when the sytem starts.systemctl --user status unmuter.service