How to change gnome-terminal profile preferences using dconf or gsettings?
The syntax to be used with the gsettings
command is described in
GNOME Terminal Frequently Asked Questions.
First you need to find out the identifier of the profile you want to change. For example, the identifier of the gnome-terminal
default profile can be obtained from schema org.gnome.Terminal.ProfilesList
.
Then change the desired keys of path /org/gnome/terminal/legacy/profiles:/:UUID/
of schema org.gnome.Terminal.Legacy.Profile:
for this profile.
Note the colons in the above path. It will not work if they are omitted.
Here is a script that use the above to set default-size-columns
of the default profile:
profile=$(gsettings get org.gnome.Terminal.ProfilesList default)
profile=${profile:1:-1} # remove leading and trailing single quotes
gsettings set "org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:$profile/" default-size-columns 150
Related videos on Youtube
Håkon Hægland
Updated on September 18, 2022Comments
-
Håkon Hægland over 1 year
After upgrading form Ubuntu 14.10 to 15.10, it seems that changing
gnome-terminal
preferences usinggconftool-2
is no longer supported. I guess this issue is related the Gconf to GSettings migration.Now, I would like to change some of my old scripts ( since they are broken in Ubuntu 15.10 ) to work with
dconf
/gesettings
instead ofgconftool-2
.As an example, on Ubuntu 14.10 (
gnome-terminal
version 3.6.2 ) I could set the number of columns in theDefault
profile using:$ gconftool-2 --set /apps/gnome-terminal/profiles/Default/default_size_columns \ --type=int 140 $ gconftool-2 --set /apps/gnome-terminal/profiles/Default/use_custom_default_size \ --type=bool true
Now, in Ubuntu 15.10, typing:
$ dconf list /org/gnome/terminal/legacy/
gives
profiles:/ schema-version
whereas
$ gsettings list-relocatable-schemas | grep Terminal
gives
org.gnome.Terminal.SettingsList org.gnome.Terminal.Legacy.Profile org.gnome.Terminal.Legacy.Keybindings
The above output confuses me:
- Why is there a
/org/gnome/terminal/legacy/profiles:/
path fordconf
but noorg.gnome.Terminal.Legacy.Profiles
(note the trailings
) schema id forgsettings
? Also, see Shouldn't dconf-editor and gsettings access the same database? for more information.
Still in Ubuntu 15.10 (using
gnome-terminal
version 3.16.2), if I run:$ gsettings list-keys org.gnome.Terminal.Legacy.Profile:/ | grep default
I get:
default-size-rows default-show-menubar default-size-columns
so there is a
default-size-columns
key that could (?) correspond to thedefault_size_columns
key in Ubuntu 14.10, but there is nouse-custom-default-size
key corresponding to theuse_custom_default_size
key in Ubuntu 14.10. This also confuses me.Also, if I try running:
$ gsettings set org.gnome.Terminal.Legacy.Profile:/ default-size-columns 150
and open a new
gnome-terminal
the setting ofdefault-size-columns
seems to have no effect since the terminal still opens with 80 columns..-
Håkon Hægland about 8 years@ByteCommander I have upgraded to 15.10 now, and the question remains the same w.r.t 15.10 as for 15.04. I also found a solution, that I would like to post. How can this question be reopened, so I can post the solution?
- Why is there a
-
Byte Commander about 8 yearsCool that you found the solution yourself. Don't forget to accept your own answer.
-
Anatoli about 7 yearsActually, you can specify the number of the profile instead of its ID, so the command would be just:
gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:0/ default-size-columns 150
-
Anatoli about 7 yearsOr even shorter:
gsettings set org.gnome.Terminal.Legacy.Profile:/:0/ default-size-columns 150
-
yaobin over 4 yearsYour answer saved my day! How did you find out the syntax of "org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:.../"? Did you find it in the documentation? What got me stuck was I didn't realize "Profile" should be followed by "/org/gnome/...".