Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am trying to to set a global screensaver and blanking idle timout (with screen locking) that will affect all new user accounts. I noticed that gnome-screensaver in 12.04 when configured by a user, writes some data to a blob in ~/.dconf, but I have no idea how to set it globally. I also know that the global timeout is 10 minutes with blanking, but have no idea where this is set system wide. I find the whole dconf transition a bit difficult.

If it is not possible to configure gnome-screensaver this way, I would be quite interested in a solution with xscreensaver/xlock.

The purpose of this is to set a blank screen with automatic locking. Both because of resource usage and security.

Forgot to mention that this is a default Ubuntu 12.04 desktop install with Unity and LightDM. I will however install gnome-shell and gnome-session-fallback to let people choose. It would be nice if a solution works across different sessions.

share|improve this question

2 Answers 2

Which dconf keys are used

To know which keys are changed in dconf, you can use dconf watch / while changing settings. In this case, you'll see something like :

/org/gnome/settings-daemon/plugins/power/sleep-display-ac
  1800

/org/gnome/settings-daemon/plugins/power/sleep-display-battery
  1800

/org/gnome/desktop/session/idle-delay
  uint32 1800

Then, you put these keys in a file in /etc/dconf.

Create and activate /etc/dconf

If this directory does not exists, you have to create it and activate its use with these commands :

mkdir -p /etc/dconf/profile /etc/dconf/db/local.d
cat <<EOF >/etc/dconf/profile/user
user-db:user
system-db:local
EOF

cf: https://live.gnome.org/dconf/SystemAdministrators

Put your global settings

Use a file in /etc/dconf/db/local.d named, for example, screensaver-delay:

[org/gnome/settings-daemon/plugins/power]
sleep-display-ac=1800
sleep-display-battery=1800

[org/gnome/desktop/session]
idle-delay=1800

Apply it running the command: dconf update. It will (re)generate the file /etc/dconf/db/local which will be used if keys do not conflict with user defined values.

Force global values

If you want to force these global values over user selected values, you can do it by using a file in /etc/dconf/db/local.d/locks named, for example, screensaver-delay:

# Force screensaver delay
/org/gnome/settings-daemon/plugins/power/sleep-display-ac
/org/gnome/settings-daemon/plugins/power/sleep-display-battery
/org/gnome/desktop/session/idle-delay
share|improve this answer
1  
The line with cat <EOF should be cat <<EOF (bash "here-documents"). –  Victor Feb 28 at 16:10

xscreensaver option (tested on Xubuntu 12.04): Edit /etc/X11/app-defaults/XScreenSaver (as root) to set lock to True and lockTimeout to whatever time you want. This will change the default for all users, but the users can still change it using the normal preference mechanism.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.