Major update with tilix support

This commit is contained in:
phenonymous 2018-11-07 13:25:47 +01:00
parent a453f6a34d
commit b4aae6e1c3
2 changed files with 6 additions and 9 deletions

View File

@ -304,7 +304,7 @@ elif [ "$TERMINAL" = "tilix" ]; then
if [[ ${TILIX_RES::1} =~ ^(y|Y)$ ]]; then
[[ -d "$HOME/.config/tilix/schemes" ]] || mkdir -p "${HOME}/.config/tilix/schemes"
TILIXCOLORS='{\n\t"background-color":"'${BACKGROUND_COLOR}'",\n\t"badge-color": "#FFFFFF",\n\t"bold-color": "#FFFFFF",\n\t"comment": "Generated by Gogh",\n\t"cursor-background-color": "#000000",\n\t"cursor-foreground-color": "'${CURSOR_COLOR}'",\n\t"foreground-color": "#FFFFFF",\n\t"highlight-background-color": "#000000",\n\t"highlight-foreground-color": "#FFFFFF",\n\t"name": "'${PROFILE_NAME}'",\n\t"palette": [\n\t\t"'${COLOR_01}'",\n\t\t"'${COLOR_02}'",\n\t\t"'${COLOR_03}'",\n\t\t"'${COLOR_04}'",\n\t\t"'${COLOR_05}'",\n\t\t"'${COLOR_06}'",\n\t\t"'${COLOR_07}'",\n\t\t"'${COLOR_08}'",\n\t\t"'${COLOR_09}'",\n\t\t"'${COLOR_10}'",\n\t\t"'${COLOR_11}'",\n\t\t"'${COLOR_12}'",\n\t\t"'${COLOR_13}'",\n\t\t"'${COLOR_14}'",\n\t\t"'${COLOR_15}'",\n\t\t"'${COLOR_16}'"\n\t],\n\t"use-badge-color": false,\n\t"use-bold-color": false,\n\t"use-cursor-color": false,\n\t"use-highlight-color": false,\n\t"use-theme-colors": false\n}'
TILIXCOLORS='{\n\t"background-color":"'${BACKGROUND_COLOR}'",\n\t"badge-color": "#FFFFFF",\n\t"bold-color": "#FFFFFF",\n\t"comment": "Generated by Gogh",\n\t"cursor-background-color": "#000000",\n\t"cursor-foreground-color": "'${CURSOR_COLOR}'",\n\t"foreground-color": "#FFFFFF",\n\t"highlight-background-color": "#000000",\n\t"highlight-foreground-color": "#FFFFFF",\n\t"name": "'${PROFILE_NAME}'",\n\t"palette": [\n\t\t"'${COLOR_01}'",\n\t\t"'${COLOR_02}'",\n\t\t"'${COLOR_03}'",\n\t\t"'${COLOR_04}'",\n\t\t"'${COLOR_05}'",\n\t\t"'${COLOR_06}'",\n\t\t"'${COLOR_07}'",\n\t\t"'${COLOR_08}'",\n\t\t"'${COLOR_09}'",\n\t\t"'${COLOR_10}'",\n\t\t"'${COLOR_11}'",\n\t\t"'${COLOR_12}'",\n\t\t"'${COLOR_13}'",\n\t\t"'${COLOR_14}'",\n\t\t"'${COLOR_15}'",\n\t\t"'${COLOR_16}'"\n\t],\n\t"use-badge-color": false,\n\t"use-bold-color": false,\n\t"use-cursor-color": true,\n\t"use-highlight-color": false,\n\t"use-theme-colors": false\n}'
echo -e "$TILIXCOLORS" > "${scratchdir}/${PROFILE_NAME}.json"
# Note: Tilix does not store color scheme name in dconf
@ -313,8 +313,6 @@ elif [ "$TERMINAL" = "tilix" ]; then
if ((LOOP == OPTLENGTH)); then
cp -f "$scratchdir"/* "$HOME/.config/tilix/schemes/"
rm -rf "${scratchdir}"
PROFILE_KEY="$BASE_KEY_NEW/$DEFAULT_SLUG"
PROFILE_NAME=$($DCONF read $PROFILE_KEY/visible-name | tr -d "'")
read -r -p "All done - apply new theme? [y/N] " -n 1 TILIX_RES
if [[ ${TILIX_RES::1} =~ ^(y|Y)$ ]]; then
PROFILE_KEY="$BASE_KEY_NEW/$DEFAULT_SLUG"

11
gogh.sh
View File

@ -176,9 +176,9 @@ declare -a THEMES=(
cleanup() {
echo
echo "Caught signal..$? Cleaning up"
echo "Cleaning up"
rm -rf "$scratchdir"
unset TERMINAL TRUECOLOR LOOP OPTLENGTH
unset TERMINAL LOOP OPTLENGTH
echo "Done..."
exit 0
}
@ -318,17 +318,16 @@ fi
# | If terminal supports truecolor then we can show theme colors without applying the theme
# | ===========================================
if [[ "$COLORTERM" == "truecolor" ]] || [[ "$COLORTERM" == "24bit" ]]; then
# This function gets called in apply-colors.sh instead of gogh_colors
# This function gets called in apply-colors.sh
# Calls to gogh_colors has also been move to apply-colors.sh to avoid printing twice
function gogh_truecolor () {
echo
for c in {01..16}; do
local color="COLOR_$c"
set -- $(hexRGBtoDecRGB "${!color}")
echo -ne "\033[38;2;${1};${2};${3}m█████"
echo -ne "\033[38;2;${1};${2};${3}m█████\033[0m"
[[ "$c" == "08" ]] && echo # new line
done
echo
echo -e "\n\n"
}
export -f gogh_truecolor
fi