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

[PATCHv2] gitk: Show the current view's name in the window title.

From
Marc Branchaud <marcnarc@xiplink.com>
Date
Apr 7, 2015, 15:51 UTC
Message-ID
<1428421911-20393-1-git-send-email-marcnarc@xiplink.com>
In-Reply-To
<20150406043711.GC31463@iris.ozlabs.ibm.com>

If the current view is the "Command line" view, show the command line arguments instead of the view name.

Signed-off-by: Marc Branchaud <marcnarc@xiplink.com>
---

This is v2 of my previous "Show the command-line revs in the window title" RFC patch. (I'm having trouble accessing gmane, or I'd include a link here.)

This version incorporates Paul's feedback (thanks!) and handles view properly.
		M.
 gitk | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/gitk b/gitk
index b859879..90419e3 100755
--- a/gitk
+++ b/gitk
@@ -4034,6 +4034,19 @@ proc shellsplit {str} {
     return $l
 }
 
+proc set_window_title {} {
+    global appname curview viewname vrevs
+    set rev [mc "All files"]
+    if {$curview ne 0} {
+	if {$viewname($curview) eq [mc "Command line"]} {
+	    set rev [string map {"--gitk-symmetric-diff-marker" "--merge"} $vrevs($curview)]
+	} else {
+	    set rev $viewname($curview)
+	}
+    }
+    wm title . "[reponame]: $rev - $appname"
+}
+
 # Code to implement multiple views
 
 proc newview {ishighlight} {
@@ -4510,6 +4523,7 @@ proc showview {n} {
     } elseif {$numcommits == 0} {
 	show_status [mc "No commits selected"]
     }
+    set_window_title
 }
 
 # Stuff relating to the highlighting facility
@@ -6650,6 +6664,7 @@ proc show_status {msg} {
     global canv fgcolor
 
     clear_display
+    set_window_title
     $canv create text 3 3 -anchor nw -text $msg -font mainfont \
 	-tags text -fill $fgcolor
 }
@@ -12393,7 +12408,7 @@ catch {
 }
 # wait for the window to become visible
 tkwait visibility .
-wm title . "[reponame] - $appname"
+set_window_title
 update
 readrefs
 
-- 
2.3.5
Previous: Paul MackerrasNext: Marc Branchaud
Message 5 of 12 in “Tweaking the gitk window title.”
  1. 0/2 Tweaking the gitk window title.Marc Branchaud, Jan 6, 2015
  2. 1/2 gitk: Rearrange window title to be more conventional.Marc Branchaud, Jan 6, 2015
  3. 2/2 gitk: Show the rev(s) the user specified on the command line in the window title.Marc Branchaud, Jan 6, 2015
  4. Paul MackerrasApr 6, 2015
  5. [PATCHv2] gitk: Show the current view's name in the window title.Marc Branchaud, Apr 7, 2015
  6. Marc BranchaudMay 4, 2015
  7. Paul MackerrasMay 17, 2015
  8. Marc BranchaudJan 26, 2015
  9. Marc BranchaudMar 2, 2015
  10. 1/2 gitk: Rearrange window title to be more conventional.Marc Branchaud, Mar 23, 2015
  11. 2/2 gitk: Show the rev(s) the user specified on the command line in the window title.Marc Branchaud, Mar 23, 2015
  12. Paul MackerrasApr 6, 2015

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.