Skip to content

Instantly share code, notes, and snippets.

@queeup
Last active January 28, 2023 18:39
Show Gist options
  • Save queeup/1f3f95518e04b851b4713e5004c9f15e to your computer and use it in GitHub Desktop.
Save queeup/1f3f95518e04b851b4713e5004c9f15e to your computer and use it in GitHub Desktop.
Create profile and change gnome-terminal profile settings programmatically

Create profile and change gnome-terminal profile settings programmatically

new_profile_uuid=$(uuidgen)
new_profile_list=$(gsettings get org.gnome.Terminal.ProfilesList list | tr -d ']') && new_profile_list+=", '${new_profile_uuid}']"
gsettings set org.gnome.Terminal.ProfilesList list "${new_profile_list}"
gsettings set org.gnome.Terminal.ProfilesList default "${new_profile_uuid}"
SETTINGS=( "visible-name 'elementary'"
           "default-size-columns '120'"
           "default-size-rows '30'"
           "use-system-font 'false'"
           "font 'Monospace 11'"
           "use-theme-colors 'false'"
           "scrollback-unlimited 'true'"
           "cursor-foreground-color '#839496'"
           "background-color '#2E2E2E'"
           "foreground-color '#a5a5a5'"
           "palette \"['#073642', '#dc322f', '#859900', '#b58900', '#268bd2', '#d33682', '#2aa198', '#eee8d5', '#002b36', '#dc322f', '#586e75', '#657b83', '#839496', '#6c71c4', '#93a1a1', '#fdf6e3']\"" )
for i in "${SETTINGS[@]}"
do
    eval "gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:$(gsettings get org.gnome.Terminal.ProfilesList default | tr -d \')/ ${i}"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment