-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
193 additions
and
54 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
/Polymain.iconset | ||
/Polymail.icns | ||
/Polymail.iconset |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
INKSCAPE=$(shell which inkscape) | ||
|
||
define print_header | ||
@echo | ||
@echo "==> $(1)" | ||
@echo | ||
endef | ||
|
||
define svg_to_png | ||
@$(INKSCAPE) -z -e $(CURDIR)/$1/$(2).png -w $(3) -h $(3) $(CURDIR)/$(4) 1>/dev/null | ||
@echo "convert $(4) to $(2).png" | ||
|
||
endef | ||
|
||
define convert | ||
$(call svg_to_png,$(1),icon_$(2)x$(2),$(2),$(3)) | ||
$(call svg_to_png,$(1),icon_$(2)x$(2)@2x,$(shell echo $$(($2*2))),$(3)) | ||
|
||
endef | ||
|
||
all: build install clean | ||
|
||
Polymail.icns: Polymail.iconset | ||
$(call print_header,"Create icon resource") | ||
rm -f Polymail.icns | ||
iconutil -c icns -o $@ $^ | ||
|
||
Polymail.iconset: | ||
$(call print_header,"Convert svg to pngs") | ||
mkdir -p $@ | ||
$(foreach size,16 32,$(call convert,$@,$(size),Icon64.svg)) | ||
$(foreach size,128 256 512,$(call convert,$@,$(size),Icon1024.svg)) | ||
|
||
build: clean Polymail.icns | ||
|
||
clean: | ||
rm -rf Polymail.iconset | ||
|
||
install: | ||
$(call print_header,"Install icns") | ||
./install.sh Polymail.icns | ||
|
||
.PHONY: all build clean install |
Binary file not shown.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Exit on errors | ||
set -o errexit | ||
set -o nounset | ||
|
||
# Constants | ||
URL=https://raw.githubusercontent.com/Greenek/polymail.icns/master/Polymail.icns | ||
|
||
# Check if operating system is supported | ||
if [[ $OSTYPE != "darwin"* ]]; then | ||
echo "This script requires OSX system to run." | ||
exit 1 | ||
fi | ||
|
||
# Check if Polymail.app is installed | ||
: ${POLYMAIL_PATH:="/Applications/Polymail.app"} | ||
|
||
if [ ! -d "$POLYMAIL_PATH" ]; then | ||
echo "Polymail.app not found." | ||
exit 1 | ||
fi | ||
|
||
# Initialize temporary files paths | ||
TMPICNS=$TMPDIR"Polymail.icns" | ||
TMPRSRC=$TMPDIR"icon.rsrc" | ||
|
||
if [ $# -eq 0 ]; then | ||
# Download icon file if path has not been passed in argument | ||
curl -L -o $TMPICNS $URL | ||
else | ||
cp -f $1 $TMPICNS | ||
fi | ||
|
||
# Add icon to image file | ||
sips -i $TMPICNS >> /dev/null | ||
|
||
# Take icon and put into a rsrc file | ||
DeRez -only icns $TMPICNS > $TMPRSRC | ||
|
||
# Apply the rsrc file | ||
SetFile -a C $POLYMAIL_PATH | ||
|
||
# Remove old resource | ||
rm -f $POLYMAIL_PATH/Icon? | ||
|
||
# Append icon resource | ||
Rez $TMPRSRC -o $POLYMAIL_PATH/$'Icon\r' | ||
SetFile -a V $POLYMAIL_PATH/Icon? | ||
|
||
# Clean | ||
rm $TMPRSRC $TMPICNS | ||
|
||
# Success output | ||
cat << EOF | ||
New icon for Polymail.app has been successfully installed. | ||
TO COMPLETE INSTALLATION: | ||
1) Restart application | ||
or | ||
2) Clear system icon cache | ||
sudo find /private/var/folders/ -name com.apple.dock.iconcache -exec rm {} \; | ||
sudo find /private/var/folders -name com.apple.iconservices -exec rm -rf {} \; | ||
killall Dock | ||
EOF |