Sincerely,
s.
Note that a Window is an integer, specifically the window's XID.
cls
$ xprop -root _NET_ACTIVE_WINDOW
> _NET_ACTIVE_WINDOW(WINDOW): window id # 0x400050
or
$ xdotool getactivewindow
> 4194384
will work, as long as your wm supports and correctly sets _NET_ACTIVE_WINDOW
note that xdotool outputs the id as an int,
to get the same with xprop do something like:
$ xprop -root _NET_ACTIVE_WINDOW | cut -d# -f2 | xargs printf "%d\n"
> 4194384
some apps work with both formats, others require int
xwininfo can also give you the window id, and with -int it will be in int form.
--
*Ivan c00kiemon5ter V Kanakarakis *
To fix that, one must call (supposing c is
the Client that holds the current window) :
XChangeProperty(dpy, root, netatom[NetActiveWindow], XA_WINDOW,
32, PropModeReplace, (unsigned char*)&c->window, 1);
everytime the current window changes.
also one should delete the property if there is no active window
(either no window on the screen, or no window focused)
On 25/03/2012, Swiatoslaw Gal <swiatos...@univie.ac.at> wrote:
> ---------- From Ivan Kanakarakis 25-03-2012 at 15:20 ----------
>> if you don't want to write something of your own, then
>>
>> $ xprop -root _NET_ACTIVE_WINDOW
>> > _NET_ACTIVE_WINDOW(WINDOW): window id # 0x400050
>
> xprop -root shows me the values of the folowing fields:
> CUT_BUFFER0(STRING)
> WM_NAME(STRING)
> _NET_SUPPORTED(ATOM)
> ESETROOT_PMAP_ID(PIXMAP)
> _XROOTPMAP_ID(PIXMAP)
> RESOURCE_MANAGER(STRING)
> _XKB_RULES_NAMES(STRING)
> XFree86_VT(INTEGER)
> XFree86_DDC_EDID1_RAWDATA(INTEGER)
>
>> $ xdotool getactivewindow
> XGetWindowProperty[_NET_ACTIVE_WINDOW] failed (code=1)
> xdo_get_active_window reported an error
>
>> will work, as long as your wm supports and correctly sets
>> _NET_ACTIVE_WINDOW
> I assume that this is not the case.
> I am using dwm. Does it matter?
>
> s.
Attached is a patch which does that. It works for me.
If you want support for NetActiveWindow, you probably also want support
for NetClientList. The second patch implements that.
Andreas
Thanks, I applied both patches. Even though I really more and more hat
this whole EWMH cruft. Since there was basic EWMH support in dwm,
things became more unreadable...
Cheers,
Anselm
Then I start to feel guilty of my question.
I've got my answer, and I do not know if anyone really needs
_NET_WM_WINDOW_OPACITY to be handled by dwm.
Thank you for the answers anyway,
s.
Yes, this works fine (without any today's patches).
But the very first answer: XGetInputFocus was _exactly_
what I was looking for.
Is there a reason that a _window_manager_ provides EHWHMS...
whatever support? This can be done with an external program,
am I wrong?
s.
The reason why I wrote these patches was that external programs do not work
reliably without support from the WM. In particular "xdotool
getwindowfocus" is quite frustrating. See also the "xdotool" manpage
itself:
"getactivewindow: Output the current active window. This command is often
more reliable than getwindowfocus."
Apart from that I agree with Anselm that EWMH is a pain...
Andreas