Skip to contentSkip to conversation

git-gui: fix blurry icon on macos taskbar

PATCH In review Kirill Gavrilov via GitGitGadget 3 participants 3 messages Jan 6, 2021 – Feb 2, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 git-gui: fix blurry icon on macos taskbar

From: Kirill Gavrilov <[email protected]>

Update git-gui.ico and git-gui.icns with bitmaps of higher resolution. Call "wm iconphoto" with images created from PNG bitmaps on macOS.

---
git-gui: Fix blurry icon on macOS taskbar

git-gui: fix blurry icon on macos taskbar

Update git-gui.ico and git-gui.icns with bitmaps of higher resolution. Call "wm iconphoto" with images created from PNG bitmaps on macOS.

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-941%2Fgkv311%2Fmaster-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-941/gkv311/master-v1
Pull-Request: https://github.com/git/git/pull/941

 git-gui/Makefile            |   5 +++
 git-gui/git-gui.sh          |   6 +++
 git-gui/lib/git-gui-128.png | Bin 0 -> 1671 bytes
 git-gui/lib/git-gui-16.png  | Bin 0 -> 360 bytes
 git-gui/lib/git-gui-256.png | Bin 0 -> 3438 bytes
 git-gui/lib/git-gui-32.png  | Bin 0 -> 564 bytes
 git-gui/lib/git-gui.ico     | Bin 3638 -> 146106 bytes
 git-gui/lib/git-gui.svg     |  79 ++++++++++++++++++++++++++++++++++++
 git-gui/macosx/git-gui.icns | Bin 28866 -> 53863 bytes
 9 files changed, 90 insertions(+)
 create mode 100644 git-gui/lib/git-gui-128.png
 create mode 100644 git-gui/lib/git-gui-16.png
 create mode 100644 git-gui/lib/git-gui-256.png
 create mode 100644 git-gui/lib/git-gui-32.png
 create mode 100644 git-gui/lib/git-gui.svg
