-
-
Save aericson/e18c6e83a0c4a4b32d3f to your computer and use it in GitHub Desktop.
noxaarchup.sh
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/sh | |
# based on script from https://aur.archlinux.org/packages/batterylife | |
call_aarchup(){ | |
dbus=$(grep -z DBUS_SESSION_BUS_ADDRESS $1 | sed 's/DBUS_SESSION_BUS_ADDRESS=//') | |
user=$(grep -m 1 -z USER $1 | sed 's/USER=//') | |
dply=$(grep -z DISPLAY $1 | sed 's/DISPLAY=//') | |
sudo -u $user sh -c "DBUS_SESSION_BUS_ADDRESS=\"$dbus\" DISPLAY=\"$dply\" /usr/bin/aarchup" | |
} | |
wrapper(){ | |
called=false | |
for p in $(pgrep gconf-helper); do | |
call_aarchup /proc/$p/environ | |
called=true | |
done | |
if [ $called = false ]; then | |
call_aarchup /proc/self/environ | |
fi | |
} | |
wrapper || exit 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment