Skip to content

Commit

Permalink
Theme update/build
Browse files Browse the repository at this point in the history
  • Loading branch information
yousseb committed Oct 23, 2023
1 parent 7635b18 commit 5a32a73
Show file tree
Hide file tree
Showing 5 changed files with 161 additions and 4 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,12 @@ jobs:
- uses: actions/download-artifact@v3
- name: FIX gir
run: |
cd osx && /bin/bash ./fix_gir.sh
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
4 changes: 2 additions & 2 deletions bin/meld
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
29 changes: 29 additions & 0 deletions osx/build_gtk_theme.sh
Original file line number Diff line number Diff line change
@@ -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/
120 changes: 120 additions & 0 deletions osx/build_icon_theme.sh
Original file line number Diff line number Diff line change
@@ -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}
2 changes: 1 addition & 1 deletion osx/settings.ini
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 5a32a73

Please sign in to comment.