git-gui/Makefile +5 -0
index 56c85a85c1e..3dcda42e0ee 100644
@@ -24,6 +24,11 @@ ALL_LIBFILES = $(wildcard lib/*.tcl)
 PRELOAD_FILES = lib/class.tcl
 NONTCL_LIBFILES = \
 	lib/git-gui.ico \
+	lib/git-gui.svg \
+	lib/git-gui-16.png \
+	lib/git-gui-32.png \
+	lib/git-gui-128.png \
+	lib/git-gui-256.png \
 	$(wildcard lib/win32_*.js) \
 #end NONTCL_LIBFILES
 
git-gui/git-gui.sh +6 -0
index 201524c34ed..1d933dbf5d3 100755
@@ -740,6 +740,12 @@ if {[is_Windows]} {
 	if {![info exists env(DISPLAY)]} {
 		set env(DISPLAY) :9999
 	}
+} elseif {[is_MacOSX]} {
+	image create photo gitlogo16  -format png -file "$oguilib/git-gui-16.png"
+	image create photo gitlogo32  -format png -file "$oguilib/git-gui-32.png"
+	image create photo gitlogo128 -format png -file "$oguilib/git-gui-128.png"
+	image create photo gitlogo256 -format png -file "$oguilib/git-gui-256.png"
+	wm iconphoto . -default gitlogo256 gitlogo128 gitlogo32 gitlogo16
 } else {
 	catch {
 		image create photo gitlogo -width 16 -height 16
git-gui/lib/git-gui-128.png new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..a17ecfa1f3ed2214d11af1b964b86a935c70fb79
GIT binary patch
git-gui/lib/git-gui-16.png new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..1bdbfb8ee70d07f7afbc1499fccc4b6d1fbc4884
GIT binary patch
git-gui/lib/git-gui-256.png new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..059d832af118ab57910590321789926819822995
GIT binary patch
git-gui/lib/git-gui-32.png new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..93ec72f02a97c210ddcb3bcd8e77166e8046f2f5
GIT binary patch
git-gui/lib/git-gui.ico binary +0 -0
index 334cfa5a1a59c320e86789ccf4ed3320584a0215..3d89dd570b072924d0dd89d62b453b0e106c21e4 100644
GIT binary patch
git-gui/lib/git-gui.svg new file +79 -0

79 lines not on this page · raw message

git-gui/macosx/git-gui.icns binary +0 -0
index 77d88a77a7669667335cf6fd5767c8b40f3ce6e7..74a67301305c7ecf564ac6b508cba226bd2fbc8d 100644
GIT binary patch

base-commit: 71ca53e8125e36efbda17293c50027d31681a41f

Signature · 1 line
gitgitgadget
#1 lore raw

Hi Kirill,

Thanks for the patch.

Quoted 39 lines · Kirill Gavrilov via GitGitGadget

From: Kirill Gavrilov <[email protected]>

Update git-gui.ico and git-gui.icns with bitmaps of higher resolution. Call "wm iconphoto" with images created from PNG bitmaps on macOS.

---
git-gui: Fix blurry icon on macOS taskbar

git-gui: fix blurry icon on macos taskbar

Update git-gui.ico and git-gui.icns with bitmaps of higher resolution. Call "wm iconphoto" with images created from PNG bitmaps on macOS.

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-941%2Fgkv311%2Fmaster-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-941/gkv311/master-v1
Pull-Request: https://github.com/git/git/pull/941

 git-gui/Makefile            |   5 +++
 git-gui/git-gui.sh          |   6 +++
 git-gui/lib/git-gui-128.png | Bin 0 -> 1671 bytes
 git-gui/lib/git-gui-16.png  | Bin 0 -> 360 bytes
 git-gui/lib/git-gui-256.png | Bin 0 -> 3438 bytes
 git-gui/lib/git-gui-32.png  | Bin 0 -> 564 bytes
 git-gui/lib/git-gui.ico     | Bin 3638 -> 146106 bytes
 git-gui/lib/git-gui.svg     |  79 ++++++++++++++++++++++++++++++++++++
 git-gui/macosx/git-gui.icns | Bin 28866 -> 53863 bytes
 9 files changed, 90 insertions(+)
 create mode 100644 git-gui/lib/git-gui-128.png
 create mode 100644 git-gui/lib/git-gui-16.png
 create mode 100644 git-gui/lib/git-gui-256.png
 create mode 100644 git-gui/lib/git-gui-32.png
 create mode 100644 git-gui/lib/git-gui.svg
git-gui/Makefile +0 -0
index 56c85a85c1e..3dcda42e0ee 100644

git-gui/Makefile ALL_LIBFILES = $(wildcard lib/*.tcl) · line 27

Quoted 4 lines
git-gui/Makefile +1 -0
@@ -24,6 +24,11 @@ ALL_LIBFILES = $(wildcard lib/*.tcl)
 PRELOAD_FILES = lib/class.tcl
 NONTCL_LIBFILES = \
 	lib/git-gui.ico \
+	lib/git-gui.svg \

I see that you are adding the svg but don't see it being used anywhere in the code. What is it used for?

Quoted 12 lines
git-gui/Makefile +4 -0
+	lib/git-gui-16.png \
+	lib/git-gui-32.png \
+	lib/git-gui-128.png \
+	lib/git-gui-256.png \
 	$(wildcard lib/win32_*.js) \
 #end NONTCL_LIBFILES
 
git-gui/git-gui.sh +0 -0
index 201524c34ed..1d933dbf5d3 100755

git-gui/git-gui.sh if {[is_Windows]} { · line 748

Quoted 9 lines
git-gui/git-gui.sh +6 -0
@@ -740,6 +740,12 @@ if {[is_Windows]} {
 	if {![info exists env(DISPLAY)]} {
 		set env(DISPLAY) :9999
 	}
+} elseif {[is_MacOSX]} {
+	image create photo gitlogo16  -format png -file "$oguilib/git-gui-16.png"
+	image create photo gitlogo32  -format png -file "$oguilib/git-gui-32.png"
+	image create photo gitlogo128 -format png -file "$oguilib/git-gui-128.png"
+	image create photo gitlogo256 -format png -file "$oguilib/git-gui-256.png"
+	wm iconphoto . -default gitlogo256 gitlogo128 gitlogo32 gitlogo16

Quoting the "wm" manpage:

wm iconphoto window ?-default? image1 ?image2 ...?
[...]

On Macintosh, the first image called is loaded into an OSX-native icon format, and becomes the application icon in dialogs, the Dock, and other contexts. At the script level the command will accept only the first image passed in the parameters as support for multiple sizes/resolutions on macOS is outside Tk's scope. Developers should use the largest icon they can support (preferably 512 pixels) to ensure smooth rendering on the Mac.

So gitlogo{128,32,16} are not needed for MacOS.

But since you've already went through the effort of preparing these images, how about making all these available on Windows and Linux as well? Will these platforms also benefit from these logos?

Quoted 1,077 lines
git-gui/git-gui.sh +0 -0
 } else {
 	catch {
 		image create photo gitlogo -width 16 -height 16
git-gui/lib/git-gui-128.png new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..a17ecfa1f3ed2214d11af1b964b86a935c70fb79
GIT binary patch
git-gui/lib/git-gui-16.png new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..1bdbfb8ee70d07f7afbc1499fccc4b6d1fbc4884
GIT binary patch
git-gui/lib/git-gui-256.png new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..059d832af118ab57910590321789926819822995
GIT binary patch
git-gui/lib/git-gui-32.png new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..93ec72f02a97c210ddcb3bcd8e77166e8046f2f5
GIT binary patch
git-gui/lib/git-gui.ico binary +0 -0
index 334cfa5a1a59c320e86789ccf4ed3320584a0215..3d89dd570b072924d0dd89d62b453b0e106c21e4 100644
GIT binary patch
git-gui/lib/git-gui.svg new file +79 -0
new file mode 100644
index 00000000000..81f26f7eeb4
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="128"
+   height="128"
+   viewBox="0 0 33.866666 33.866668"
+   version="1.1"
+   id="svg8"
+   inkscape:version="1.0 (4035a4fb49, 2020-05-01)"
+   sodipodi:docname="git-gui.svg"
+   inkscape:export-filename="git.png"
+   inkscape:export-xdpi="48.000004"
+   inkscape:export-ydpi="48.000004">
+  <defs
+     id="defs2" />
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="1.979899"
+     inkscape:cx="140.38309"
+     inkscape:cy="25.399948"
+     inkscape:document-units="mm"
+     inkscape:current-layer="layer1"
+     inkscape:document-rotation="0"
+     showgrid="false"
+     inkscape:window-width="1920"
+     inkscape:window-height="976"
+     inkscape:window-x="-8"
+     inkscape:window-y="181"
+     inkscape:window-maximized="1"
+     units="px" />
+  <metadata
+     id="metadata5">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title />
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1">
+    <g
+       id="g880"
+       transform="rotate(-90,17.030427,16.773863)">
+      <path
+         sodipodi:nodetypes="ccczcccccccczzcc"
+         id="path864"
+         d="m 11.525998,13.931424 h 3.641546 c 0,-2.111835 -2.49681,-5.568568 -7.3916727,-5.487377 -5.52876,0.09171 -7.61050601,4.897619 -7.61050601,8.455019 0,3.5574 1.56280201,8.466483 7.37664601,8.466483 1.984375,0 3.4645457,-0.812503 5.1115287,-2.230032 v 1.854184 h 2.514006 V 16.002763 H 8.2482393 v 3.040189 h 3.7454817 c 0,1.414101 -1.1487,3.275809 -3.8676517,3.356734 -2.718952,0.08093 -4.573283,-2.049155 -4.573283,-5.514807 0,-3.465652 1.546961,-5.559333 4.398482,-5.559333 2.9851557,0 3.5747297,1.70831 3.5747297,2.605878 z"
+         style="fill:#666666;fill-opacity:1;stroke:none;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
+      <rect
+         y="7.9879885"
+         x="16.637527"
+         height="17"
+         width="3.5"
+         id="rect866"
+         style="fill:#d8382d;fill-opacity:1;stroke:none;stroke-width:0.972763" />
+      <path
+         d="m 25.826632,7.9879911 v 6.7499759 h -4.24987 v 3.500046 h 4.24987 v 6.749976 h 3.500046 v -6.749976 h 4.24987 v -3.500046 h -4.24987 V 7.9879911 Z"
+         style="fill:#40bf4c;fill-opacity:1;stroke:none;stroke-width:0.969494"
+         id="rect868" />
+    </g>
+  </g>
+</svg>
git-gui/macosx/git-gui.icns binary +0 -0
index 77d88a77a7669667335cf6fd5767c8b40f3ce6e7..74a67301305c7ecf564ac6b508cba226bd2fbc8d 100644
GIT binary patch

base-commit: 71ca53e8125e36efbda17293c50027d31681a41f

Signature · 1 line
gitgitgadget
Signature · 2 lines
Regards,
Pratyush Yadav
#2 lore raw

Hello Pratyush,

Quoted 1 line

Ping. Do you plan to re-roll this patch with only a single PNG?

I have prepared a patch that uses a single PNG image and also checked it on Linux.
And then I've realized that PNG loader has been added to Tcl 8.6, so that version checks will be required for compatibility with older Tcl.

At the same time, macOS is shipped with an old Tcl 8.5 and binary installer for git from "git-osx-installer" project used system Tcl... And system Tcl has been broken with macOS Big Sur 11.1 update (it worked with macOS Big Sur 11.0) - that's why I've tested my patch with custom built Tcl 8.6.

Best regards,
Kirill