-
Notifications
You must be signed in to change notification settings - Fork 24
Open
Labels
Description
In order to make changes with gsettings or dconf you shoul have "DBUS_SESSION_BUS_ADDRESS" variable of current user. Since scripts are called from root they don't have any dbus session address, and variable in gsettings can't be changed.
You can read about this here: http://stackoverflow.com/questions/10374520/gsettings-with-cron/10390963#10390963 or here: www.unix.com/shell-programming-scripting/203631-dbus_session_bus_address-script-called-crontab.html for example.
I used this lines in my hooks:
PID=$(pgrep -u $LOGNAME gnome-session) # instead of 'gnome-session' it can be also used 'nautilus' or 'compiz' or the name of a process of a graphical program about that you are sure that is running after you log in the X session
export DBUS_SESSION_BUS_ADDRESS=$(grep -z DBUS_SESSION_BUS_ADDRESS /proc/$PID/environ|cut -d= -f2-)