29

I'm trying to change a string based dconf key with a bash script, using the following command line:

dconf write /org/gnome/nautilus/preferences/show-directory-item-counts 'never'

But it return the following error:

error: 0-5:unknown keyword

Usage:
  dconf write KEY VALUE 

Write a new value to a key

Arguments:
  KEY         A key path (starting, but not ending with '/')
  VALUE       The value to write (in GVariant format)

Can someone help me?

edit 1 : I'm trying to make nautilus to not count the number of item in the directory (for optimization purpose)

2
  • What are you trying to do? What tutorial are you following?
    – jobin
    Jun 23, 2014 at 15:59
  • I'm trying to make nautilus stop counting the number of item in each directory.
    – Dremor
    Jun 23, 2014 at 16:02

3 Answers 3

44

The value needs additional quoting i.e. to assign GVariant string value 'foo' you need to write the value argument as "'foo'"

dconf write /org/gnome/nautilus/preferences/show-directory-item-counts "'never'"

See dconf — Simple tool for manipulating a dconf database at https://developer.gnome.org/

0
10

What steeldriver said is the right way to do it. However using gsettings is an easier way to archive the same.

gsettings set org.gnome.nautilus.preferences show-directory-item-counts never
2
  • 2
    Using gsettings is probably the better approach. See developer.gnome.org/dconf/unstable/dconf-tool.html, where it states: "dconf cannot perform type and consistency checks on values. The gsettings utility is an alternative if such checks are needed."
    – Enterprise
    May 19, 2017 at 21:54
  • 2
    Seems gsettings has not the same keys as dconf, example dconf read /org/compiz/profiles/unity/plugins/scale/initiate-edge returns 'TopRight', but gsettings get org.compiz.profiles.unity.plugins.scale initiate-edge returns No such schema 'org.compiz.profiles.unity.plugins.scale' Dec 20, 2018 at 0:14
0
#!/usr/bin/env bash

STATE=`gsettings get org.gnome.desktop.background show-desktop-icons`
gsettings set org.gnome.desktop.background show-desktop-icons true|false
1
  • 2
    How come you are piping the results of gsettings into the command false? :-P
    – Victor
    Mar 7, 2022 at 19:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .