Alexander Sandler
Alexander Sandler

Reputation: 2118

How to create/delete gconf directory with gconftool-2?

... ughm ... the subject?

I am writing a script that will create gnome-terminal profiles for various machines that I want to connect to. I need a custom command to run on each terminal and profile is ideal solution for the problem. The script should do various modifications to the gnome-terminal profiles. Each profile has a directory in gconf. I want to be able to create and delete these directories from command line. Any idea how to do it?

Upvotes: 3

Views: 6795

Answers (4)

Erigami
Erigami

Reputation: 854

To create a new directory with gconf-editor, find the parent of the dir you want, then create a new key of the form <directory-name>/key. That creates the dir for you.

I assume you can do the same implicit creation with gconftool-2.

Upvotes: 0

Eugene Burmako
Eugene Burmako

Reputation: 13048

You can create/delete appropriate directories inside "~/.gconf" and then restart gconfd by executing gconftool-2 --shutdown followed by gconftool-2 --spawn. This will flush gconf caches and will apply your settings right away.

Upvotes: 3

gpoo
gpoo

Reputation: 8638

You can use:

$ gconftool-2 --recursive-unset /apps/gnome-terminal/foo/bar

for unset everything from foo/bar in gnome-terminal.

Another alternative is to use an XML file with the keys you would like to change/unset, and use:

$ gconftool-2 --unload clean-settings.xml

and later:

$ gconftool-2 --load new-settings.xml

However, I do not think you need to "delete" or "unset" anything. My recommendation is:

  1. Customize gnome-terminal as you need it.
  2. Export the settings using:

    $ gconftool-2 --dump /apps/gnome-terminal > my-gnome-terminal-settings.xml

  3. Copy the files (or use whatever mechanisms for working with your remotes machines) and in your remote machine run:

    $ gconftool-2 --load my-gnome-terminal-settings.xml

Upvotes: 6

Alexander Sandler
Alexander Sandler

Reputation: 2118

Apparently you can't do that directly. Instead, deleting contents of the directory deletes it. The problem is that, as it seems, gconf and friends implement some sort of settings caching. As a result, it takes some time until you see that directory is actually gone. Sometimes it is immediately, but more often you have to wait few minutes or even relogin. I could not identify what exactly takes for gconf to refresh it's directory structure.

Upvotes: 1

Related Questions