https://bugs.kde.org/show_bug.cgi?id=351175

--- Comment #27 from Duncan <1i5t5.dun...@cox.net> ---
(In reply to Duncan from comment #26)
> Script update: TLDR: Window selection.  Some limitations.

TLDR: Good news! The script is coming together; the window selection stuff is
nearly done, and I've found much better/easier matching/filtering than
size/position/geometry so that idea's killed now.

After an initial match on plasmashell plasmashell complete class to get the
initial window candidates (typically a dozen or two), matching on map-state
IsVisible (obviously only on first run each session) seems to eliminate most of
the candidate windows, and I'm further matching on window-manager hints for
window type Dock NOT Dialog.  Additionally, if pgrep (from the procps package,
should be core for most distros and thus already installed but it's optional)
is available, I'm matching the PID against the running plasmashell PID.  That
should eliminate any other strange windows that happen to match the other
elements but aren't owned by the running plasmashell, admittedly a remote
prospect given all the other matching I'm doing, but just in case.

Current deps are xwininfo and xdotool which will probably need installed, grep
and sed which are core and likely installed on most distros, and optionally,
pgrep, from the procps package, also core.  (While I mentioned it earlier, cut
from coreutils isn't currently a dep.)

Looks like the first run per session will do all the detection and set the
panel winIDs, saving them to a tempfile.  Visible (that is, mapped, IsVisible)
panels will be assumed on that first run and they won't be detected otherwise. 
Additional runs will grab the detected WinIDs from the tempfile and detect
current mapped state, toggling to unmapped if visible, toggling to
mapped/visible if unmapped.

Do note that there are ways to hide windows without unmapping them.  Simply
positioning them off-screen is a relevant example given that's what my first
experiments with wmctrl actually did.  So the IsVisible/UnMapped state I'm
actually testing for doesn't /always/ correlate to /actually/ visible/hidden. 
However, I don't believe that will be a major problem for us.

If plasmashell is restarted without clearing the tempfile the winIDs therein
will be stale, and I'll probably have the script auto-delete the tmpfile and
redetect if none of the listed winIDs appear to be actual windows.

While I've not tested multiple panels yet, I believe all panels will be
detected on a detection run, and hidden.  If new panels are created during a
session they won't be in the tmpfile and thus won't be affected until the next
session.  To deal with that I'll probably add a manual option to wipe the
tmpfile and redirect, else manually deleting the tmpfile should do the trick,
as long as existing panels are all mapped/visible, of course.  In the event the
tmpfile gets wiped with existing panels unmapped/hidden, restarting plasmashell
will probably be necessary to reset the state.

Unfortunately, due to plasmashell no longer filling in distinct window roles,
dealing with only some panels while ignoring others gets really complicated,
probably involving that fuzzy geometry stuff I'm avoiding by using other
detection logic.  The other method, of course, would involve having to point at
the ones you want managed on the first run each session, which would get old
real fast.  So the script will likely manage all plasmashell panels it can
detect (run it) or none (don't).

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to