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

Skip Montanaro skip.montanaro at gmail.com
Mon Mar 28 21:47:17 EDT 2022


> 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


More information about the Python-list mailing list