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

Cameron Simpson cs at cskk.id.au
Sun Mar 27 18:07:49 EDT 2022


On 27Mar2022 16:23, Skip Montanaro <skip.montanaro at gmail.com> wrote:
>I have a tkinter app (Ubuntu/X11 env) whose main window should always be
>displayed on the currently visible workspace. Is there some way to set that
>attribute programmatically? I see that there is a tkinter.Wm class and that
>Toplevel widgets have a wm_attributes method, but haven't found any
>examples in the library doc or on the wider net which demonstrate control
>of this particular window manager interaction.

I fear not. That is normally a window manager-side control. So you might 
tell your window manager to keep that window on the main workspace. I 
might be wrong - there might be wm_attributes which are meant to request 
this behaviour (from the window manager), But I'm pretty sure when I was 
using FVWM I did this on the window manager side, saying "these apps 
should be on desktop N" and stuff like that.

>(I don't care about Windows
>or Mac, at least for the time being.)

I think this is window manager stuff on the Mac too, in that you can 
tell the desktop to put an app's windows on every desktop, of a specific 
desktop, or just wherever they get opened.

Hmm... Yeah, here's part of my FVWM config:

    Style "sticky"  Sticky
    Style "topsticky" UseStyle sticky, StaysOnTop, WindowListSkip
    Style "bottomsticky" UseStyle sticky, StaysOnBottom

    Style "X2x"             UseStyle topsticky
    Style "gkrellm"         UseStyle bottomsticky

which uses the application names to specify how the WM treats them. The 
two examples are gkrellm, a load monitor, to be always on the current 
workspace, below/behind everything else, and x2x to be on every 
workspace, above everything else. (X2x runs a 1-pixel-wide full height 
window at the edge of the display to notice the mouse hit that edge, and 
to take it and drive another X11 display - thus allowing one to slide 
the mouse from the primary display to the adjacent display run by 
another computer; see also x2vnc et al).

But alas, these are WM-side controls. But maybe the WM might know about 
and honour some wm_attributes? I have no knowledge there.

Cheers,
Cameron Simpson <cs at cskk.id.au>


More information about the Python-list mailing list