Results 1 to 3 of 3

Thread: how to change gnome-terminal colors from cli

  1. #1
    Join Date
    Oct 2014
    Location
    Nuremberg
    Posts
    17

    Default how to change gnome-terminal colors from cli

    So far this works only if the system has one profile:

    Code:
    number_of_profiles=$(dconf list /org/gnome/terminal/legacy/profiles:/ | wc -l)
    
    if [ "$number_of_profiles" -gt 1 ]; then
      echo "You have more than 1 profiles and I am too lazy to configure them"
      echo
      echo "Go to:"
      echo "Edit > Colors"
      echo "Text and Background Color -->  Built-in schemes: Solarized dark"
      echo "Palette --> Built-in schemes: Solarized"
    else
      # take your profile
      profile=$(dconf list /org/gnome/terminal/legacy/profiles:/)
    
      # Remove '/' from the end of the profile variable
      profile=$(echo "${profile::-1}")
    
      # Use theme colors
      dconf write /org/gnome/terminal/legacy/profiles:/$profile/use-theme-colors "false"
    
      # Background color
      dconf write /org/gnome/terminal/legacy/profiles:/$profile/background-color "'rgb(0,43,54)'"
    
      # Foreground color
      dconf write /org/gnome/terminal/legacy/profiles:/$profile/foreground-color "'rgb(131,148,150)'"
    
      # Use Transparent background
      dconf write /org/gnome/terminal/legacy/profiles:/$profile/use-transparent-background "false"
    
      # Solarized Palete
      dconf write /org/gnome/terminal/legacy/profiles:/$profile/palette "['rgb(7,54,66)', 'rgb(220,50,47)',  'rgb(133,153,0)', 'rgb(181,137,0)', 'rgb(38,139,210)', 'rgb(211,54,130)', 'rgb(42,161,152)', 'rgb(238,   232,213)', 'rgb(0,43,54)', 'rgb(203,75,22)', 'rgb(88,110,117)', 'rgb(101,123,131)', 'rgb(131,148,150)',  'rgb(108,113,196)', 'rgb(147,161,161)', 'rgb(253,246,227)']"
    fi

    usually, after a fresh install there's no output for:
    Code:
    dconf list /org/gnome/terminal/legacy/profiles:/
    so I need to create one. Do you know how can I do that from CLI ?

  2. #2
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    27,071
    Blog Entries
    15

    Default Re: how to change gnome-terminal colors from cli

    Hi
    You need to go through gesettings to see the keys and create a profile...
    Code:
    gsettings list-keys org.gnome.Terminal.
    org.gnome.Terminal.Legacy.Keybindings:/  org.gnome.Terminal.Legacy.Settings       org.gnome.Terminal.SettingsList:/
    org.gnome.Terminal.Legacy.Profile:/      org.gnome.Terminal.ProfilesList
    For example here is a default setting;
    Code:
    gsettings get org.gnome.Terminal.ProfilesList list
    ['b1dcc9dd-5262-4d8d-a863-c897e6d979b9']
    The above seems to be random, so create a new one or use your default one and modify the settings.
    Cheers Malcolm °¿° SUSE Knowledge Partner (Linux Counter #276890)
    SUSE SLE, openSUSE Leap/Tumbleweed (x86_64) | GNOME DE
    If you find this post helpful and are logged into the web interface,
    please show your appreciation and click on the star below... Thanks!

  3. #3
    Join Date
    Oct 2014
    Location
    Nuremberg
    Posts
    17

    Default Re: how to change gnome-terminal colors from cli

    Thanks it worked like a charm now

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •