From ef542815c461d64c86b425b5da45823567e06eb7 Mon Sep 17 00:00:00 2001 From: polemon Date: Tue, 19 Mar 2019 10:38:13 +0100 Subject: [PATCH 1/4] added xfce4-terminal --- apply-colors.sh | 72 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/apply-colors.sh b/apply-colors.sh index cc17c9f..0b5a180 100644 --- a/apply-colors.sh +++ b/apply-colors.sh @@ -522,6 +522,73 @@ appy_tilixschemes() { fi } +apply_xfce4-terminal() { + # XFCE4 terminal has no profiles, instead it uses color presets + SCHEMEDIR="${HOME}/.local/share/xfce4/terminal/colorschemes" + CONFFILE="${HOME}/.config/xfce4/terminal/terminalrc" + + if [[ ! (-w "${CONFFILE}") ]]; then + echo "ERROR: config file not present or not writeable!" + exit 1 + fi + + [[ -d "${SCHEMEDIR}" ]] || mkdir -p "${SCHEMEDIR}" + + F_NAME=${PROFILE_NAME// /-} + F_NAME=$(echo "${F_NAME}" | awk '{print tolower($0)}') + + FF_NAME="${SCHEMEDIR}/${F_NAME}.theme" + + touch "${FF_NAME}" + + L_COLORCURSOR="ColorCursor=${CURSOR_COLOR}" + L_COLORPALETTE="ColorPalette=${COLOR_01};${COLOR_02};${COLOR_03};${COLOR_04};${COLOR_05};${COLOR_06};${COLOR_07};${COLOR_08};${COLOR_09};${COLOR_10};${COLOR_11};${COLOR_12};${COLOR_13};${COLOR_14};${COLOR_15};${COLOR_16}" + + printf '%s\n' \ + "[Scheme]" \ + "Name=${PROFILE_NAME}" \ + "ColorForeground=${FOREGROUND_COLOR}" \ + "ColorBackground=${BACKGROUND_COLOR}" \ + "${L_COLORCURSOR}" \ + "${L_COLORPALETTE}" \ + "ColorCursorUseDefault=FALSE" > ${FF_NAME} + + # apply last theme in queue + # xfce4-terminal monitors its rc file and doesn't reference + # any of the themes in there. The color settings need to + # be written there directly. + if ((LOOP == OPTLENGTH)); then + if grep "^ColorPalette=" "${CONFFILE}"; then + sed -i -r -e "s/^ColorPalette=.*/${L_COLORPALETTE}/" "${CONFFILE}" + else + echo "${L_COLORPALETTE}" >> "${CONFFILE}" + fi + + if grep "^ColorCursor=" "${CONFFILE}"; then + sed -i -r -e "s/^ColorCursor=.*/${L_COLORCURSOR}/" "${CONFFILE}" + else + echo "${L_COLORCURSOR}" >> "${CONFFILE}" + fi + + if grep "^ColorForeground=" "${CONFFILE}"; then + sed -i -r -e "s/^ColorForeground=.*/ColorForeground=${FOREGROUND_COLOR}/" "${CONFFILE}" + else + echo "ColorForeground=${FOREGROUND_COLOR}" >> "${CONFFILE}" + fi + + if grep "^ColorBackground=" "${CONFFILE}"; then + sed -i -r -e "s/^ColorBackground=.*/ColorBackground=${BACKGROUND_COLOR}/" "${CONFFILE}" + else + echo "ColorBackground=${BACKGROUND_COLOR}" >> "${CONFFILE}" + fi + + if grep "^ColorCursorUseDefault=FALSE" "${CONFFILE}"; then + true + else + echo "ColorCursorUseDefault=FALSE" >> "${CONFFILE}" + fi + fi +} [[ -n "${UUIDGEN}" ]] && PROFILE_SLUG="$(uuidgen)" @@ -603,6 +670,10 @@ case "${TERMINAL}" in apply_gtk ;; + xfce4-terminal ) + apply_xfce4-terminal + ;; + * ) printf '%s\n' \ "Unsupported terminal!" \ @@ -615,6 +686,7 @@ case "${TERMINAL}" in " mate-terminal" \ " gnome-terminal" \ " tilix" \ + " xfce4-terminal" \ "" \ "If you believe you have recieved this message in error," \ "try manually setting \`TERMINAL', hint: ps -h -o comm -p \$PPID" From 873f6155395c610442c24a1c70c2d40011c42969 Mon Sep 17 00:00:00 2001 From: polemon Date: Tue, 19 Mar 2019 13:13:28 +0100 Subject: [PATCH 2/4] fixed minor naming issue and added more descriptive comments. Also silenced grep --- apply-colors.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/apply-colors.sh b/apply-colors.sh index 0b5a180..09413ef 100644 --- a/apply-colors.sh +++ b/apply-colors.sh @@ -535,6 +535,7 @@ apply_xfce4-terminal() { [[ -d "${SCHEMEDIR}" ]] || mkdir -p "${SCHEMEDIR}" F_NAME=${PROFILE_NAME// /-} + F_NAME=$(echo ${F_NAME} | tr -d ":()") F_NAME=$(echo "${F_NAME}" | awk '{print tolower($0)}') FF_NAME="${SCHEMEDIR}/${F_NAME}.theme" @@ -545,6 +546,8 @@ apply_xfce4-terminal() { L_COLORPALETTE="ColorPalette=${COLOR_01};${COLOR_02};${COLOR_03};${COLOR_04};${COLOR_05};${COLOR_06};${COLOR_07};${COLOR_08};${COLOR_09};${COLOR_10};${COLOR_11};${COLOR_12};${COLOR_13};${COLOR_14};${COLOR_15};${COLOR_16}" printf '%s\n' \ + "; Generated by Gogh" \ + "; https://mayccoll.github.io/Gogh" \ "[Scheme]" \ "Name=${PROFILE_NAME}" \ "ColorForeground=${FOREGROUND_COLOR}" \ @@ -558,31 +561,31 @@ apply_xfce4-terminal() { # any of the themes in there. The color settings need to # be written there directly. if ((LOOP == OPTLENGTH)); then - if grep "^ColorPalette=" "${CONFFILE}"; then + if grep -q "^ColorPalette=" "${CONFFILE}"; then sed -i -r -e "s/^ColorPalette=.*/${L_COLORPALETTE}/" "${CONFFILE}" else echo "${L_COLORPALETTE}" >> "${CONFFILE}" fi - if grep "^ColorCursor=" "${CONFFILE}"; then + if grep -q "^ColorCursor=" "${CONFFILE}"; then sed -i -r -e "s/^ColorCursor=.*/${L_COLORCURSOR}/" "${CONFFILE}" else echo "${L_COLORCURSOR}" >> "${CONFFILE}" fi - if grep "^ColorForeground=" "${CONFFILE}"; then + if grep -q "^ColorForeground=" "${CONFFILE}"; then sed -i -r -e "s/^ColorForeground=.*/ColorForeground=${FOREGROUND_COLOR}/" "${CONFFILE}" else echo "ColorForeground=${FOREGROUND_COLOR}" >> "${CONFFILE}" fi - if grep "^ColorBackground=" "${CONFFILE}"; then + if grep -q "^ColorBackground=" "${CONFFILE}"; then sed -i -r -e "s/^ColorBackground=.*/ColorBackground=${BACKGROUND_COLOR}/" "${CONFFILE}" else echo "ColorBackground=${BACKGROUND_COLOR}" >> "${CONFFILE}" fi - if grep "^ColorCursorUseDefault=FALSE" "${CONFFILE}"; then + if grep -q "^ColorCursorUseDefault=FALSE" "${CONFFILE}"; then true else echo "ColorCursorUseDefault=FALSE" >> "${CONFFILE}" From 03cf203c8c36c673b327b12ac81499ca8cd5bc0e Mon Sep 17 00:00:00 2001 From: polemon Date: Tue, 19 Mar 2019 18:53:30 +0100 Subject: [PATCH 3/4] ask if user want's to apply newsly installed themes --- apply-colors.sh | 62 +++++++++++++++++++++++++++++-------------------- 1 file changed, 37 insertions(+), 25 deletions(-) diff --git a/apply-colors.sh b/apply-colors.sh index 09413ef..1dfc0e0 100644 --- a/apply-colors.sh +++ b/apply-colors.sh @@ -561,36 +561,48 @@ apply_xfce4-terminal() { # any of the themes in there. The color settings need to # be written there directly. if ((LOOP == OPTLENGTH)); then - if grep -q "^ColorPalette=" "${CONFFILE}"; then - sed -i -r -e "s/^ColorPalette=.*/${L_COLORPALETTE}/" "${CONFFILE}" - else - echo "${L_COLORPALETTE}" >> "${CONFFILE}" - fi - - if grep -q "^ColorCursor=" "${CONFFILE}"; then - sed -i -r -e "s/^ColorCursor=.*/${L_COLORCURSOR}/" "${CONFFILE}" - else - echo "${L_COLORCURSOR}" >> "${CONFFILE}" - fi + read -r -p "All done - apply new theme? [y/N] " -n 1 XFCE4_APPLY_CURR_THEME + if [[ ${XFCE4_APPLY_CURR_THEME::1} =~ ^(y|Y)$ ]]; then + if grep -q "^ColorPalette=" "${CONFFILE}"; then + sed -i -r -e "s/^ColorPalette=.*/${L_COLORPALETTE}/" "${CONFFILE}" + else + echo "${L_COLORPALETTE}" >> "${CONFFILE}" + fi + + if grep -q "^ColorCursor=" "${CONFFILE}"; then + sed -i -r -e "s/^ColorCursor=.*/${L_COLORCURSOR}/" "${CONFFILE}" + else + echo "${L_COLORCURSOR}" >> "${CONFFILE}" + fi - if grep -q "^ColorForeground=" "${CONFFILE}"; then - sed -i -r -e "s/^ColorForeground=.*/ColorForeground=${FOREGROUND_COLOR}/" "${CONFFILE}" - else - echo "ColorForeground=${FOREGROUND_COLOR}" >> "${CONFFILE}" - fi + if grep -q "^ColorForeground=" "${CONFFILE}"; then + sed -i -r -e "s/^ColorForeground=.*/ColorForeground=${FOREGROUND_COLOR}/" "${CONFFILE}" + else + echo "ColorForeground=${FOREGROUND_COLOR}" >> "${CONFFILE}" + fi - if grep -q "^ColorBackground=" "${CONFFILE}"; then - sed -i -r -e "s/^ColorBackground=.*/ColorBackground=${BACKGROUND_COLOR}/" "${CONFFILE}" - else - echo "ColorBackground=${BACKGROUND_COLOR}" >> "${CONFFILE}" - fi + if grep -q "^ColorBackground=" "${CONFFILE}"; then + sed -i -r -e "s/^ColorBackground=.*/ColorBackground=${BACKGROUND_COLOR}/" "${CONFFILE}" + else + echo "ColorBackground=${BACKGROUND_COLOR}" >> "${CONFFILE}" + fi - if grep -q "^ColorCursorUseDefault=FALSE" "${CONFFILE}"; then - true - else - echo "ColorCursorUseDefault=FALSE" >> "${CONFFILE}" + if grep -q "^ColorCursorUseDefault=FALSE" "${CONFFILE}"; then + true + else + echo "ColorCursorUseDefault=FALSE" >> "${CONFFILE}" + fi fi fi + + unset SCHEMEDIR + unset CONFFILE + unset PROFILE_NAME + unset F_NAME + unset FF_NAME + unset L_COLORCURSOR + unset L_COLORPALETTE + exit 0 } [[ -n "${UUIDGEN}" ]] && PROFILE_SLUG="$(uuidgen)" From d8c7378ea88099cbcc40f1ab8ff28199d09f39c2 Mon Sep 17 00:00:00 2001 From: polemon Date: Wed, 20 Mar 2019 00:27:44 +0100 Subject: [PATCH 4/4] Fixed some errors in README, added XFCE4 Terminal there. --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index bc798d7..ae072bd 100644 --- a/README.md +++ b/README.md @@ -5,9 +5,9 @@ Gogh ## :small_orange_diamond: [Visit the Website](http://mayccoll.github.io/Gogh) :small_orange_diamond: -## Color Scheme for Gnome Terminal, Pantheon Terminal and Tilix +## Color Scheme for Gnome Terminal, Pantheon Terminal, Tilix, and XFCE4 Terminal -Color Schemes For Ubuntu, Linux Mint, Elementary OS and all distributions that use gnome terminal, Pantheon Terminal or Tilix, initially inspired by Elementary OS Luna. Also work on iTerm for macOS. You can check some themes [here...](https://mayccoll.github.io/Gogh/) +Color Schemes For Ubuntu, Linux Mint, Elementary OS and all distributions that use Gnome Terminal, Pantheon Terminal, Tilix, or XFCE4 Terminal; initially inspired by Elementary OS Luna. Also works on iTerm for macOS. You can check-out the themes [here...](https://mayccoll.github.io/Gogh/) ![elementary](https://raw.githubusercontent.com/Mayccoll/Gogh/master/images/demos/themes.gif) @@ -24,13 +24,13 @@ Color Schemes For Ubuntu, Linux Mint, Elementary OS and all distributions that u ## [Install](https://github.com/Mayccoll/Gogh/blob/master/content/install.md) -Just copy and paste One line command. +Just copy and paste this one-line command: ```bash $ bash -c "$(wget -qO- https://git.io/vQgMr)" ``` -or if you are a mac user +Or, if you are a Mac user: ```bash $ bash -c "$(curl -sLo- https://git.io/vQgMr)" @@ -46,7 +46,7 @@ or if you are a mac user ## [Themes](https://mayccoll.github.io/Gogh/) -We have lots of themes. Check them out! [Here...](https://mayccoll.github.io/Gogh/) +We have lots of themes. Check them out [Here...](https://mayccoll.github.io/Gogh/)!
@@ -56,7 +56,7 @@ We have lots of themes. Check them out! [Here...](https://mayccoll.github.io/Gog ## [How to](https://github.com/Mayccoll/Gogh/blob/master/content/howto.md) -If you want to create your own color scheme or contribute to the project. [Here...](https://github.com/Mayccoll/Gogh/blob/master/content/howto.md) +If you want to create your own color scheme or contribute to the project, [start here](https://github.com/Mayccoll/Gogh/blob/master/content/howto.md).