Last active
January 2, 2021 13:56
-
-
Save polkaulfield/1e238ed96753c88fe197feff987645d3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
theme_path="./theme/" | |
overrides_path="./overrides/" | |
gresource_path="/usr/share/gnome-shell/gnome-shell-theme.gresource" | |
xml_name="gnome-shell-theme.gresource.xml" | |
gresource_name="gnome-shell-theme.gresource" | |
extract_gresource () { | |
for r in `gresource list $1`; do | |
r=${r#\/org\/gnome\/shell/} | |
if [ ! -d ${r%/*} ]; then | |
mkdir -p ${r%/*} | |
fi | |
done | |
for r in `gresource list $1`; do | |
gresource extract $1 $r >${r#\/org\/gnome\/shell/} | |
done | |
} | |
create_xml () { | |
xml='<?xml version="1.0" encoding="UTF-8"?> | |
<gresources> | |
<gresource prefix="/org/gnome/shell/theme">' | |
for path in `find $1 -type f | sed -e 's@^'$1'@@g'`; do | |
xml="$xml | |
<file>$path</file>" | |
done | |
xml="$xml | |
</gresource> | |
</gresources>" | |
echo "$xml" > "$1$2" | |
} | |
add_overrides() { | |
for f in $1*; do | |
cp -f $f "$theme_path" | |
done | |
} | |
[ -d "$theme_path" ] && rm -r "$theme_path" | |
extract_gresource "$gresource_path" | |
add_overrides "$overrides_path" "$theme_path" | |
create_xml "$theme_path" "$xml_name" | |
glib-compile-resources --sourcedir="$theme_path" --target "$gresource_name" "$theme_path$xml_name" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment