Hi, I have a small script to mute sound . It works while launched from root but will fail when launched with acpi event.
Notification appears but sound will not be muted.
Any clue ?
The scipt :
Code:
#!/bin/bash
# get user running pulseaudio
user=$(ps aux | grep /usr/bin/pulse | grep -v grep | awk '{print $1}' | head -1)
# Get device name
device=$(su $user -c 'pactl list sinks' | grep -A1 RUNNING | grep Nom | sed -e s/Nom://g | sed 's/^[ \t]*//;s/[ \t]*$//' | awk -F ": " '{ print $2}')
# what to do
su $user -c 'pactl set-sink-mute '$device' toggle'
# notify action
su $user -c "DISPLAY=:0 /usr/bin/notify-send --expire-time=1000 'VOLUME MUTED' 'toggle'"