Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement automatic precompilation of the theme #656

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions common/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,23 @@ endif # ENABLE_DARK

endif #!ENABLE_TRANSPARENCY


cd $(srcdir)/gtk-3.0/$(GNOME_VERSION) && cp -R \
compile-gresources.sh \
$(ithemedir)/gtk-3.0/compile-gresources.sh

cd $(srcdir)/gtk-3.0/$(GNOME_VERSION) && cp -R \
compile-gresources.sh \
$(ithemedarkdir)/gtk-3.0/compile-gresources.sh

cd $(srcdir)/gtk-3.0/$(GNOME_VERSION) && cp -R \
compile-gresources.sh \
$(ithemedarkerdir)/gtk-3.0/compile-gresources.sh

cd $(ithemedir)/gtk-3.0/ && ./compile-gresources.sh
cd $(ithemedarkdir)/gtk-3.0/ && ./compile-gresources.sh
cd $(ithemedarkerdir)/gtk-3.0/ && ./compile-gresources.sh

endif # ENABLE_GTK3


Expand Down
46 changes: 46 additions & 0 deletions common/gtk-3.0/3.20/compile-gresources.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/sh

# Setup
mv gtk.css gtk-main.css
mv gtk-dark.css gtk-main-dark.css


# Get processed assets lists
ls ./assets | sort > temp_asset_list.txt


# Build dynamic gresouce xml spec from css and assets
read -d '' RES_PART1 <<"EOF"
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gnome/arc-theme">
EOF
echo $RES_PART1 > gtk.gresource.xml


# Import as nodes the file assets
xargs -i echo '<file preprocess="to-pixdata">assets/{}</file>' >> gtk.gresource.xml < temp_asset_list.txt
rm -f temp_asset_list.txt


# Write the css file information to the template
read -d '' RES_PART2 <<"EOF"
<file>gtk-main.css</file>
<file>gtk-main-dark.css</file>
</gresource>
</gresources>
EOF
echo $RES_PART2 >> gtk.gresource.xml

# Compile the gresource file
glib-compile-resources gtk.gresource.xml
echo '@import url("resource:///org/gnome/arc-theme/gtk-main.css");' > gtk.css
echo '@import url("resource:///org/gnome/arc-theme/gtk-main-dark.css");' > gtk-dark.css


# Cleanup
rm -rf assets
rm -f gtk.gresource.xml
rm -f gtk-main.css
rm -f gtk-main-dark.css
rm -f compile-gresources.sh