From 9c158be1d8ce5822a8682aaeb1451fcef4c794d8 Mon Sep 17 00:00:00 2001 From: Yauhen Kirylau Date: Tue, 29 Jan 2019 21:44:54 +0100 Subject: [PATCH] Optional resvg support (#177) * feat(render_assets): optional support for resvg * refactor: rename MENU_BG to HDR_BG and MENU_FG to HDR_FG (and migrate old values on runtime) * fix(configure): allow to run if inkscape not installed but resvg does * feat(makefile): make optipng optional * fix symlinks after sedding * fix(configure): allow to run if inkscape not installed but resvg does - 2 * style: shellcheck all .sh files * fix(autogen.sh): remove redundant escaping * fix(*: makefile: rendersvg): use --zoom 2 to workaround --dpi problem --- autogen.sh | 5 +- change_color.sh | 81 +++++++++++++++++--------------- common/gtk-2.0/Makefile.am | 15 ++++++ common/gtk-3.0/_colors.scss.thpl | 36 +++++++------- common/gtk-3.0/common.am | 24 +++++++++- common/xfwm4/Makefile.am | 14 ++++++ configure.ac | 9 +++- 7 files changed, 124 insertions(+), 60 deletions(-) diff --git a/autogen.sh b/autogen.sh index 0e36e12..c05d820 100755 --- a/autogen.sh +++ b/autogen.sh @@ -3,11 +3,14 @@ test -z "$srcdir" && srcdir=$(dirname "$0") test -z "$srcdir" && srcdir=. +set -ue + cwd=$(pwd) cd "$srcdir" mkdir -p m4 -autoreconf --verbose --force --install || exit $? +autoreconf --verbose --force --install cd "$cwd" +# shellcheck disable=SC2068 "$srcdir/configure" $@ diff --git a/change_color.sh b/change_color.sh index d6b6fb3..282d3c4 100755 --- a/change_color.sh +++ b/change_color.sh @@ -23,7 +23,7 @@ print_usage() { echo echo "examples:" # shellcheck disable=SC2028 # This is meant to be usage text. - echo " $0 --output my-theme-name <(echo -e \"BG=d8d8d8\\nFG=101010\\nMENU_BG=3c3c3c\\nMENU_FG=e6e6e6\\nSEL_BG=ad7fa8\\nSEL_FG=ffffff\\nTXT_BG=ffffff\\nTXT_FG=1a1a1a\\nBTN_BG=f5f5f5\\nBTN_FG=111111\\n\")" + echo " $0 --output my-theme-name <(echo -e \"BG=d8d8d8\\nFG=101010\\nHDR_BG=3c3c3c\\nHDR_FG=e6e6e6\\nSEL_BG=ad7fa8\\nSEL_FG=ffffff\\nTXT_BG=ffffff\\nTXT_FG=1a1a1a\\nBTN_BG=f5f5f5\\nBTN_FG=111111\\n\")" echo " $0 ../colors/retro/twg" echo " $0 --autogen-opts '--disable-cinnamon --disable-gnome-shell' --jobs 4 ../colors/retro/clearlooks" exit 1 @@ -84,27 +84,31 @@ fi if [[ $(date +"%m%d") = "0401" ]] && grep -q "no-jokes" <<< "$*"; then echo -e "\\n\\nError patching uxtheme.dll\\n\\n" ACCENT_BG=000000 BG=C0C0C0 BTN_BG=C0C0C0 BTN_FG=000000 FG=000000 - HDR_BTN_BG=C0C0C0 HDR_BTN_FG=000000 MENU_BG=C0C0C0 - MENU_FG=000000 SEL_BG=000080 SEL_FG=FFFFFF TXT_BG=FFFFFF TXT_FG=000000 + HDR_BTN_BG=C0C0C0 HDR_BTN_FG=000000 HDR_BG=C0C0C0 + HDR_FG=000000 SEL_BG=000080 SEL_FG=FFFFFF TXT_BG=FFFFFF TXT_FG=000000 fi +# Migration: +HDR_BG=${HDR_BG-$MENU_BG} +HDR_FG=${HDR_FG-$MENU_FG} + ARC_TRANSPARENCY=$(tr '[:upper:]' '[:lower:]' <<< "${ARC_TRANSPARENCY-True}") ARC_WIDGET_BORDER_COLOR=${ARC_WIDGET_BORDER_COLOR-$(mix ${BG} ${FG} 0.75)} TXT_FG=$FG BTN_FG=$FG -HDR_BTN_FG=$MENU_FG +HDR_BTN_FG=$HDR_FG ACCENT_BG=${ACCENT_BG-$SEL_BG} HDR_BTN_BG=${HDR_BTN_BG-$BTN_BG} # Not implemented yet: HDR_BTN_FG=${HDR_BTN_FG-$BTN_FG} WM_BORDER_FOCUS=${WM_BORDER_FOCUS-$SEL_BG} -WM_BORDER_UNFOCUS=${WM_BORDER_UNFOCUS-$MENU_BG} +WM_BORDER_UNFOCUS=${WM_BORDER_UNFOCUS-$HDR_BG} SPACING=${SPACING-3} GRADIENT=${GRADIENT-0} ROUNDNESS=${ROUNDNESS-2} -ROUNDNESS_GTK2_HIDPI=$(( ROUNDNESS * 2 )) +#ROUNDNESS_GTK2_HIDPI=$(( ROUNDNESS * 2 )) TERMINAL_COLOR1=${TERMINAL_COLOR1:-F04A50} TERMINAL_COLOR3=${TERMINAL_COLOR3:-F08437} @@ -117,8 +121,8 @@ TERMINAL_COLOR12=${TERMINAL_COLOR12:-66BB6A} INACTIVE_FG=$(mix "$FG" "$BG" 0.75) INACTIVE_BG=$(mix "$BG" "$FG" 0.75) -INACTIVE_MENU_FG=$(mix "$MENU_FG" "$MENU_BG" 0.75) -INACTIVE_MENU_BG=$(mix "$MENU_BG" "$MENU_FG" 0.75) +INACTIVE_HDR_FG=$(mix "$HDR_FG" "$HDR_BG" 0.75) +INACTIVE_HDR_BG=$(mix "$HDR_BG" "$HDR_FG" 0.75) INACTIVE_TXT_MIX=$(mix "$TXT_FG" "$TXT_BG") INACTIVE_TXT_FG=$(mix "$TXT_FG" "$TXT_BG" 0.75) INACTIVE_TXT_BG=$(mix "$TXT_BG" "$BG" 0.75) @@ -160,9 +164,9 @@ for FILEPATH in "${PATHLIST[@]}"; do -e 's/#3b3e45/%TXT_FG%/gI' \ -e 's/#5294e2/%SEL_BG%/gI' \ -e 's/#fcfdfd/%BTN_BG%/gI' \ - -e 's/#e7e8eb/%MENU_BG%/gI' \ - -e 's/#2f343f/%MENU_BG%/gI' \ - -e 's/#D3DAE3/%MENU_FG%/gI' \ + -e 's/#e7e8eb/%HDR_BG%/gI' \ + -e 's/#2f343f/%HDR_BG%/gI' \ + -e 's/#D3DAE3/%HDR_FG%/gI' \ -e 's/#fbfcfc/%INACTIVE_BG%/gI' \ -e 's/#a9acb2/%INACTIVE_FG%/gI' \ -e 's/#e2e7ef/%BG_DARKER%/gI' \ @@ -172,7 +176,7 @@ for FILEPATH in "${PATHLIST[@]}"; do -e 's/#73d216/%TERMINAL_COLOR10%/gI' \ -e 's/#F27835/%TERMINAL_COLOR11%/gI' \ -e 's/#4DADD4/%TERMINAL_COLOR12%/gI' \ - -e 's/#353945/%MENU_BG2%/gI' \ + -e 's/#353945/%HDR_BG2%/gI' \ -e 's/Name=Arc/Name=%OUTPUT_THEME_NAME%/g' \ -e 's/#f46067/%TERMINAL_COLOR9%/gI' \ -e 's/#cc575d/%TERMINAL_COLOR9%/gI' \ @@ -180,21 +184,21 @@ for FILEPATH in "${PATHLIST[@]}"; do -e 's/#d7787d/%TERMINAL_COLOR9_LIGHTER%/gI' \ -e 's/#f13039/%TERMINAL_COLOR9_DARKER%/gI' \ -e 's/#be3841/%TERMINAL_COLOR9_DARKER%/gI' \ - -e 's/#F8F8F9/%MENU_FG%/gI' \ - -e 's/#fdfdfd/%MENU_FG%/gI' \ - -e 's/#454C5C/%MENU_FG%/gI' \ - -e 's/#D1D3DA/%MENU_FG%/gI' \ - -e 's/#90949E/%MENU_FG%/gI' \ - -e 's/#90939B/%MENU_FG%/gI' \ - -e 's/#B6B8C0/%INACTIVE_MENU_FG%/gI' \ - -e 's/#666A74/%INACTIVE_MENU_FG%/gI' \ - -e 's/#7A7F8B/%INACTIVE_MENU_FG%/gI' \ - -e 's/#C4C7CC/%INACTIVE_MENU_FG%/gI' \ - -e 's/#BAC3CF/%MENU_FG%/gI' \ + -e 's/#F8F8F9/%HDR_FG%/gI' \ + -e 's/#fdfdfd/%HDR_FG%/gI' \ + -e 's/#454C5C/%HDR_FG%/gI' \ + -e 's/#D1D3DA/%HDR_FG%/gI' \ + -e 's/#90949E/%HDR_FG%/gI' \ + -e 's/#90939B/%HDR_FG%/gI' \ + -e 's/#B6B8C0/%INACTIVE_HDR_FG%/gI' \ + -e 's/#666A74/%INACTIVE_HDR_FG%/gI' \ + -e 's/#7A7F8B/%INACTIVE_HDR_FG%/gI' \ + -e 's/#C4C7CC/%INACTIVE_HDR_FG%/gI' \ + -e 's/#BAC3CF/%HDR_FG%/gI' \ -e 's/#4B5162/%TXT_FG%/gI' \ - -e 's/#AFB8C5/%MENU_FG%/gI' \ - -e 's/#404552/%MENU_BG%/gI' \ - -e 's/#383C4A/%MENU_BG%/gI' \ + -e 's/#AFB8C5/%HDR_FG%/gI' \ + -e 's/#404552/%HDR_BG%/gI' \ + -e 's/#383C4A/%HDR_BG%/gI' \ -e 's/#5c616c/%FG%/gI' \ -e 's/#d3d8e2/%SEL_BG%/gI' \ -e 's/#b7c0d3/%SEL_BG%/gI' \ @@ -204,8 +208,8 @@ for FILEPATH in "${PATHLIST[@]}"; do -e 's/#eaebed/%INACTIVE_TXT_BG%/gI' \ -e 's/#b8babf/%INACTIVE_TXT_MIX%/gI' \ -e 's/#d3d4d8/%INACTIVE_TXT_FG%/gI' \ - -e 's/#d7d8dd/%MENU_BG2%/gI' \ - -e 's/#262932/%MENU_BG2%/gI' \ + -e 's/#d7d8dd/%HDR_BG2%/gI' \ + -e 's/#262932/%HDR_BG2%/gI' \ {} \; ; done @@ -214,7 +218,7 @@ done #-e 's/%WM_BORDER_FOCUS%/'"$WM_BORDER_FOCUS"'/g' \ #-e 's/%WM_BORDER_UNFOCUS%/'"$WM_BORDER_UNFOCUS"'/g' \ #-e 's/%SPACING%/'"$SPACING"'/g' \ - #-e 's/%INACTIVE_MENU_FG%/'"$INACTIVE_MENU_FG"'/g' \ + #-e 's/%INACTIVE_HDR_FG%/'"$INACTIVE_HDR_FG"'/g' \ #-e 's/#01A299/%ACCENT_BG%/g' \ #sed -i -e 's/^$material_radius: .px/$material_radius: '"$ROUNDNESS"'px/g' ./src/_sass/gtk/_variables.scss @@ -227,9 +231,10 @@ if [[ "${DEBUG:-}" ]]; then fi fi -for template_file in $(find ./common -name '*.thpl') ; do +while IFS= read -r -d '' template_file +do cat "${template_file}" >> "${template_file::-5}" -done +done < <(find ./common -name '*.thpl' -print0) ASSETS_FILES=( './common/gtk-2.0/light/assets.svg' @@ -253,9 +258,9 @@ for FILEPATH in "${PATHLIST[@]}"; do -e 's/%SEL_FG%/#'"$SEL_FG"'/g' \ -e 's/%TXT_BG%/#'"$TXT_BG"'/g' \ -e 's/%TXT_FG%/#'"$TXT_FG"'/g' \ - -e 's/%MENU_BG%/#'"$MENU_BG"'/g' \ - -e 's/%MENU_BG2%/#'"$(mix $MENU_BG $BG 0.85)"'/g' \ - -e 's/%MENU_FG%/#'"$MENU_FG"'/g' \ + -e 's/%HDR_BG%/#'"$HDR_BG"'/g' \ + -e 's/%HDR_BG2%/#'"$(mix $HDR_BG $BG 0.85)"'/g' \ + -e 's/%HDR_FG%/#'"$HDR_FG"'/g' \ -e 's/%BTN_BG%/#'"$BTN_BG"'/g' \ -e 's/%BTN_FG%/#'"$BTN_FG"'/g' \ -e 's/%HDR_BTN_BG%/#'"$HDR_BTN_BG"'/g' \ @@ -268,15 +273,15 @@ for FILEPATH in "${PATHLIST[@]}"; do -e 's/%INACTIVE_TXT_MIX%/#'"$INACTIVE_TXT_MIX"'/g' \ -e 's/%INACTIVE_TXT_FG%/#'"$INACTIVE_TXT_FG"'/g' \ -e 's/%INACTIVE_TXT_BG%/#'"$INACTIVE_TXT_BG"'/g' \ - -e 's/%INACTIVE_MENU_FG%/#'"$INACTIVE_MENU_FG"'/g' \ - -e 's/%INACTIVE_MENU_BG%/#'"$INACTIVE_MENU_BG"'/g' \ + -e 's/%INACTIVE_HDR_FG%/#'"$INACTIVE_HDR_FG"'/g' \ + -e 's/%INACTIVE_HDR_BG%/#'"$INACTIVE_HDR_BG"'/g' \ -e 's/%TERMINAL_COLOR1%/#'"$TERMINAL_COLOR1"'/g' \ -e 's/%TERMINAL_COLOR3%/#'"$TERMINAL_COLOR3"'/g' \ -e 's/%TERMINAL_COLOR4%/#'"$TERMINAL_COLOR4"'/g' \ -e 's/%TERMINAL_COLOR5%/#'"$TERMINAL_COLOR5"'/g' \ -e 's/%TERMINAL_COLOR9%/#'"$TERMINAL_COLOR9"'/g' \ - -e 's/%TERMINAL_COLOR9_DARKER%/#'"$(darker $TERMINAL_COLOR9 10)"'/g' \ - -e 's/%TERMINAL_COLOR9_LIGHTER%/#'"$(darker $TERMINAL_COLOR9 -10)"'/g' \ + -e 's/%TERMINAL_COLOR9_DARKER%/#'"$(darker "$TERMINAL_COLOR9" 10)"'/g' \ + -e 's/%TERMINAL_COLOR9_LIGHTER%/#'"$(darker "$TERMINAL_COLOR9" -10)"'/g' \ -e 's/%TERMINAL_COLOR10%/#'"$TERMINAL_COLOR10"'/g' \ -e 's/%TERMINAL_COLOR11%/#'"$TERMINAL_COLOR11"'/g' \ -e 's/%TERMINAL_COLOR12%/#'"$TERMINAL_COLOR12"'/g' \ diff --git a/common/gtk-2.0/Makefile.am b/common/gtk-2.0/Makefile.am index 069bc1d..dacff68 100644 --- a/common/gtk-2.0/Makefile.am +++ b/common/gtk-2.0/Makefile.am @@ -34,9 +34,24 @@ clean: $(light): $(srcdir)/light/assets.svg | light/assets $(dark): $(srcdir)/dark/assets.svg | dark/assets +if RENDERSVG + +$(light) $(dark): + $(RENDERSVG) --export-id "$(basename $(notdir $@))" --dpi $(if $(filter $(OPTION_GTK2_HIDPI),true),192,96) --zoom $(if $(filter $(OPTION_GTK2_HIDPI),true),2,1) "$<" "$@" +if OPTIPNG + $(OPTIPNG) -o7 --quiet "$@" +endif + +else + $(light) $(dark): $(INKSCAPE) --export-id-only --export-png="$@" --export-id="$(basename $(notdir $@))" --export-dpi=$(if $(filter $(OPTION_GTK2_HIDPI),true),192,96) "$<" >/dev/null +if OPTIPNG $(OPTIPNG) -o7 --quiet "$@" +endif + +endif + menubar-toolbar/%-dark.png: dark/assets/%.png | menubar-toolbar cp "$<" "$@" diff --git a/common/gtk-3.0/_colors.scss.thpl b/common/gtk-3.0/_colors.scss.thpl index e2f658a..7d492dc 100644 --- a/common/gtk-3.0/_colors.scss.thpl +++ b/common/gtk-3.0/_colors.scss.thpl @@ -5,13 +5,13 @@ @return scale-color($c, $alpha: percentage(-1 + $a)); } -$base_color: if($variant =='light', %TXT_BG%, %MENU_BG2%); +$base_color: if($variant =='light', %TXT_BG%, %HDR_BG2%); $base_bg_color: %BG%; // not implemented for GTK+2 theme: -//$text_color: if($variant == 'light', %TXT_FG%, %MENU_FG%); -$text_color: if($variant == 'light', %FG%, %MENU_FG%); -$bg_color: if($variant =='light', $base_bg_color, %MENU_BG%); -$fg_color: if($variant =='light', %FG%, %MENU_FG%); +//$text_color: if($variant == 'light', %TXT_FG%, %HDR_FG%); +$text_color: if($variant == 'light', %FG%, %HDR_FG%); +$bg_color: if($variant =='light', $base_bg_color, %HDR_BG%); +$fg_color: if($variant =='light', %FG%, %HDR_FG%); $selected_fg_color: %SEL_FG%; $selected_bg_color: %SEL_BG%; @@ -43,20 +43,20 @@ $insensitive_fg_color: if($variant == 'light', transparentize($fg_color, 0.45), $insensitive_bg_color: if($variant == 'light', mix($bg_color, $base_color, 40%), lighten($bg_color, 2%)); $header_bg: red; -@if $transparency=='true' and $variant=='light' { $header_bg: transparentize(%MENU_BG%, 0.05); } -@if $transparency=='false' and $variant=='light' { $header_bg: %MENU_BG%; } -@if $transparency=='true' and ($variant=='dark' or $darker=='true') { $header_bg: transparentize(%MENU_BG%, 0.03); } -@if $transparency=='false' and ($variant=='dark' or $darker=='true') { $header_bg: %MENU_BG%; } +@if $transparency=='true' and $variant=='light' { $header_bg: transparentize(%HDR_BG%, 0.05); } +@if $transparency=='false' and $variant=='light' { $header_bg: %HDR_BG%; } +@if $transparency=='true' and ($variant=='dark' or $darker=='true') { $header_bg: transparentize(%HDR_BG%, 0.03); } +@if $transparency=='false' and ($variant=='dark' or $darker=='true') { $header_bg: %HDR_BG%; } $header_bg_backdrop: if($darker == 'true' or $variant == 'dark', lighten($header_bg, 1.5%), lighten($header_bg, 3%)); $header_border: if($variant == 'light' and $darker=='false', darken($header_bg, 7%), darken($header_bg, 4%)); $header_fg: if($variant == 'light', saturate(transparentize($fg_color, 0.2), 10%), saturate(transparentize($fg_color, 0.2), 10%)); -$header_fg: if($darker == 'true', saturate(transparentize(%MENU_FG%, 0.2), 10%), $header_fg); +$header_fg: if($darker == 'true', saturate(transparentize(%HDR_FG%, 0.2), 10%), $header_fg); -$dark_sidebar_bg: if($transparency == 'true', transparentize(%MENU_BG2%, 0.05), %MENU_BG2%); -$dark_sidebar_fg: %MENU_FG%; +$dark_sidebar_bg: if($transparency == 'true', transparentize(%HDR_BG2%, 0.05), %HDR_BG2%); +$dark_sidebar_fg: %HDR_FG%; $dark_sidebar_border: if($variant == 'light', $dark_sidebar_bg, darken($dark_sidebar_bg, 5%)); $osd_fg_color: $dark_sidebar_fg; @@ -94,17 +94,17 @@ $wm_button_close_bg: if($variant == 'light' and $darker == 'false', %TERMINAL_CO $wm_button_close_hover_bg: if($variant == 'light' and $darker == 'false', %TERMINAL_COLOR9_LIGHTER%, %TERMINAL_COLOR9_LIGHTER%); $wm_button_close_active_bg: if($variant == 'light' and $darker == 'false', %TERMINAL_COLOR9_DARKER%, %TERMINAL_COLOR9_DARKER%); -$wm_icon_close_bg: if($variant == 'light' and $darker == 'false',%MENU_FG% , %MENU_BG%); +$wm_icon_close_bg: if($variant == 'light' and $darker == 'false',%HDR_FG% , %HDR_BG%); // Minimize, Maximize -$wm_button_hover_bg: if($variant == 'light' and $darker == 'false', %MENU_FG%, %MENU_FG%); +$wm_button_hover_bg: if($variant == 'light' and $darker == 'false', %HDR_FG%, %HDR_FG%); $wm_button_active_bg: $selected_bg_color; -$wm_button_hover_border: if($variant == 'light' and $darker == 'false', %MENU_FG%, %MENU_FG%); +$wm_button_hover_border: if($variant == 'light' and $darker == 'false', %HDR_FG%, %HDR_FG%); -$wm_icon_bg: if($variant == 'light' and $darker == 'false', %MENU_FG%, %MENU_FG%); -$wm_icon_unfocused_bg: if($variant == 'light' and $darker == 'false', %INACTIVE_MENU_FG%, %INACTIVE_MENU_FG%); -$wm_icon_hover_bg: if($variant == 'light' and $darker == 'false', %INACTIVE_MENU_FG%, %INACTIVE_MENU_FG%); +$wm_icon_bg: if($variant == 'light' and $darker == 'false', %HDR_FG%, %HDR_FG%); +$wm_icon_unfocused_bg: if($variant == 'light' and $darker == 'false', %INACTIVE_HDR_FG%, %INACTIVE_HDR_FG%); +$wm_icon_hover_bg: if($variant == 'light' and $darker == 'false', %INACTIVE_HDR_FG%, %INACTIVE_HDR_FG%); $wm_icon_active_bg: $selected_fg_color; /* vim: set ft=scss: */ diff --git a/common/gtk-3.0/common.am b/common/gtk-3.0/common.am index 9ecd171..c81aff5 100644 --- a/common/gtk-3.0/common.am +++ b/common/gtk-3.0/common.am @@ -13,13 +13,35 @@ assets light dark darker: clean: rm -rf assets/ light/ dark/ darker/ + +if RENDERSVG + +$(normal): $(srcdir)/assets.svg | assets + $(RENDERSVG) --export-id "$(basename $(notdir $@))" --dpi 96 "$<" "$@" +if OPTIPNG + $(OPTIPNG) -o7 --quiet "$@" +endif +$(hidpi): $(srcdir)/assets.svg | assets + $(RENDERSVG) --export-id "$(patsubst %@2,%,$(basename $(notdir $@)))" --dpi 192 --zoom 2 "$<" "$@" +if OPTIPNG + $(OPTIPNG) -o7 --quiet "$@" +endif + +else + $(normal): $(srcdir)/assets.svg | assets $(INKSCAPE) --export-id-only --export-png="$@" --export-id="$(basename $(notdir $@))" --export-dpi=96 "$<" >/dev/null +if OPTIPNG $(OPTIPNG) -o7 --quiet "$@" - +endif $(hidpi): $(srcdir)/assets.svg | assets $(INKSCAPE) --export-id-only --export-png="$@" --export-id="$(patsubst %@2,%,$(basename $(notdir $@)))" --export-dpi=192 "$<" >/dev/null +if OPTIPNG $(OPTIPNG) -o7 --quiet "$@" +endif + +endif + .PHONY: normal hidpi clean diff --git a/common/xfwm4/Makefile.am b/common/xfwm4/Makefile.am index d9fc77a..7eb6e10 100644 --- a/common/xfwm4/Makefile.am +++ b/common/xfwm4/Makefile.am @@ -16,9 +16,23 @@ clean: $(light): $(srcdir)/light/assets.svg | light/assets $(dark): $(srcdir)/dark/assets.svg | dark/assets +if RENDERSVG + +$(light) $(dark): + $(RENDERSVG) --export-id "$(basename $(notdir $@))" --dpi $(if $(filter $(OPTION_GTK2_HIDPI),true),192,96) "$<" "$@" +if OPTIPNG + $(OPTIPNG) -o7 --quiet "$@" +endif + +else + $(light) $(dark): $(INKSCAPE) --export-id-only --export-png="$@" --export-id="$(basename $(notdir $@))" --export-dpi=$(if $(filter $(OPTION_GTK2_HIDPI),true),192,96) "$<" >/dev/null +if OPTIPNG $(OPTIPNG) -o7 --quiet "$@" +endif + +endif .PHONY: light dark clean diff --git a/configure.ac b/configure.ac index f12970d..a75532a 100644 --- a/configure.ac +++ b/configure.ac @@ -41,10 +41,15 @@ AS_IF([test "x$ENABLE_GTK3" != xno], [ARC_GTK3]) AS_IF([test "x$ENABLE_GNOME_SHELL" != xno], [ARC_GNOME_SHELL]) AS_IF([test "x$ENABLE_GTK2" != xno -o "x$ENABLE_GTK3" != xno -o "x$ENABLE_XFWM" != xno], [ + AC_PATH_PROG([RENDERSVG], [rendersvg]) + AS_IF([test "x$ac_cv_path_RENDERSVG" = x], [AC_MSG_WARN([rendersvg not found, using inkscape instead])]) + AM_CONDITIONAL([RENDERSVG], [test ! "x$ac_cv_path_RENDERSVG" = x]) AC_PATH_PROG([INKSCAPE], [inkscape]) - AS_IF([test "x$ac_cv_path_INKSCAPE" = x], [AC_MSG_ERROR([inkscape not found])]) + AS_IF([test "x$ac_cv_path_INKSCAPE" = x -a "x$RENDERSVG" = x], [AC_MSG_ERROR([inkscape not found])]) + AM_CONDITIONAL([INKSCAPE], [test ! "x$ac_cv_path_INKSCAPE" = x]) AC_PATH_PROG([OPTIPNG], [optipng]) - AS_IF([test "x$ac_cv_path_OPTIPNG" = x], [AC_MSG_ERROR([optipng not found])]) + AS_IF([test "x$ac_cv_path_OPTIPNG" = x], [AC_MSG_WARN([optipng not found, PNG assets won't be optimized])]) + AM_CONDITIONAL([OPTIPNG], [test ! "x$ac_cv_path_OPTIPNG" = x]) ]) AS_IF([test "x$ENABLE_GTK3" != xno -o "x$ENABLE_CINNAMON" != xno -o "x$ENABLE_GNOME_SHELL" != xno], [