[ltp] [OT]: KDE hack: script to list and control windows?

Richard Neill linux-thinkpad@linux-thinkpad.org
Fri, 24 Feb 2006 00:10:32 +0000


Dear All,

I wonder whether anyone here knows the answer to the following?
I'm sorry it's slightly off topic - I already posted it to the KDE 
mailing list, but without success, and Google doesn't seem to have any 
answers either!

I'm trying to find some shell functions which will allow me to list 
windows and to maximise/minimise them.

This would either be done by X or perhaps DCOP. Does anything like the 
following (hypothetical functions) exist?

    xcontrol --list-windows
   			(returns list of window IDs with status)
    xcontrol --maximise-window WINDOW_ID
                         (maximises window $WINDOW_ID)
    xcontrol --minimise-window WINDOW_ID

or alternatively:

    dcop kicker getListOfWindows()
    dcop kicker maximiseWindow()
    dcop kicker minimiseWindow()


Also, is there any obvious way to convert between X's WINDOW_ID and the 
PID of the process?


Thanks for your help,

Richard




----------------------------------------------------------------

PROBLEM:

The new behaviour of the KDE "Show Desktop" button in KDE 3.5 is, in my 
view, a misfeature. Since it's clearly a by design and not a bug, I'm 
trying to hack up a script to replicate the old behaviour...

----------------------------------------------------------------

DESIRED BEHAVIOUR:

The old behaviour upto and including 3.3.x was as described by comment
#4 here: http://bugs.kde.org/show_bug.cgi?id=108899 - and I think much
better. Basically,

    (1) First press of Show desktop => All windows minimised
    (2) Second press => Revert to previous states.

    (3) BUT, if a window has been maximised from the taskbar
    between (1) and (2), then forget the previous states, and don't try
to toggle back into an undefined condition.

----------------------------------------------------------------

NEW ("Wrong") BEHAVIOUR:

The new behaviour is:

    (1) First press of Show desktop => All windows minimised
    (2) Second press => Revert to previous states.

    (3) If any window whatsoever is created, then (2) happens, and then
    the new window is placed on top.

----------------------------------------------------------------

RATIONALE:

I can see the rationale for this as "expose the desktop temporarily so
the user can access it to click on a file". But it's really annoying.

Consider:
     a)I create a couple of konqueror windows, maximised.
     b)I click on the "show desktop button"
     c)I right click an icon on the desktop and choose "Properties"
     d)I get the properties window I wanted, but to my great confusion
    (and irritation), the desktop at which I was looking is now obscured
by the konqueror windows which have suddenly re-maximised, and which I
didn't ask for!

----------------------------------------------------------------

POSSIBLE SOLUTION:

Anyway, I'm trying to find a way to list and control windows from the
shell. Either some X function, or some DCOP function would be ideal.
I'd expect something to exist like:

    dcop kicker getListOfWindows()
    dcop kicker maximiseWindow()
    dcop kicker minimiseWindow()

But I can't find them! kwin and panel don't seem to have anything
helpful either.  Neither does X (there's xprop, xwininfo and
xlsclients), but these are insufficient.

I found this thread, but it isn't sufficiently helpful.
http://www.kdedevelopers.org/node/905

I've spend several hours searching, but to no avail - perhaps someone
here could point me in the right way?


Thanks very much for your help,

Richard