How to change gnome-terminal profile preferences using dconf or gsettings?
After upgrading form Ubuntu 14.10 to 15.10, it seems that changing gnome-terminal
preferences using gconftool-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 of gconftool-2
.
As an example, on Ubuntu 14.10 ( gnome-terminal
version 3.6.2 ) I could set the number of columns in the Default
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 the default_size_columns
key in Ubuntu 14.10, but there is no use-custom-default-size
key corresponding to the use_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 of default-size-columns
seems to have no effect since the terminal still opens with 80 columns..
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