Skip to contentSkip to conversation

gitk window icons

PATCH Applied Stephen Boyd 2 participants 4 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

cover gitk window icons

These two patches set the git logo, three red minus signs and three green plus signs below on a white background, as the window icon for gitk.

I found this first patch by Giuseppe posted to the mailing list a couple months ago. I've simply added a 32x32 icon in the second patch so that window managers can provide a slightly better looking icon when they need a bigger icon (ALT-TAB for example).

This logo is different than the logo used by git-gui. Do we want to use that logo instead?

Giuseppe Bilotta (1):
gitk: try to provide a window icon

Stephen Boyd (1):
gitk: provide a 32x32 window icon based on the git logo

 gitk |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)
#1 lore raw

PATCH 1/2 gitk: try to provide a window icon

From: Giuseppe Bilotta <[email protected]>

Try to set up a 16x16 Tk photo image (based on the git logo) and use it as window icon. Wrap the code in a catch because it may fail in earlier Tcl/Tk 8.4 releases that don't provide 'wm iconphoto'.

---
 gitk |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
gitk +20 -0
index 1773ae6..cfbb699 100755
@@ -10883,6 +10883,26 @@ set lserial 0
 set isworktree [expr {[exec git rev-parse --is-inside-work-tree] == "true"}]
 setcoords
 makewindow
+catch {
+	image create photo gitlogo      -width 16 -height 16
+
+	image create photo gitlogominus -width  4 -height  2
+	gitlogominus put #C00000 -to 0 0 4 2
+	gitlogo copy gitlogominus -to  1 5
+	gitlogo copy gitlogominus -to  6 5
+	gitlogo copy gitlogominus -to 11 5
+	image delete gitlogominus
+
+	image create photo gitlogoplus  -width  4 -height  4
+	gitlogoplus  put #008000 -to 1 0 3 4
+	gitlogoplus  put #008000 -to 0 1 4 3
+	gitlogo copy gitlogoplus  -to  1 9
+	gitlogo copy gitlogoplus  -to  6 9
+	gitlogo copy gitlogoplus  -to 11 9
+	image delete gitlogoplus
+
+	wm iconphoto . -default gitlogo
+}
 # wait for the window to become visible
 tkwait visibility .
 wm title . "[file tail $argv0]: [file tail [pwd]]"
Signature · 1 line
1.6.2
#2 lore raw

PATCH 2/2 gitk: provide a 32x32 window icon based on the git logo

---
 gitk |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
gitk +4 -1
index cfbb699..5a09eca 100755
@@ -10901,7 +10901,10 @@ catch {
 	gitlogo copy gitlogoplus  -to 11 9
 	image delete gitlogoplus
 
-	wm iconphoto . -default gitlogo
+	image create photo gitlogo32    -width 32 -height 32
+	gitlogo32 copy gitlogo -zoom 2 2
+
+	wm iconphoto . -default gitlogo gitlogo32
 }
 # wait for the window to become visible
 tkwait visibility .
Signature · 1 line
1.6.2
#3 lore raw
In reply to Stephen Boyd
Quoted 2 lines · Stephen Boyd

These two patches set the git logo, three red minus signs and three green plus signs below on a white background, as the window icon for gitk.

Thanks, applied. (I adjusted the indentation in both and wrote a brief commit message for the second.)

Paul.