How do I get the type of a dconf/gsettings key via command line ?
I know I can visually inspect keys types and values via the gui tool dconf-editor e.g. the key num-workspaces under the schema org.gnome.desktop.wm.preferences is of type integer:

enter image description here

I'd like to be able to get the type only in CLI via a command or script.


You can try :

gsettings range org.gnome.Evince auto-reload

and you get :

type b
  • Yes, I know about gsettings range ... but it's sort of meh because in some cases the output is completely meaningless (to someone not familiar with GVariant types)... see my updated example. I was hoping there's a tool/script that prints the type just like dconf-editor does but I guess there's no such thing... – don_crissti Dec 25 '18 at 18:16
  • 1
    the meaning of the b, i, etc. types is (kind of) documented here. Such a tool would be almost as complex as cdecl ;-) – mosvy Dec 25 '18 at 18:29

Another way is to use dbus. I am not with gnome so org.gnome.desktop.wm.preferences is not available for me but with xfce ...
There is a utility like gsettings name xfconf-query.

xfconf-query -c xfwm4 -p /general/workspace_count

give 4 but not the type.

dbus-send --session \
          --print-reply \
          --dest=org.xfce.Xfconf /org/xfce/Xfconf \
            org.xfce.Xfconf.GetProperty \
            string:xfwm4 \

method return time=1547386790.562285 sender=:1.8 -> destination=:1.73 serial=289 reply_serial=2
   variant       int32 4

The answer is better to someone not familiar with GVariant types

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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