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

Add HiDPI scaling support for high resolution displays #455

Closed
wants to merge 1 commit into from
Closed
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
64 changes: 45 additions & 19 deletions Makefile.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
PREFIX=@prefix@
HIDPI=@hidpi@
DESTDIR=
CC?=gcc
export

SUBDIRS := svgtopng

Expand All @@ -11,11 +13,16 @@ $(SUBDIRS):

install:
install -d $(DESTDIR)/$(PREFIX)/share/icons
cp -rf build/elementary-xfce $(DESTDIR)/$(PREFIX)/share/icons
cp -rf build/elementary-xfce-dark $(DESTDIR)/$(PREFIX)/share/icons
cp -rf build/elementary-xfce-darker $(DESTDIR)/$(PREFIX)/share/icons
cp -rf build/elementary-xfce-darkest $(DESTDIR)/$(PREFIX)/share/icons
@echo
@-if $(HIDPI); \
then \
cp -rf build/elementary-xfce-hidpi $(DESTDIR)/$(PREFIX)/share/icons; \
else \
cp -rf build/elementary-xfce $(DESTDIR)/$(PREFIX)/share/icons; \
cp -rf build/elementary-xfce-dark $(DESTDIR)/$(PREFIX)/share/icons; \
cp -rf build/elementary-xfce-darker $(DESTDIR)/$(PREFIX)/share/icons; \
cp -rf build/elementary-xfce-darkest $(DESTDIR)/$(PREFIX)/share/icons; \
fi
@echo The icon-theme cache has not yet been regenerated, which means your changes may not be visible yet. Please run 'make icon-caches' next.

uninstall:
Expand All @@ -31,26 +38,45 @@ icon-caches:
gtk-update-icon-cache -f $(DESTDIR)/$(PREFIX)/share/icons/elementary-xfce-darkest

test: builddir $(SUBDIRS)
chmod +x ./svgtopng/pngtheme.sh
@./svgtopng/pngtheme.sh build/elementary-xfce
@./svgtopng/pngtheme.sh build/elementary-xfce-dark
@./svgtopng/pngtheme.sh build/elementary-xfce-darker
@./svgtopng/pngtheme.sh build/elementary-xfce-darkest
@-if ! $(HIDPI); \
then \
chmod +x ./svgtopng/pngtheme.sh; \
./svgtopng/pngtheme.sh build/elementary-xfce; \
./svgtopng/pngtheme.sh build/elementary-xfce-dark; \
./svgtopng/pngtheme.sh build/elementary-xfce-darker; \
./svgtopng/pngtheme.sh build/elementary-xfce-darkest; \
fi
@echo Build finished, ready to run install!

build: test
@echo == Optimizing all icon pngs
@find build -type f -iname '*.png' | xargs optipng -strip all -silent
@-if ! $(HIDPI); \
then \
echo == Optimizing all icon pngs; \
find build -type f -iname '*.png' | xargs optipng -strip all -silent; \
fi

builddir:
mkdir -p build
mkdir -p build/elementary-xfce && cp -R elementary-xfce/. build/elementary-xfce
mkdir -p build/elementary-xfce-dark && cp -R elementary-xfce-dark/. build/elementary-xfce-dark
mkdir -p build/elementary-xfce-darker && cp -R elementary-xfce-darker/. build/elementary-xfce-darker
mkdir -p build/elementary-xfce-darkest && cp -R elementary-xfce-darkest/. build/elementary-xfce-darkest
rm build/elementary-xfce/AUTHORS && cp AUTHORS build/elementary-xfce
rm build/elementary-xfce/CONTRIBUTORS && cp CONTRIBUTORS build/elementary-xfce
rm build/elementary-xfce/LICENSE && cp LICENSE build/elementary-xfce
rm build/elementary-xfce/README.md && cp README.md build/elementary-xfce
@-if $(HIDPI); \
then \
mkdir -p build/elementary-xfce-hidpi && cp -R elementary-xfce/. build/elementary-xfce-hidpi; \
mv build/elementary-xfce-hidpi/index-hidpi.theme build/elementary-xfce-hidpi/index.theme; \
rm build/elementary-xfce-hidpi/AUTHORS && cp AUTHORS build/elementary-xfce-hidpi; \
rm build/elementary-xfce-hidpi/CONTRIBUTORS && cp CONTRIBUTORS build/elementary-xfce-hidpi; \
rm build/elementary-xfce-hidpi/LICENSE && cp LICENSE build/elementary-xfce-hidpi; \
rm build/elementary-xfce-hidpi/README.md && cp README.md build/elementary-xfce-hidpi; \
find build/elementary-xfce-hidpi -mindepth 1 -maxdepth 1 -type d -exec sh -c "ln -sr '{}' '{}'@2x" \; \
-exec sh -c "ln -sr '{}' '{}'@3x" \;; \
else \
mkdir -p build/elementary-xfce && cp -R elementary-xfce/. build/elementary-xfce; \
mkdir -p build/elementary-xfce-dark && cp -R elementary-xfce-dark/. build/elementary-xfce-dark; \
mkdir -p build/elementary-xfce-darker && cp -R elementary-xfce-darker/. build/elementary-xfce-darker; \
mkdir -p build/elementary-xfce-darkest && cp -R elementary-xfce-darkest/. build/elementary-xfce-darkest; \
rm build/elementary-xfce/AUTHORS && cp AUTHORS build/elementary-xfce; \
rm build/elementary-xfce/CONTRIBUTORS && cp CONTRIBUTORS build/elementary-xfce; \
rm build/elementary-xfce/LICENSE && cp LICENSE build/elementary-xfce; \
rm build/elementary-xfce/README.md && cp README.md build/elementary-xfce; \
fi

.PHONY: all $(SUBDIRS)

Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,6 @@ make icon-caches
make
sudo make install
sudo make icon-caches
```

HiDPI scaling is supported by using the `--hidpi` configure flag.
12 changes: 8 additions & 4 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

help () {
echo "Supported options are:"
echo " --help print this help and exit"
echo " --prefix=<path> specify installation prefix"
echo " default <path> is /usr/local"
echo " --help Print this help and exit"
echo " --prefix=<path> Specify installation prefix, default <path> is /usr/local"
echo " --hidpi Use SVG icons for 2-3x scaling, high resolution displays"
}

PREFIX="/usr/local"
HIDPI="false"
while [ $# -gt 0 ]; do
case $1 in
--help)
Expand All @@ -17,6 +18,9 @@ while [ $# -gt 0 ]; do
--prefix=*)
PREFIX=`echo $1 | sed 's/--prefix=//'`
;;
--hidpi)
HIDPI="true"
;;
*)
echo "Unknown option $1"
;;
Expand All @@ -25,5 +29,5 @@ while [ $# -gt 0 ]; do
done

echo "Creating Makefile..."
sed -e s,@prefix@,$PREFIX, Makefile.in > Makefile
sed -e s,@prefix@,$PREFIX, -e s,@hidpi@,$HIDPI, Makefile.in > Makefile
echo "Installation prefix is $PREFIX"
Loading
Loading