From 61fb9583743dfb897be508b6de2bd28a14380f48 Mon Sep 17 00:00:00 2001 From: phenonymous <29523105+phenonymous@users.noreply.github.com> Date: Thu, 22 Nov 2018 14:30:40 +0100 Subject: [PATCH] Major update with tilix support --- .gitignore | 2 ++ apply-colors.sh | 64 +++++++++++++++++++++++++------------------------ gogh.sh | 2 ++ 3 files changed, 37 insertions(+), 31 deletions(-) diff --git a/.gitignore b/.gitignore index 7786296..72e6567 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ out.txt gh-pages/node_modules *lock* +.stfolder +apply-colors-original.sh diff --git a/apply-colors.sh b/apply-colors.sh index 76a9e0a..66b65d5 100755 --- a/apply-colors.sh +++ b/apply-colors.sh @@ -5,7 +5,7 @@ # | =========================================== UUIDGEN="${UUIDGEN:-$(command -v uuidgen)}" DCONF="${DCONF:-$(command -v dconf)}" -GCONF="${GCONF:-$(command -v gconftool)}" +GCONF="${GCONF:-$(command -v gconftool-2)}" GS="${GS:-$(command -v gsettings)}" case "${TERMINAL}" in @@ -26,6 +26,7 @@ case "${TERMINAL}" in touch "$CFGFILE" fi ;; + guake|tilix|mate-terminal|gnome-terminal* ) case "${TERMINAL}" in guake|gnome-terminal* ) @@ -45,10 +46,6 @@ case "${TERMINAL}" in fi ;; - * ) - printf '%s\n' "Unsupported terminal" - exit 1 - ;; esac @@ -146,7 +143,7 @@ gcset() { local key="$1"; shift local val="$1" - "$GCONFTOOL" --set --type "$type" "$PROFILE_KEY/$key" -- "$val" + "$GCONF" --set --type "$type" "$PROFILE_KEY/$key" -- "$val" } # Because gconftool doesn't have "append" @@ -158,12 +155,12 @@ glist_append() { entries="$( { - "$GCONFTOOL" --get "$key" | tr -d "[]" | tr , "\n" | grep -F -v "$val" + "$GCONF" --get "$key" | tr -d "[]" | tr , "\n" | grep -F -v "$val" echo "$val" } | head -c-1 | tr "\n" , )" - "$GCONFTOOL" --set --type list --list-type "$type" "$key" "[$entries]" + "$GCONF" --set --type list --list-type "$type" "$key" "[$entries]" } gset() { @@ -447,34 +444,34 @@ case "${TERMINAL}" in apply_cygwin ;; - guake|gnome-terminal* ) - if [[ -z ${DCONF} ]]; then - if [[ "${TERMINAL}" == "guake" ]]; then - apply_guake legacy - else - BASE_KEY="/apps/gnome-terminal/profiles" - apply_gtk legacy - fi + guake ) + if [[ -n "$($DCONF list /apps/guake/style/)" ]]; then + apply_guake else - if [[ "${TERMINAL}" == "guake" ]]; then - apply_guake - else - BASE_KEY="/org/gnome/terminal/legacy/profiles:" - PROFILE_LIST_KEY="${BASE_KEY}/list" - PROFILE_SLUG=":${PROFILE_SLUG}" + apply_guake legacy + fi + ;; - : ${DEFAULT_SLUG:=":$($DCONF read ${BASE_KEY}/default | tr -d \')"} - : ${DEFAULT_SLUG:=":$($DCONF list ${BASE_KEY}/ | grep '/$' | head -n1 | tr -d ':/')"} + gnome-terminal* ) + if [[ -n "$($DCONF list /org/gnome/terminal/)" ]]; then + BASE_KEY="/org/gnome/terminal/legacy/profiles:" + PROFILE_LIST_KEY="${BASE_KEY}/list" + PROFILE_SLUG=":${PROFILE_SLUG}" - echo $PROFILE_SLUG - echo $DEFAULT_SLUG + : ${DEFAULT_SLUG:=":$($DCONF read ${BASE_KEY}/default | tr -d \')"} + : ${DEFAULT_SLUG:=":$($DCONF list ${BASE_KEY}/ | grep '/$' | head -n1 | tr -d ':/')"} - LEFT_WRAPPER="[" - RIGHT_WRAPPER=] - PALETTE_DELIM="', '" + echo $PROFILE_SLUG + echo $DEFAULT_SLUG - apply_gtk - fi + LEFT_WRAPPER="[" + RIGHT_WRAPPER=] + PALETTE_DELIM="', '" + + apply_gtk + else + BASE_KEY="/apps/gnome-terminal/profiles" + apply_gtk legacy fi ;; @@ -505,6 +502,11 @@ case "${TERMINAL}" in apply_gtk ;; + * ) + printf '%s\n' "Unsupported terminal!" + exit 1 + ;; + esac unset PROFILE_NAME diff --git a/gogh.sh b/gogh.sh index 4eb3e69..a9dcb77 100755 --- a/gogh.sh +++ b/gogh.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash +set -euxo pipefail + declare -a THEMES=( '3024-day.sh' '3024-night.sh'