#!/usr/bin/env bash # Base16 Outrun Dark - Gnome Terminal color scheme install script # Hugo Delahousse (http://github.com/hugodelahousse/) set -x [[ -f "$HOME/.config/.gnome-terminal-profile-base16-outrun-dark-256-created" ]] && exit 0 [[ -z "$PROFILE_NAME" ]] && PROFILE_NAME="Base 16 Outrun Dark 256" [[ -z "$PROFILE_SLUG" ]] && PROFILE_SLUG="base-16-outrun-dark-256" [[ -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'" } | perl -pe 'chomp if eof' | tr "\n" , )" "$DCONF" write "$key" "[$entries]" } # Newest versions of gnome-terminal use dconf if which "$DCONF" > /dev/null 2>&1; then # Check that uuidgen is available type $UUIDGEN >/dev/null 2>&1 || { echo >&2 "Requires uuidgen but it's not installed. Aborting!"; exit 1; } [[ -z "$BASE_KEY_NEW" ]] && BASE_KEY_NEW=/org/gnome/terminal/legacy/profiles: if [[ -n "`$DCONF list $BASE_KEY_NEW/`" ]]; then if which "$UUIDGEN" > /dev/null 2>&1; then PROFILE_SLUG=`uuidgen` fi if [[ -n "`$DCONF read $BASE_KEY_NEW/default`" ]]; then DEFAULT_SLUG=`$DCONF read $BASE_KEY_NEW/default | tr -d \'` else DEFAULT_SLUG=`$DCONF list $BASE_KEY_NEW/ | grep '^:' | head -n1 | tr -d :/` fi DEFAULT_KEY="$BASE_KEY_NEW/:$DEFAULT_SLUG" PROFILE_KEY="$BASE_KEY_NEW/:$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_NEW/list "$PROFILE_SLUG" # Update profile values with theme options dset visible-name "'$PROFILE_NAME'" dset palette "['#00002a', '#ff4242', '#59f176', '#f3e877', '#66b0ff', '#f10596', '#0ef0f0', '#d0d0fa', '#50507a', '#ff4242', '#59f176', '#f3e877', '#66b0ff', '#f10596', '#0ef0f0', '#f5f5ff']" dset background-color "'#00002a'" dset foreground-color "'#d0d0fa'" dset bold-color "'#d0d0fa'" dset bold-color-same-as-fg "true" dset cursor-colors-set "true" dset cursor-background-color "'#d0d0fa'" dset cursor-foreground-color "'#00002a'" dset use-theme-colors "false" dset use-theme-background "false" unset PROFILE_NAME unset PROFILE_SLUG unset PROFILE_KEY unset DCONF unset UUIDGEN unset DEFAULT_KEY unset DEFAULT_SLUG unset BASE_NEW_KEY touch "$HOME/.config/.gnome-terminal-profile-base16-outrun-dark-256-created" exit 0 else echo "No profiles exist, yet. Try again later." exit 0 fi fi echo "dconf not found" exit 1