Context - Ubuntu 18.04.2 LTS Gnome-Shell 3.28.3 Perl 5.26.1 Tk 804.034
Goal - on starting a new Tk based GUI app session position the window($mw for reference) where the user last left it (implicit assumption that screen dimensions don't change between sessions)!
I encountered the following challenges in doing that:
1) - $mw->rooty not readily helpful as it reflects position after decoration & Ubuntu top task bar
2) - $mw->geometry return changes once $mw->withdraw
The code below demonstrates the issue - the results I get from running in my context are at the end of the code. My question relates to (2) and simply put is it a bug or am I missing/overlooking something?
As the app I am working on may see the window withrawn, raised, possibly moved, withdrawn ... ad nauseam I have yet to determine what complications ensure. So any 'better ways' gratefully accepted.
Changing starting pos("+10+0") to away from any potential complications with System task/activity bars still reflects the issue.

#!/usr/bin/perl use strict; use Tk; my $mw = MainWindow->new(-title=>'WTF'); $mw->geometry('+10+0'); $mw->overrideredirect(0); my $lab = $mw->Label(-text=>'This is a label in the MainWindow',-font= +>'fixed 24',-border=>0)->pack(-anchor=>'w'); $mw->update; $mw->protocol('WM_DELETE_WINDOW' => sub{printf "exit geometry=%s,rootx +=%d,rooty=%d;height:%.2f\n",$mw->geometry,$mw->rootx,$mw->rooty,$mw-> +height; Tk::exit}); printf "init geometry=%s,rootx=%d,rooty=%d;height:%.2f\n",$mw->geometr +y,$mw->rootx,$mw->rooty,$mw->height; $mw->withdraw; $mw->after(2000,sub{ $mw->state('normal'); return 1; } ); # MainLoop; exit(0); __END__ init geometry=497x32+10+0,rootx=10,rooty=57;height:32.00 exit geometry=497x32+0+19,rootx=10,rooty=57;height:32.00

In reply to Tk geometry unexpected return if window withdrawn and re-instated by WayneRas

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.