7

I'm trying to do something relatively simple that most of us have wanted to do at one time or another: Save my gnome-teminal settings.

I'm running 14.04 (desktop obviously). I've realized from my research that dconf, gconf, and gsettings have over the course of the last couple version bumps, been designated to store the settings for different aspects of Gnome/Unity.

If I ask all of the questions I have about these tools. It would spiral out of control, and I don't want to learn the internals of 3 tools (8 if you count gconftool, gconftool-2, gconfd-2, dconf-service, dconf-ibus, and the dconf database as individual tools)

My new goal is consolidate all of the settings into gsettings, as it contains the most existing settings.

Has this been done?

I've determined that I can unregister gconf schemas.

I've determined that gsettings operates on the dconf database with a much friendlier interface (i.e. the finest tab completion anyone could ask for in a command-line tool.)

Would there be any major caveats, aside from the time investment, to moving config from gconf to dconf, and just creating gsettings schemas for those settings... So that I can easily save my gnome-terminal settings, and any other UI preferences I wish to adjust that come up?

[Edit:]

Thanks to the comment by @Rinzwind below, I have decided to ignore gconf and found the settings for gnome-terminal. However it consists of only 2 keys, exec-arg, and exec.

Where can I find a list of all the keys I can add?

7
  • I have gathered that everything is being, or has ported to gsettings for 16.04.. or some later version... however for what I'm doing, switching from upstart to systemd is another learning curve, time vacuum I'm trying to avoid. Apr 18, 2017 at 8:29
  • 1
    And with 18.04 you will need to learn gnome 3. Don't bother with gconf. gsettings is a command line tool for dconf so they are the same. dconf-editor is the graphical tool for dconf.
    – Rinzwind
    Apr 18, 2017 at 8:30
  • Thanks for the heads up. Can't do GUI though. For what I'm working on it has to be 100% scriptable. No exceptions. Hence my decision to lean towards gsettings. Apr 18, 2017 at 8:32
  • I remember gnome 3. I like that decision. Apr 18, 2017 at 8:33
  • 3
    Possible duplicate of Backup GNOME-Terminal
    – moodboom
    Jan 26, 2019 at 20:57

2 Answers 2

2

This is an old question but clearly still relevant.

Based on this useful post, here is how to backup/restore your GNOME Terminal settings; this can be used for instance when migrating from one computer to another.

* Please be advised * : this will overwrite the default Terminal profile on the new machine!

  1. Make sure you're using the same profile name on both machines by renaming it under "Profiles" in the Preferences dialog and activate it if necessary (click on drop-down menu and select "Set as default")
  2. On the source machine run this little script:

    gprofile=$(gsettings get org.gnome.Terminal.ProfilesList default)
    gprofile=${gprofile:1:-1}
    gschema=org.gnome.Terminal.Legacy.Profile
    gpath=/org/gnome/terminal/legacy/profiles:/:${gprofile}/
    gsettings list-recursively ${gschema}:${gpath} > /tmp/term_profile.gsettings
    
  3. Examine the profile backup file (/tmp/term_profile.gsettings) to make sure it looks sensible. It might be useful to delete any unwanted settings that you don't want to carry across.

  4. Copy the backup file across to the new computer, eg:

    scp /tmp/term_profile.gsettings new-host:/tmp
    
  5. Now run the following little script on the new computer; we'll start with a dry-run to have a chance to spot any unexpected stuff:

    gprofile=$(gsettings get org.gnome.Terminal.ProfilesList default)
    gprofile=${gprofile:1:-1}
    gschema=org.gnome.Terminal.Legacy.Profile
    gpath=/org/gnome/terminal/legacy/profiles:/:${gprofile}/        
    cut -f2- -d' ' /tmp/term_profile.gsettings | while read line; do
       key=$(echo $line | cut -f1 -d' ')
       value=$(echo $line | cut -f2- -d' ')
       echo "$key => $value"
       # commented out for dry-run:
       # gsettings set ${gschema}:${gpath} $key "$value"
    done
    
  6. Assuming the output looks good, repeat the above script but un-comment the gsettings set line. Your changes (eg: palette change) should apply immediately to your running Terminal.

Tested on 19.10 but should work on some older (and possibly newer) versions too.

Note that this only takes care of the preferences found under "Profile"; assuming the relevant gsettings keys can be discovered, the technique should work to backup/restore them too.

-1

Okay, so I found the file containing the gnome-terminal preferences.

They are located in a (what looks like XML) file at:

/usr/share/gnome-terminal/profile-preferences.ui

Since I haven't been able to figure out how to update this file through any of the settings managers. I went manual. You can save this file, and copy over the default on a fresh install, and never have to click through the GUI again.

Interesting side note, there are also a file in the folder called terminal.xml which appears to contain the menu items, with their associated actions. Additionally there is a file called keybinding-editor.ui which appears to contain the keybindings for the terminal. Definitely going to try to modify some options. Maybe a single row of options under ALT+(some number) so that you don't have to disable menu access to use the bash keyboard shortcuts.

If I end up having the time to add the terminal preferences to dconf/gsettings, I'll follow up with a link to the script.

2
  • 2
    Those files contain the description of how the Preferences dialogs should look like, and not the values you set. Those files are an intrinsic part of gnome-terminal, shipped by the package manager and overwritten each time the package is upgraded. Plus, they're only writable by the root user, not by regular users. Regular users' configurations are always placed in their home directories, cannot be under system-wide locations. Backing up and restoring the files you've mentioned gets you nowhere.
    – egmont
    Oct 22, 2017 at 15:06
  • I came across this while looking for answers to this question myself using 18.04.3 LTS and the answer given received no upvotes and in any case the answer appears now to be obsolete as there is no gnome-terminal directory in 18.04. This needs an updated answer. I am currently researching the current prescribed way to do this and have trawled through documentation and tons of articles online and so far found nothing.
    – user993560
    Nov 5, 2019 at 0:51

You must log in to answer this question.

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