File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -25,18 +25,25 @@ export DISPLAY="0:0"
2525
2626for pid in $( pgrep -u $USER dbus-daemon) ; do
2727 env=" /proc/${pid} /environ"
28- dbus=$( grep -z DBUS_SESSION_BUS_ADDRESS $env | cut -d ' :' -f 2 | tr -d ' \0' )
29- if [ -n " ${dbus## ^unix:* } " ]; then
28+ dbus=$( grep -z DBUS_SESSION_BUS_ADDRESS $env | tr -d ' \0' | \
29+ sed ' s/DBUS_SESSION_BUS_ADDRESS=//g' )
30+ if [ -n $dbus ]; then
3031 break
3132 fi
3233done
3334
3435if [ -z " $dbus " ]; then
3536 echo " No dbus-daemon process found."
36- exit 1
37+ env=$( find " ${HOME} /.dbus/session-bus/" -maxdepth 1 -type f)
38+ if [ -f " ${env} " ]; then
39+ dbus=$( grep ^DBUS_SESSION_BUS_ADDRESS $env | sed ' s/DBUS_SESSION_BUS_ADDRESS=//g' )
40+ else
41+ echo " No session address file found in ${HOME} /.dbus/session-bus"
42+ exit 1
43+ fi
3744fi
3845
39- export DBUS_SESSION_BUS_ADDRESS=" unix: ${ dbus} "
46+ export DBUS_SESSION_BUS_ADDRESS=$ dbus
4047
4148_udev_params=( " $@ " )
4249_bat_name=" ${_udev_params[0]} "
You can’t perform that action at this time.
0 commit comments