From 5a32a7374b08bb4f3a5e1cfdb67875df1d572af1 Mon Sep 17 00:00:00 2001 From: Youssef Adnan Date: Sun, 22 Oct 2023 17:23:54 -0700 Subject: [PATCH] Theme update/build --- .github/workflows/main.yml | 10 +++- bin/meld | 4 +- osx/build_gtk_theme.sh | 29 +++++++++ osx/build_icon_theme.sh | 120 +++++++++++++++++++++++++++++++++++++ osx/settings.ini | 2 +- 5 files changed, 161 insertions(+), 4 deletions(-) create mode 100755 osx/build_gtk_theme.sh create mode 100755 osx/build_icon_theme.sh diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0b9e4d6aa..7d08b11e9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -61,4 +61,12 @@ jobs: - uses: actions/download-artifact@v3 - name: FIX gir run: | - cd osx && /bin/bash ./fix_gir.sh \ No newline at end of file + cd osx && /bin/bash ./fix_gir.sh + + - name: Install Icon Theme + run: | + cd osx && /bin/bash ./build_icon_theme.sh + + - name: Install GTK Theme + run: | + cd osx && /bin/bash ./build_gtk_theme.sh \ No newline at end of file diff --git a/bin/meld b/bin/meld index a413aace2..93e451ab8 100755 --- a/bin/meld +++ b/bin/meld @@ -47,9 +47,9 @@ if gtk_theme is None: from Foundation import NSUserDefaults standardUserDefaults = NSUserDefaults.standardUserDefaults() if standardUserDefaults.stringForKey_("AppleInterfaceStyle") == 'Dark': - os.environ['GTK_THEME'] = "Meld-Os-Catalina-gtk:dark" + os.environ['GTK_THEME'] = "WhiteSur-Dark-solid" else: - os.environ['GTK_THEME'] = "Meld-Os-Catalina-gtk:light" + os.environ['GTK_THEME'] = "WhiteSur-Light-solid" except: pass else: diff --git a/osx/build_gtk_theme.sh b/osx/build_gtk_theme.sh new file mode 100755 index 000000000..40c6af1ba --- /dev/null +++ b/osx/build_gtk_theme.sh @@ -0,0 +1,29 @@ +#!/bin/bash -x + +set -o nounset +set -o errexit +set -o functrace + +trap "exit" INT +failure() { + local lineno=$1 + local msg=$2 + echo "Failed at $lineno: $msg" +} +trap 'failure ${LINENO} "$BASH_COMMAND"' ERR + +export PATH=$HOME/.new_local/bin:$HOME/gtk/inst/bin:$PATH + +#FIXME: This theme is pretty big and can be significantly reduced in size for our need. Perhaps ask for volunteers. + +curl -LSs https://raw.githubusercontent.com/vinceliuice/WhiteSur-gtk-theme/master/release/WhiteSur-Light-solid.tar.xz -o $HOME/Source/WhiteSur-Light-solid.tar.xz +curl -LSs https://raw.githubusercontent.com/vinceliuice/WhiteSur-gtk-theme/master/release/WhiteSur-Dark-solid.tar.xz -o $HOME/Source/WhiteSur-Dark-solid.tar.xz + +(cd $HOME/Source && tar xf WhiteSur-Light-solid.tar.xz) +(cd $HOME/Source && tar xf WhiteSur-Dark-solid.tar.xz) + +cp -RP $HOME/Source/WhiteSur-Light-solid $HOME/gtk/inst/share/themes +cp -RP $HOME/Source/WhiteSur-Dark-solid $HOME/gtk/inst/share/themes + +cp $HOME/gtk/inst/share/themes/Mac/gtk-3.0/gtk-keys.css $HOME/Source/WhiteSur-Dark-solid/gtk-3.0/ +cp $HOME/gtk/inst/share/themes/Mac/gtk-3.0/gtk-keys.css $HOME/Source/WhiteSur-Light-solid/gtk-3.0/ \ No newline at end of file diff --git a/osx/build_icon_theme.sh b/osx/build_icon_theme.sh new file mode 100755 index 000000000..324db809f --- /dev/null +++ b/osx/build_icon_theme.sh @@ -0,0 +1,120 @@ +#!/bin/bash -x + +set -o nounset +set -o errexit +set -o functrace + +trap "exit" INT +failure() { + local lineno=$1 + local msg=$2 + echo "Failed at $lineno: $msg" +} +trap 'failure ${LINENO} "$BASH_COMMAND"' ERR + +export PATH=$HOME/.new_local/bin:$HOME/gtk/inst/bin:$PATH + +#FIXME: This theme is pretty big and can be significantly reduced in size for our need. Perhaps ask for volunteers. + +curl -LSs https://codeload.github.com/vinceliuice/WhiteSur-icon-theme/tar.gz/refs/tags/2023-07-03 -o $HOME/Source/WhiteSur-icon-theme-2023-07-03.tar.gz +(cd $HOME/Source && tar xf WhiteSur-icon-theme-2023-07-03.tar.gz) + +# Ths installer was never meant to install for macOS, so we have to craft our own version +# based on what's inside the installer shell script. +# This: +# ./install -d $HOME/gtk/inst/share/icons -n Meld-WhiteSur-Icons +# won't work for us.. + +# So the following is mostly based on install.sh that comes with the theme. + +SRC_DIR=$HOME/Source/WhiteSur-icon-theme-2023-07-03 +theme="" +color="-dark" + +THEME_NAME=Meld-WhiteSur-Icons +name=$THEME_NAME +THEME_DIR=$HOME/gtk/inst/share/icons/${THEME_NAME} +dest=$HOME/gtk/inst/share/icons +[[ -d ${THEME_DIR} ]] && rm -rf ${THEME_DIR} + +echo "Installing to '${THEME_DIR}'..." + +mkdir -p ${THEME_DIR} +cp -RP "${SRC_DIR}"/{COPYING,AUTHORS} ${THEME_DIR} +cp -RP "${SRC_DIR}"/src/index.theme ${THEME_DIR} + +#sed -i "s/WhiteSur/Meld-Icons/g" ${THEME_DIR}/index.theme + +mkdir -p ${THEME_DIR}/status +cp -RP "${SRC_DIR}"/src/{actions,animations,apps,categories,devices,emblems,mimes,places} ${THEME_DIR} +cp -RP "${SRC_DIR}"/src/status/{16,22,24,32,symbolic} ${THEME_DIR}/status + +cp -RP "${SRC_DIR}"/links/{actions,apps,categories,devices,emblems,mimes,places,status} ${THEME_DIR} + +if [[ ${theme} != '' ]]; then + cp -RP "${SRC_DIR}"/colors/color${theme}/*.svg ${THEME_DIR}/places/scalable +fi + +if [[ ${color} == '-dark' ]]; then + mkdir -p ${THEME_DIR}/{apps,categories,emblems,devices,mimes,places,status} + + cp -RP "${SRC_DIR}"/src/actions ${THEME_DIR} + cp -RP "${SRC_DIR}"/src/apps/symbolic ${THEME_DIR}/apps + cp -RP "${SRC_DIR}"/src/categories/symbolic ${THEME_DIR}/categories + cp -RP "${SRC_DIR}"/src/emblems/symbolic ${THEME_DIR}/emblems + cp -RP "${SRC_DIR}"/src/mimes/symbolic ${THEME_DIR}/mimes + cp -RP "${SRC_DIR}"/src/devices/{16,22,24,symbolic} ${THEME_DIR}/devices + cp -RP "${SRC_DIR}"/src/places/{16,22,24,symbolic} ${THEME_DIR}/places + cp -RP "${SRC_DIR}"/src/status/{16,22,24,symbolic} ${THEME_DIR}/status + + if [[ ${bold:-} == 'true' ]]; then + cp -RP "${SRC_DIR}"/bold/* ${THEME_DIR} + fi + + # if [[ $DESKTOP_SESSION == '/usr/share/xsessions/budgie-desktop' ]]; then + # cp -RP "${SRC_DIR}"/src/status/symbolic-budgie/*.svg ${THEME_DIR}/status/symbolic + # fi + + # Change icon color for dark theme + sed -i "s/#363636/#dedede/g" "${THEME_DIR}"/{actions,devices,places,status}/{16,22,24}/* || true + sed -i "s/#363636/#dedede/g" "${THEME_DIR}"/actions/32/* || true + sed -i "s/#363636/#dedede/g" "${THEME_DIR}"/{actions,apps,categories,emblems,devices,mimes,places,status}/symbolic/* "" || true + + cp -RP "${SRC_DIR}"/links/actions/{16,22,24,32,symbolic} ${THEME_DIR}/actions + cp -RP "${SRC_DIR}"/links/devices/{16,22,24,symbolic} ${THEME_DIR}/devices + cp -RP "${SRC_DIR}"/links/places/{16,22,24,symbolic} ${THEME_DIR}/places + cp -RP "${SRC_DIR}"/links/status/{16,22,24,symbolic} ${THEME_DIR}/status + cp -RP "${SRC_DIR}"/links/apps/symbolic ${THEME_DIR}/apps + cp -RP "${SRC_DIR}"/links/categories/symbolic ${THEME_DIR}/categories + cp -RP "${SRC_DIR}"/links/mimes/symbolic ${THEME_DIR}/mimes + + #TODO: Those are breaking.. Later though when we have some time.. + # cd ${dest} + # ln -s ../${name}${theme}/animations ${name}${theme}-dark/animations + # ln -s ../../${name}${theme}/categories/32 ${name}${theme}-dark/categories/32 + # ln -s ../../${name}${theme}/emblems/16 ${name}${theme}-dark/emblems/16 + # ln -s ../../${name}${theme}/emblems/22 ${name}${theme}-dark/emblems/22 + # ln -s ../../${name}${theme}/emblems/24 ${name}${theme}-dark/emblems/24 + # ln -s ../../${name}${theme}/mimes/16 ${name}${theme}-dark/mimes/16 + # ln -s ../../${name}${theme}/mimes/22 ${name}${theme}-dark/mimes/22 + # ln -s ../../${name}${theme}/mimes/scalable ${name}${theme}-dark/mimes/scalable + # ln -s ../../${name}${theme}/apps/scalable ${name}${theme}-dark/apps/scalable + # ln -s ../../${name}${theme}/devices/scalable ${name}${theme}-dark/devices/scalable + # ln -s ../../${name}${theme}/places/scalable ${name}${theme}-dark/places/scalable + # ln -s ../../${name}${theme}/status/32 ${name}${theme}-dark/status/32 +fi + +( + cd ${THEME_DIR} + ln -sf actions actions@2x + ln -sf animations animations@2x + ln -sf apps apps@2x + ln -sf categories categories@2x + ln -sf devices devices@2x + ln -sf emblems emblems@2x + ln -sf mimes mimes@2x + ln -sf places places@2x + ln -sf status status@2x +) + +gtk-update-icon-cache ${THEME_DIR} diff --git a/osx/settings.ini b/osx/settings.ini index bd14fc2b8..1cf8b24b0 100644 --- a/osx/settings.ini +++ b/osx/settings.ini @@ -1,5 +1,5 @@ [Settings] -gtk-icon-theme-name=MeldIcons +gtk-icon-theme-name=Meld-WhiteSur-Icons #gtk-font-name=System Font Regular10 #gtk-cursor-theme-name=Breeze_Amber #gtk-cursor-theme-size=0