Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gsettings needs DBUS_SESSION_BUS_ADDRESS of current user #73

Open
monte-monte opened this issue Jul 15, 2014 · 1 comment
Open

gsettings needs DBUS_SESSION_BUS_ADDRESS of current user #73

monte-monte opened this issue Jul 15, 2014 · 1 comment
Labels

Comments

@monte-monte
Copy link

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-)
@martin-ueding
Copy link
Owner

That is cool! We had problems with the environment variables all along. This is probably a good idea to include.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants