Wednesday, 22 October 2014

Change screenlock timeout from script - Ubuntu 14.04

My screen is set to blank/timeout after 3 minutes but I find it a real pain to have to go to the menus and then select the 'Brightness & Lock' applet in order to just change the timeout.

Since I love using the shell so much, I thought that I'd investigate seeing if I could achieve the same result via scripting. After a bit of confusion as to which command I should be using (gconf/dconf/gsettings), I discovered the correct way of poking the new values is by using dconf:

dconf write /org/gnome/desktop/session/idle-delay 'uint32 180'
Sets the delay for 3 minutes.

dconf write /org/gnome/desktop/session/idle-delay 'uint32 600'
Sets the delay for 10 minutes.

dconf write /org/gnome/desktop/session/idle-delay 'uint32 3600'
Sets the delay for 1 hour.

Note - you don't need to sudo these commands.

Respect to Jani for pointing me in the right direction.