Set tkinter top-level window to "always on visible workspace"

Chris Angelico rosuav at gmail.com
Mon Mar 28 18:05:51 EDT 2022


On Tue, 29 Mar 2022 at 09:04, Cameron Simpson <cs at cskk.id.au> wrote:
>
> On 29Mar2022 06:10, Chris Angelico <rosuav at gmail.com> wrote:
> >On Tue, 29 Mar 2022 at 06:08, Christian Gollwitzer <auriocus at gmx.de> wrote:
> >> Am 28.03.22 um 20:03 schrieb Chris Angelico:
> >> > Would you accept a solution that involves a subprocess call?
> >> >
> >> > wmctrl -ir {id} -b add,sticky
> >> >
> >> > Now, the only problem is... figuring out your window ID. Worst case,
> >> > parse wmctrl -lG to get that info, but it might be possible to get the
> >> > window ID from Tkinter itself.
> >>
> >> Sure: Call "winfo_id()" on the toplevel. You might want to reformat in
> >> it in hex format, which is the usual way to pass these IDs around. Tk
> >> actually returns it in hex format, but Tkinter reformats it as an integer.
> >>
> >
> >Ah sweet, there you go then. (As you can see, I don't use Tkinter
> >much.) I have no idea how wmctrl does its work,
>
> It sets properties on the window itself. A window manager can listen for
> such changes and honour the settings.
>

Yeah but what I mean is, I don't know how to replicate its behaviour.

Though I could, of course, just go read the source code. Sometimes it
turns out that it really isn't that hard to replicate (as I discovered
when I browsed the source code for "tail -F" recently - it's just a
couple of inotify calls, way simpler than I expected).

ChrisA


More information about the Python-list mailing list