Ubuntu – How to change gedit preferences from terminal

command linegedit

I'm preparing a bash file to automatically configure a fresh installation, and would like that gedit goes to the desired shape without manually configuring the preferences. How can it be commanded from the terminal to, for example, change colors and tab size?

Best Answer

I'm not much of a gedit person but you could configure it to your liking and then check the settings by running:

% gsettings list-recursively | grep gedit | head -10
org.gnome.gedit.state.file-filter filter-id 0
org.gnome.gedit.state.history-entry search-for-entry ['']
org.gnome.gedit.state.history-entry replace-with-entry ['']
org.gnome.gedit.state.window size (1280, 473)
org.gnome.gedit.state.window state 128
org.gnome.gedit.state.window bottom-panel-active-page 0
org.gnome.gedit.state.window bottom-panel-size 140
org.gnome.gedit.state.window side-panel-active-page 228660812
org.gnome.gedit.state.window side-panel-size 200
org.gnome.gedit.plugins active-plugins ['filebrowser', 'modelines', 'docinfo', 'spell', 'zeitgeistplugin', 'time']

Let's say you want to customise the org.gnome.gedit.plugins.pythonconsole setting.

Check its current value:

% gsettings list-recursively | grep 'org.gnome.gedit.plugins.pythonconsole font'
org.gnome.gedit.plugins.pythonconsole font 'Monospace 10'

Set the desired new value:

% gsettings set org.gnome.gedit.plugins.pythonconsole font 'Monospace 11'

Verify the change took place:

% gsettings list-recursively | grep 'org.gnome.gedit.plugins.pythonconsole font'
org.gnome.gedit.plugins.pythonconsole font 'Monospace 11'

At this point you can add your settings to your script.