Configuring Gnome Shell key bindings from the command line

dconfgnome-terminalgsettings

I am trying to modify the Gnome Shell preferences (in this case the key bindings) using the terminal. I have tried:

gsettings set org.gnome.Terminal.Legacy.Keybindings switch-to-tab-1 '<Alt>1'

But it is giving me an error:

Schema 'org.gnome.Terminal.Legacy.Keybindings' is relocatable (path must be specified)

So I am stuck in there. How can I specify the path? Also, I see the word "Legacy" in there… Is there a better way to do this?

Note: Using Fedora 24 with all upgrades: GNOME Shell 3.20.3, GNOME Terminal 3.20.2.

Best Answer

Thanks to @don_crissti's help and the answer they pointed me to.

In order to change Gnome Terminal keybindings a path must be provided for the schema (as it is relocatable). So we need to define both a schema and a path:

GSETTINGS_SCHEMA=org.gnome.Terminal.Legacy.Keybindings
GSETTINGS_PATH=/org/gnome/terminal/legacy/keybindings/
SCHEMA_PATH=$GSETTINGS_SCHEMA:$GSETTINGS_PATH

Then we can easily set our keybindings:

gsettings set $SCHEMA_PATH switch-to-tab-1 '<Primary><Alt>1'
gsettings set $SCHEMA_PATH switch-to-tab-2 '<Primary><Alt>2'
...
gsettings set $SCHEMA_PATH prev-tab '<Primary><Alt>9'

In order to list all the available keybindings (and also to check they are properly set):

gsettings list-recursively | grep Terminal.Legacy.Keybindings
Related Question