{"thread":{"id":"47753","subject":"[PATCH] gitk: Add option to not save window geometry","startedAt":"2018-02-04T12:36:22Z","lastAt":"2018-02-04T12:36:22Z","messageCount":1,"participants":["Rodney Lorrimar"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"338166","messageId":"87y3k99byj.fsf@rodney.id.au","threadId":"47753","inReplyTo":null,"subject":"[PATCH] gitk: Add option to not save window geometry","fromName":"Rodney Lorrimar","fromEmail":"dev@rodney.id.au","sentAt":"2018-02-04T12:27:32Z","receivedAt":"2018-02-04T12:36:22Z","isPatch":true,"sender":{"key":"dev@rodney.id.au","avatar":null},"body":"Saving and restoring the pane widths is not helpful when running gitk\nunder a tiling window manager. It often results in the second and\nthird panes being pushed to the far right of the window at startup.\n\nThis change adds a preference to disable the saving of window geometry\n-- i.e. window position, size, and pane widths.\n\nSigned-off-by: Rodney Lorrimar <dev@rodney.id.au>\n---\n gitk-git/gitk | 36 +++++++++++++++++++++++-------------\n 1 file changed, 23 insertions(+), 13 deletions(-)\n\ndiff --git a/gitk-git/gitk b/gitk-git/gitk\nindex a14d7a16b..c3ef0e824 100755\n--- a/gitk-git/gitk\n+++ b/gitk-git/gitk\n@@ -2857,6 +2857,7 @@ proc savestuff {w} {\n     upvar #0 viewperm current_viewperm\n     upvar #0 nextviewnum current_nextviewnum\n     upvar #0 use_ttk current_use_ttk\n+    upvar #0 geometry current_geometry\n \n     if {$stuffsaved} return\n     if {![winfo viewable .]} return\n@@ -2886,19 +2887,23 @@ proc savestuff {w} {\n \t    }\n \t}\n \n-\tputs $f \"set geometry(main) [wm geometry .]\"\n-\tputs $f \"set geometry(state) [wm state .]\"\n-\tputs $f \"set geometry(topwidth) [winfo width .tf]\"\n-\tputs $f \"set geometry(topheight) [winfo height .tf]\"\n-\tif {$current_use_ttk} {\n-\t    puts $f \"set geometry(pwsash0) \\\"[.tf.histframe.pwclist sashpos 0] 1\\\"\"\n-\t    puts $f \"set geometry(pwsash1) \\\"[.tf.histframe.pwclist sashpos 1] 1\\\"\"\n-\t} else {\n-\t    puts $f \"set geometry(pwsash0) \\\"[.tf.histframe.pwclist sash coord 0]\\\"\"\n-\t    puts $f \"set geometry(pwsash1) \\\"[.tf.histframe.pwclist sash coord 1]\\\"\"\n+\tset savegeometry [expr {![info exists current_geometry(save)] || $current_geometry(save)}]\n+\tputs $f \"set geometry(save) $savegeometry\"\n+\tif {$savegeometry} {\n+\t    puts $f \"set geometry(main) [wm geometry .]\"\n+\t    puts $f \"set geometry(state) [wm state .]\"\n+\t    puts $f \"set geometry(topwidth) [winfo width .tf]\"\n+\t    puts $f \"set geometry(topheight) [winfo height .tf]\"\n+\t    if {$current_use_ttk} {\n+\t\tputs $f \"set geometry(pwsash0) \\\"[.tf.histframe.pwclist sashpos 0] 1\\\"\"\n+\t\tputs $f \"set geometry(pwsash1) \\\"[.tf.histframe.pwclist sashpos 1] 1\\\"\"\n+\t    } else {\n+\t\tputs $f \"set geometry(pwsash0) \\\"[.tf.histframe.pwclist sash coord 0]\\\"\"\n+\t\tputs $f \"set geometry(pwsash1) \\\"[.tf.histframe.pwclist sash coord 1]\\\"\"\n+\t    }\n+\t    puts $f \"set geometry(botwidth) [winfo width .bleft]\"\n+\t    puts $f \"set geometry(botheight) [winfo height .bleft]\"\n \t}\n-\tputs $f \"set geometry(botwidth) [winfo width .bleft]\"\n-\tputs $f \"set geometry(botheight) [winfo height .bleft]\"\n \n \tarray set view_save {}\n \tarray set views {}\n@@ -11488,7 +11493,7 @@ proc create_prefs_page {w} {\n proc prefspage_general {notebook} {\n     global NS maxwidth maxgraphpct showneartags showlocalchanges\n     global tabstop limitdiffs autoselect autosellen extdifftool perfile_attrs\n-    global hideremotes want_ttk have_ttk maxrefs\n+    global hideremotes want_ttk have_ttk maxrefs geometry\n \n     set page [create_prefs_page $notebook.general]\n \n@@ -11549,6 +11554,11 @@ proc prefspage_general {notebook} {\n \t${NS}::label $page.ttk_note -text [mc \"(currently unavailable)\"]\n     }\n     grid x $page.want_ttk $page.ttk_note -sticky w\n+    ${NS}::checkbutton $page.save_geometry -variable geometry(save) \\\n+\t-text [mc \"Save/restore window geometry\"]\n+    ${NS}::label $page.save_geometry_note -text [mc \"(disable for tiling WMs)\"]\n+    grid x $page.save_geometry $page.save_geometry_note -sticky w\n+\n     return $page\n }\n \n-- \n2.16.1\n"}]}