Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Updated to support newest Gnome Terminal #208

Merged
merged 3 commits into from

7 participants

@jreese

The latest versions of Gnome Terminal store their settings and profiles
using the newer dconf system rather than gconf. As such, the script
will now detect both the presence of dconf and the appropriate dconf
keys for Gnome Terminal. When the dconf keys are not found, then it
will gracefully fall back to the old method using gconf.

I have tested this on Gnome Shell version 3.8. I have not tested on any previous versions, but I have tested the conditionals with non-existent binaries and config keys, and I am satisfied that it will fall back to the previous (unmodified) code appropriately.

jreese added some commits
@jreese jreese Updated to support newest Gnome Terminal
The latest versions of Gnome Terminal store their settings and profiles
using the newer dconf system rather than gconf.  As such, the script
will now detect both the presence of dconf and the appropriate dconf
keys for Gnome Terminal.  When the dconf keys are not found, then it
will gracefully fall back to the old method using gconf.
fc32ef0
@jreese jreese Fix bad foreground color in gnome-terminal c38ec2d
@jreese jreese Improve detection for new dconf usage and remove echoes 14bac9d
@starlays

Thank you for the updated script, works nice on gnome-terminal 3.10 on Archlinux.

@todd-dsm
This is still broken; I have the latest Fedora 19 install and gnome-terminal:

$ rpm -qa gnome-terminal
gnome-terminal-3.8.4-1.fc19.x86_64

$ pwd
/home/user/Downloads/tomorrow-theme/Gnome-Terminal

Even after changing gconftool to gconftool-2 the script still errors:

[user@host Gnome-Terminal]$ grep gconftool setup-theme.sh
[[ -z "$GCONFTOOL" ]] && GCONFTOOL=gconftool

[user@host Gnome-Terminal]$ sed -i 's/gconftool/gconftool-2/' setup-theme.sh

[user@host Gnome-Terminal]$ grep gconftool setup-theme.sh
[[ -z "$GCONFTOOL" ]] && GCONFTOOL=gconftool-2

[user@host Gnome-Terminal]$ ./setup-theme.sh
No value set for `/apps/gnome-terminal/global/profile_list'

You may want to look at the installer for solarized:
https://github.com/sigurdga/gnome-terminal-colors-solarized

The solarized script (for gnome) will initialize and ask a few questions. Based on the answers, it will install the theme under the profile designated by the user. It requires a new terminal profile before script execution, else will exit.

@rosstimson

Broken on Debian Testing/Jessie too, script seems to run without errors but doesn't do anything.

$ dpkg -l gnome-terminal
ii  gnome-terminal    3.10.1-1    amd64    GNOME terminal emulator application
@chenshifei

still not working on fedora 20 using dconf, run without errors but nothing happens

@jreese

Do note that running the modified copy of Gnome-Terminal/setup-theme.sh creates a new profile in Gnome Terminal named "Tomorrow", which you will then have to switch to and/or make the default profile. I run Arch Linux with Gnome 3.10, and just reverified that it indeed creates a new profile with the correct color scheme by using the dconf tool.

@jamescasbon

Works for me, thanks. Should get merged.

@chriskempson chriskempson merged commit d6acf2b into chriskempson:master
@chriskempson

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 9, 2013
  1. @jreese

    Updated to support newest Gnome Terminal

    jreese authored
    The latest versions of Gnome Terminal store their settings and profiles
    using the newer dconf system rather than gconf.  As such, the script
    will now detect both the presence of dconf and the appropriate dconf
    keys for Gnome Terminal.  When the dconf keys are not found, then it
    will gracefully fall back to the old method using gconf.
  2. @jreese
Commits on Aug 10, 2013
  1. @jreese
This page is out of date. Refresh to see the latest.
Showing with 67 additions and 0 deletions.
  1. +67 −0 Gnome-Terminal/setup-theme.sh
View
67 Gnome-Terminal/setup-theme.sh
@@ -2,6 +2,73 @@
[[ -z "$PROFILE_NAME" ]] && PROFILE_NAME=Tomorrow
[[ -z "$PROFILE_SLUG" ]] && PROFILE_SLUG=Tomorrow
+[[ -z "$DCONF" ]] && DCONF=dconf
+[[ -z "$UUIDGEN" ]] && UUIDGEN=uuidgen
+
+dset() {
+ local key="$1"; shift
+ local val="$1"; shift
+
+ if [[ "$type" == "string" ]]; then
+ val="'$val'"
+ fi
+
+ "$DCONF" write "$PROFILE_KEY/$key" "$val"
+}
+
+# because dconf still doesn't have "append"
+dlist_append() {
+ local key="$1"; shift
+ local val="$1"; shift
+
+ local entries="$(
+ {
+ "$DCONF" read "$key" | tr -d '[]' | tr , "\n" | fgrep -v "$val"
+ echo "'$val'"
+ } | head -c-1 | tr "\n" ,
+ )"
+
+ "$DCONF" write "$key" "[$entries]"
+}
+
+# Newest versions of gnome-terminal use dconf
+if which "$DCONF" > /dev/null 2>&1; then
+ [[ -z "$BASE_KEY" ]] && BASE_KEY=/org/gnome/terminal/legacy/profiles:
+
+ if [[ -n "`$DCONF list $BASE_KEY/`" ]]; then
+ if which "$UUIDGEN" > /dev/null 2>&1; then
+ PROFILE_SLUG=`uuidgen`
+ fi
+
+ if [[ -n "`$DCONF read $BASE_KEY/default`" ]]; then
+ DEFAULT_SLUG=`$DCONF read $BASE_KEY/default | tr -d \'`
+ else
+ DEFAULT_SLUG=`$DCONF list $BASE_KEY/ | grep '^:' | head -n1 | tr -d :/`
+ fi
+
+ DEFAULT_KEY="$BASE_KEY/:$DEFAULT_SLUG"
+ PROFILE_KEY="$BASE_KEY/:$PROFILE_SLUG"
+
+ # copy existing settings from default profile
+ $DCONF dump "$DEFAULT_KEY/" | $DCONF load "$PROFILE_KEY/"
+
+ # add new copy to list of profiles
+ dlist_append $BASE_KEY/list "$PROFILE_SLUG"
+
+ # update profile values with theme options
+ dset visible-name "'$PROFILE_NAME'"
+ dset palette "['rgb(0,0,0)','rgb(145,34,38)','rgb(119,137,0)','rgb(174,123,0)','rgb(29,37,148)','rgb(104,42,155)','rgb(43,102,81)','rgb(146,149,147)','rgb(102,102,102)','rgb(204,102,102)','rgb(181,189,104)','rgb(240,198,116)','rgb(129,182,190)','rgb(178,148,187)','rgb(138,190,183)','rgb(236,235,236)']"
+ dset background-color "'rgb(29,31,33)'"
+ dset foreground-color "'rgb(197,200,198)'"
+ dset bold-color "'rgb(138,186,183)'"
+ dset bold-color-same-as-fg "false"
+ dset use-theme-colors "false"
+
+ exit 0
+ fi
+fi
+
+# Fallback for Gnome 2 and early Gnome 3
[[ -z "$GCONFTOOL" ]] && GCONFTOOL=gconftool
[[ -z "$BASE_KEY" ]] && BASE_KEY=/apps/gnome-terminal/profiles
Something went wrong with that request. Please try again.