git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Stephen Boyd <bebarino@gmail.com>
Date
Mar 19, 2009, 08:54 UTC
Message-ID
<61242ff6c582f3b82b7ddf4db75bdad45f0a457e.1237451887.git.bebarino@gmail.com>
In-Reply-To
<cover.1237451887.git.bebarino@gmail.com>
From: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>

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'.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Signed-off-by: Stephen Boyd <bebarino@gmail.com>
---
 gitk |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/gitk b/gitk
index 1773ae6..cfbb699 100755
--- a/gitk
+++ b/gitk
@@ -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]]"
-- 
1.6.2
Previous: Stephen BoydNext: Stephen Boyd
Message 2 of 4 in “gitk window icons”
  1. 0/2 gitk window iconsStephen Boyd, Mar 19, 2009
  2. 1/2 gitk: try to provide a window iconStephen Boyd, Mar 19, 2009
  3. 2/2 gitk: provide a 32x32 window icon based on the git logoStephen Boyd, Mar 19, 2009
  4. Paul MackerrasMar 23, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.