Saving and restoring the pane widths is not helpful when running gitk under a tiling window manager. It often results in the second and third panes being pushed to the far right of the window at startup. This change adds a preference to disable the saving of window geometry -- i.e. window position, size, and pane widths. Signed-off-by: Rodney Lorrimar <dev@xxxxxxxxxxxx> --- gitk-git/gitk | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/gitk-git/gitk b/gitk-git/gitk index a14d7a16b..c3ef0e824 100755 --- a/gitk-git/gitk +++ b/gitk-git/gitk @@ -2857,6 +2857,7 @@ proc savestuff {w} { upvar #0 viewperm current_viewperm upvar #0 nextviewnum current_nextviewnum upvar #0 use_ttk current_use_ttk + upvar #0 geometry current_geometry if {$stuffsaved} return if {![winfo viewable .]} return @@ -2886,19 +2887,23 @@ proc savestuff {w} { } } - puts $f "set geometry(main) [wm geometry .]" - puts $f "set geometry(state) [wm state .]" - puts $f "set geometry(topwidth) [winfo width .tf]" - puts $f "set geometry(topheight) [winfo height .tf]" - if {$current_use_ttk} { - puts $f "set geometry(pwsash0) \"[.tf.histframe.pwclist sashpos 0] 1\"" - puts $f "set geometry(pwsash1) \"[.tf.histframe.pwclist sashpos 1] 1\"" - } else { - puts $f "set geometry(pwsash0) \"[.tf.histframe.pwclist sash coord 0]\"" - puts $f "set geometry(pwsash1) \"[.tf.histframe.pwclist sash coord 1]\"" + set savegeometry [expr {![info exists current_geometry(save)] || $current_geometry(save)}] + puts $f "set geometry(save) $savegeometry" + if {$savegeometry} { + puts $f "set geometry(main) [wm geometry .]" + puts $f "set geometry(state) [wm state .]" + puts $f "set geometry(topwidth) [winfo width .tf]" + puts $f "set geometry(topheight) [winfo height .tf]" + if {$current_use_ttk} { + puts $f "set geometry(pwsash0) \"[.tf.histframe.pwclist sashpos 0] 1\"" + puts $f "set geometry(pwsash1) \"[.tf.histframe.pwclist sashpos 1] 1\"" + } else { + puts $f "set geometry(pwsash0) \"[.tf.histframe.pwclist sash coord 0]\"" + puts $f "set geometry(pwsash1) \"[.tf.histframe.pwclist sash coord 1]\"" + } + puts $f "set geometry(botwidth) [winfo width .bleft]" + puts $f "set geometry(botheight) [winfo height .bleft]" } - puts $f "set geometry(botwidth) [winfo width .bleft]" - puts $f "set geometry(botheight) [winfo height .bleft]" array set view_save {} array set views {} @@ -11488,7 +11493,7 @@ proc create_prefs_page {w} { proc prefspage_general {notebook} { global NS maxwidth maxgraphpct showneartags showlocalchanges global tabstop limitdiffs autoselect autosellen extdifftool perfile_attrs - global hideremotes want_ttk have_ttk maxrefs + global hideremotes want_ttk have_ttk maxrefs geometry set page [create_prefs_page $notebook.general] @@ -11549,6 +11554,11 @@ proc prefspage_general {notebook} { ${NS}::label $page.ttk_note -text [mc "(currently unavailable)"] } grid x $page.want_ttk $page.ttk_note -sticky w + ${NS}::checkbutton $page.save_geometry -variable geometry(save) \ + -text [mc "Save/restore window geometry"] + ${NS}::label $page.save_geometry_note -text [mc "(disable for tiling WMs)"] + grid x $page.save_geometry $page.save_geometry_note -sticky w + return $page } -- 2.16.1