From b331205da2eedcdd2ce4bc61a4fa7d72e1be9b2f Mon Sep 17 00:00:00 2001 From: Andrew Coleman Date: Mon, 10 May 2021 15:42:27 -0400 Subject: [PATCH] add light gnome-terminal theme --- base16-outrun-dark-256.sh | 4 +- gnome.yml | 9 +++- road-grey.sh | 92 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 101 insertions(+), 4 deletions(-) create mode 100644 road-grey.sh diff --git a/base16-outrun-dark-256.sh b/base16-outrun-dark-256.sh index 230166f..7d942f3 100755 --- a/base16-outrun-dark-256.sh +++ b/base16-outrun-dark-256.sh @@ -2,7 +2,7 @@ # Base16 Outrun Dark - Gnome Terminal color scheme install script # Hugo Delahousse (http://github.com/hugodelahousse/) set -x -[[ -f "$HOME/.config/.gnome-terminal-profile-created" ]] && exit 0 +[[ -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 @@ -82,7 +82,7 @@ if which "$DCONF" > /dev/null 2>&1; then unset DEFAULT_KEY unset DEFAULT_SLUG unset BASE_NEW_KEY - touch "$HOME/.config/.gnome-terminal-profile-created" + touch "$HOME/.config/.gnome-terminal-profile-base16-outrun-dark-256-created" exit 0 fi fi diff --git a/gnome.yml b/gnome.yml index 832e43b..cacc492 100644 --- a/gnome.yml +++ b/gnome.yml @@ -1,8 +1,13 @@ --- -- name: create gnome-terminal profile +- name: create outrun dark gnome-terminal profile script: base16-outrun-dark-256.sh args: - creates: "{{ ansible_env.HOME }}/.config/.gnome-terminal-profile-created" + creates: "{{ ansible_env.HOME }}/.config/.gnome-terminal-profile-base16-outrun-dark-256-created" + +- name: create road grey light gnome-terminal profile + script: road-grey.sh + args: + creates: "{{ ansible_env.HOME }}/.config/.gnome-terminal-profile-road-grey-created" - name: Add Tela icon theme shell: mkdir -p share/icons && cd share/icons && curl -Lo tela.tar.xz {{ tela_icons_url }} && tar xvJf tela.tar.xz && rm -rf tela.tar.xz diff --git a/road-grey.sh b/road-grey.sh new file mode 100644 index 0000000..159d554 --- /dev/null +++ b/road-grey.sh @@ -0,0 +1,92 @@ +#!/usr/bin/env bash + +# ROAD GREY +# https://github.com/jdw1996/road-grey-gnome-terminal.git +# --------- +# Gnome Terminal color scheme install script +# Based on: +# https://github.com/denysdovhan/one-gnome-terminal +# Which is based on: +# https://github.com/chriskempson/base16-gnome-terminal/ +set -x +[[ -f "$HOME/.config/.gnome-terminal-profile-road-grey-created" ]] && exit 0 +[[ -z "$PROFILE_NAME" ]] && PROFILE_NAME="Road Grey" +[[ -z "$PROFILE_SLUG" ]] && PROFILE_SLUG="road-grey" +[[ -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 + [[ -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 "['#000000', '#bc3629', '#418240', '#a27a01', '#315bb4', '#833482', '#1880a0', '#faf9fa', '#212227', '#bc3629', '#418240', '#a27a01', '#315bb4', '#833482', '#1880a0', '#ffffff']" + dset background-color "'#c2c4cc'" + dset foreground-color "'#212227'" + dset bold-color "'#212227'" + dset bold-color-same-as-fg "true" + 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-road-grey-created" + exit 0 + fi +fi + +echo "dconf not found" +exit 1