Re: Set tkinter top-level window to "always on visible workspace"
> Also, wmctrl accepts window names instead of ids if you omit the -i > option. In case winfo_id() is not returning the id you need. Nice. That worked. FWIW, Tk never gave me the very outermost window as the parent of the tkinter.Tk instance. Here's the start of hierarchy: % xwininfo -tree xwininfo: Please select the window about which you would like information by clicking the mouse in that window. xwininfo: Window id: 0x5a0001f "Typing Watcher" Root window id: 0x7a2 (the root window) (has no name) Parent window id: 0xc73880 (has no name) 1 child: 0x5a0001e (has no name): () 178x126+0+0 +2+43 1 child: 0x5a00020 (has no name): () 178x126+0+0 +2+43 5 children: ... Tk thought 0x5a0001e was the top, but as you can see 0x5a0001f is the named window. Calling wmctrl using "Typing Watcher" as the target window did the trick. Thanks, Skip -- https://mail.python.org/mailman/listinfo/python-list
Re: Set tkinter top-level window to "always on visible workspace"
On 29Mar2022 13:02, Cameron Simpson wrote: >On 28Mar2022 20:47, Skip Montanaro wrote: >>I'm struggling to get the outermost window (not sure what's going on), >>but >>I will keep messing around. > >See what xlsclients says to you. Also, wmctrl accepts window names instead of ids if you omit the -i option. In case winfo_id() is not returning the id you need. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list
Re: Set tkinter top-level window to "always on visible workspace"
On 28Mar2022 20:47, Skip Montanaro wrote: >I'm struggling to get the outermost window (not sure what's going on), >but >I will keep messing around. See what xlsclients says to you. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list
Re: Set tkinter top-level window to "always on visible workspace"
> Would you accept a solution that involves a subprocess call? > > wmctrl -ir {id} -b add,sticky I'm already checking idle time with xprintidle(1), so what's one more (one-time) subprocess call? Small amount of history, I'm referring to this mouse/typing watcher: https://github.com/smontanaro/python-bits/blob/master/src/watch.py I wrote this years and years ago when I first started having RSI problems. So long ago that I just deleted a commented out piece of code which was there in case I ever ran it with Python 1.4(!). Over the years I've needed it on Linux, Linux+WIndows, Mac, etc. I'd put it away for a couple years, then suffer a flare-up and pull it back out. I never thought I'd need it after I retired, but here I am again. I've tried all sorts of things to monitor mouse and keyboard activity. At the moment I'm just using a Linux laptop, so have tossed out any sort of attempted cross-platform tracking functionality. > 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. I'm struggling to get the outermost window (not sure what's going on), but I will keep messing around. Skip -- https://mail.python.org/mailman/listinfo/python-list
Re: Set tkinter top-level window to "always on visible workspace"
On 28Mar2022 19:39, Skip Montanaro wrote: >> I think you must be using xfce4, not fvwm4 (there's an fvwm3 in >> development). See https://xfce.org/ > >Both? [...] >1803 xfwm4 --replace >539426 xfwm4-settings [...] >1755 /usr/bin/ssh-agent /usr/bin/im-launch startxfce4 >1782 /usr/lib/x86_64-linux-gnu/xfce4/xfconf/xfconfd > >I kind of assume xfce4 is the session manager sort of thing, while >xfwm4 is the actual window manager. Sounds reasonable. I was more looking at your earlier "Now I use fvwm4" and pointing out that there is no fvwm4. These transcription issues brought to you by the letters W and M, and by the number 4. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list
Re: Set tkinter top-level window to "always on visible workspace"
> I think you must be using xfce4, not fvwm4 (there's an fvwm3 in > development). See https://xfce.org/ Both? % pgrep -fla xfwm4 1803 xfwm4 --replace 539426 xfwm4-settings % pgrep -fla xfce 1599 xfce4-session 1755 /usr/bin/ssh-agent /usr/bin/im-launch startxfce4 1782 /usr/lib/x86_64-linux-gnu/xfce4/xfconf/xfconfd ... I kind of assume xfce4 is the session manager sort of thing, while xfwm4 is the actual window manager. Skip -- https://mail.python.org/mailman/listinfo/python-list
Re: Set tkinter top-level window to "always on visible workspace"
On 28Mar2022 10:54, Skip Montanaro wrote: >I do have a ~/.config/xfce4/xfwm4/ >directory, but it is completely empty. On reflection, maybe you're running something else. "ps axf" FTW. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list
Re: Set tkinter top-level window to "always on visible workspace"
On 28Mar2022 10:54, Skip Montanaro wrote: >Unfortunately, I no longer recall what window manager(s) I used at the >time (probably twm or fvwm). Now I use fvwm4 and can't find squat >online about configuration files. I do have a ~/.config/xfce4/xfwm4/ >directory, but it is completely empty. I think you must be using xfce4, not fvwm4 (there's an fvwm3 in development). See https://xfce.org/ If I were using X11 I'd still be using fvwm2 or trying out 3, but my desktops have always be specially configured. Cheers, Cameron Simpson ... you could spend *all day* customizing the title bar. Believe me. I speak from experience. - Matt Welsh -- https://mail.python.org/mailman/listinfo/python-list
Re: Set tkinter top-level window to "always on visible workspace"
On Tue, 29 Mar 2022 at 09:04, Cameron Simpson wrote: > > On 29Mar2022 06:10, Chris Angelico wrote: > >On Tue, 29 Mar 2022 at 06:08, Christian Gollwitzer 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 -- https://mail.python.org/mailman/listinfo/python-list
Re: Set tkinter top-level window to "always on visible workspace"
On 29Mar2022 06:10, Chris Angelico wrote: >On Tue, 29 Mar 2022 at 06:08, Christian Gollwitzer 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. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list
Re: Set tkinter top-level window to "always on visible workspace"
On Tue, 29 Mar 2022 at 06:08, Christian Gollwitzer 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, but if calling on another process is viable, that's at least a fully automated way to stickify the window. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Set tkinter top-level window to "always on visible workspace"
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. Christian -- https://mail.python.org/mailman/listinfo/python-list
Re: Set tkinter top-level window to "always on visible workspace"
On Tue, 29 Mar 2022 at 02:56, Skip Montanaro wrote: > > > I might be misguided, but on modern desktops that should be possible > > with a few mouseclicks. E.g. in KDE, there is a little pin icon > > displayed in every title bar of a toplevel window on the left side. > > Correct, and that's what I'm currently doing. I'm lazy though. I want > the program to start always visible on the active virtual desktop. As > Cameron showed, this is possible. I have vague recollection of doing > this with the same program probably 15-20 years ago in an age when > window managers weren't largely configured with the mouse. > Unfortunately, I no longer recall what window manager(s) I used at the > time (probably twm or fvwm). Now I use fvwm4 and can't find squat > online about configuration files. I do have a ~/.config/xfce4/xfwm4/ > directory, but it is completely empty. > 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. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Set tkinter top-level window to "always on visible workspace"
> I might be misguided, but on modern desktops that should be possible > with a few mouseclicks. E.g. in KDE, there is a little pin icon > displayed in every title bar of a toplevel window on the left side. Correct, and that's what I'm currently doing. I'm lazy though. I want the program to start always visible on the active virtual desktop. As Cameron showed, this is possible. I have vague recollection of doing this with the same program probably 15-20 years ago in an age when window managers weren't largely configured with the mouse. Unfortunately, I no longer recall what window manager(s) I used at the time (probably twm or fvwm). Now I use fvwm4 and can't find squat online about configuration files. I do have a ~/.config/xfce4/xfwm4/ directory, but it is completely empty. Skip -- https://mail.python.org/mailman/listinfo/python-list
Re: Set tkinter top-level window to "always on visible workspace"
Am 28.03.22 um 00:55 schrieb Skip Montanaro: So you might tell your window manager to keep that window on the main workspace. Thanks. I'd forgotten about the possibility of doing this sort of thing in the window manager config. That would certainly be fine in this case. (It's been ages since I messed with this sort of thing.) I might be misguided, but on modern desktops that should be possible with a few mouseclicks. E.g. in KDE, there is a little pin icon displayed in every title bar of a toplevel window on the left side. If you click it, the window is shown on every workspace. There is also a way to set properties for a window permanently, by right-clicking on the title bar and then "enhanced attributes" (or similar, don't have KDE to check it roght now here) which gives a menu with multiple options to force the geometry. I don't know for GNOME desktop, but suspect it should be similarly easy. Christian -- https://mail.python.org/mailman/listinfo/python-list
Re: Set tkinter top-level window to "always on visible workspace"
> So you might tell your window manager to keep that window on the main workspace. Thanks. I'd forgotten about the possibility of doing this sort of thing in the window manager config. That would certainly be fine in this case. (It's been ages since I messed with this sort of thing.) Skip -- https://mail.python.org/mailman/listinfo/python-list
Re: Set tkinter top-level window to "always on visible workspace"
On 27Mar2022 16:23, Skip Montanaro 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 -- https://mail.python.org/mailman/listinfo/python-list
Set tkinter top-level window to "always on visible workspace"
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 don't care about Windows or Mac, at least for the time being.) Thx, Skip -- https://mail.python.org/mailman/listinfo/python-list