Skip to main content

GSettings from GUI to Command Line


In GNOME, the user preferences are under the control of the GSettings subsystem. As GNOME is a graphical desktop, the usual form to interact with this is (doh) through a GUI. Recently I decided I want to mess with those settings also from the command line. Namely I wanted to quickly switch between disabling the screen blanking behaviour and its regular delay before activation. Changing this setting through the GNOME control center, requires me to grab the mouse, locate the control center, sift through all the menu options there trying to remember that it is below "Power" and finally changing it by using a drop-down menu. What I really want is a script called screenblank-toggle somewhere in my path. With such a script, I just type screenb <TAB> <Enter> without having to point the mouse or visually parse anything. The output tells me if the new situation is what I want and if not, <Arrow Up> <Enter> fixes it for good.

So to implement this, I need to find out what GSetting I am looking for.

dzu@krikkit:~$ gsettings list-recursively | wc -l

Hm, maybe I can limit the search somewhat:

dzu@krikkit:~$ gsettings list-recursively | grep screen | wc -l

As I am too lazy to go through this individually, this small blog post shows a shortcut from the GUI to the command line without guessing names or reading documentation (ha ha).

Read more… (2 min remaining to read)