Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to enable screen timeout and locking when my laptop is located in the LAN of my company and I want to disable this when I'm at home. For location detection I use whereami with a simple detection like this:

default unknown
testdhcp    '172.16.*.*'     work
testdhcp    '192.168.36.*'   home

Now I need to set the corresponding settings when I enter or leave the "work" network. But I have problems finding out where Gnome stores this stuff. I already found out where to toggle the "Lock" button in the screen configuration dialog. I do it like this in the whereami configuration:

!work su -c "dconf write /org/gnome/desktop/screensaver/lock-enabled false" k
=work su -c "dconf write /org/gnome/desktop/screensaver/lock-enabled true" k

This works so far. But I also need to configure the "Turn off after" setting in the screen configuration dialog. I found these three keys in dconf which are influences by it:


But when I change them manually then it doesn't work and the screen dialog doesn't read the new value either. So I guess there are more keys I have to change but I can't find them (I search feature in this new dconf stuff would be nice).

So what settings have I to change to disable/enable the screen timeout?

share|improve this question

You could try using caffeine without changing config.
Simple run it for =work and terminate for !work
sudo add-apt-repository ppa:caffeine-developers/ppa
sudo apt-get update
sudo apt-get install caffeine

more about caffeine

share|improve this answer
up vote 0 down vote accepted

Found it. idle-delay must be of type uint32 and not a string like the other two values. So this works for me:

=work su -c "dconf write /org/gnome/desktop/screensaver/lock-enabled true" k
=work su -c "dconf write /org/gnome/desktop/session/idle-delay 'uint32 120'" k
=work su -c "dconf write /org/gnome/settings-daemon/plugins/power/sleep-display-ac 120" k
=work su -c "dconf write /org/gnome/settings-daemon/plugins/power/sleep-display-battery 120" k
!work su -c "dconf write /org/gnome/desktop/screensaver/lock-enabled false" k
!work su -c "dconf write /org/gnome/desktop/session/idle-delay 'uint32 0'" k
!work su -c "dconf write /org/gnome/settings-daemon/plugins/power/sleep-display-ac 0"  k
!work su -c "dconf write /org/gnome/settings-daemon/plugins/power/sleep-display-battery 0" k
share|improve this answer

Your Answer


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.