How to set the GNOME idle delay from the command line

Control how long of an idle delay timeout GNOME has before it locks your screen with a single command.

gnomehero.jpg

GNOME

Recently, I found myself in an odd situation. Working from home means that I spend a lot of time by myself. Because of that, I generally have no need for my desktop screen to lock after 15 minutes of idleness. 

More about Open Source

Personally, I prefer a thirty-minute timeout, so I don't need to log back in with such frequency. This is only advantageous, because I know my cats aren't going to give the keys to my digital kingdom away—at least I'm fairly certain that's the case.

SEE: Choosing your Windows 7 exit strategy: Four options (TechRepublic Premium)

Regardless of feline propensities, I want that timeout set to thirty. Thing is, within the GNOME Settings tool, you do not get the 30-minute option. In fact, the only available options are (in minutes) 1, 2, 3, 4, 5, 6, 7, 8, 10, 15, Never. See? No 30.

Fortunately, this is Linux, so where there's a will, there is most certainly a way. Said way is thanks to the command line. With the help of a single command, you can set that timeout to whatever your productive heart needs.

Let me show you how.

Gsettings 

The command in question is gsettings. The gsettings command offers a straightforward interface to the GSettings application. What is GSettings? Think of it as a sort of Windows Registry Editor for GNOME, only from the command line. From within GSettings you can get incredibly granular with GNOME settings. Thing is, however, there is no GUI tool for GSettings. In fact, if you open the man page for GSettings (man GSettings), it displays the man page for gsettings. If you open the man page for gsettings (man gsettings), it refers to GSettings.

It's a convoluted mess.

Changing the timeout with Gsettings

So, how do you change the timeout with the gsettings command? It's quite simple. If you're at all familiar with the Windows Registry Editor, you know it requires that you navigate through a hierarchy to get to the setting you want. With Gsettings, it's the same thing. The hierarchy we need here is org | gnome | desktop | session. Of course, Gsettings doesn't read the pipe character, so the actual format is org.gnome.desktop.session.

Within the session section, we'll set the idle delay to 30 minutes. However, gsettings doesn't read in minutes, but rather seconds. So our time frame is 1,800. With that information in hand, open a terminal window and issue the command:

gsettings set org.gnome.desktop.session idle-delay 1800

That's it. Your idle delay for the GNOME desktop is now set to 30 minutes.

What's interesting about this is once you set it that 30-minute option will now show up in Settings | Power (Figure A).

gsettingsa.jpg

Figure A: The GUI now has the 30 minute option available.

However (you knew it was coming), the second you close the Settings window (after changing it from 30), that newly added option disappears. In order to get it back (you guessed it), you have to add it from the command line.

Give your desktop a timeout

Thanks to the Linux command line, you can give your desktop the precise timeout you want. Or, if you prefer, you can give it no timeout, with the command gsettings set org.gnome.desktop.session idle-delay 0. No matter what idle delay you give your machine, it's a good thing you are in control. That's the Linux way.

Also see

Post a Comment

0 Comments