You are not logged in.

#1 2008-11-27 02:51:27

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

How to get current window properties?

With just xprop you can click the current window of course, but how do you do this in a script?

I can't find anything in man xprop about the current window.

I also tried xdotool getactivewindow, but in some WMs it doesn't work.

Just the class of the currently active window is what I'm interested in BTW.

Offline

#2 2008-11-27 05:47:30

konni
Member
From: berlin
Registered: 2008-09-25
Posts: 99

Re: How to get current window properties?

frip provided a nice way to do this with a modified version of wmctrl, works with all WMs i used so far.

its in this thread http://bbs.archlinux.org/viewtopic.php?id=57202
and i re-uploaded the mod here: http://konni.giev.de/wmctrlmod.tar.bz2

Offline

#3 2008-11-27 16:52:05

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: How to get current window properties?

I tried it out, but wmctrl and this mod don't work with some WMs.

Offline

#4 2008-11-28 11:38:44

dr_te_z
Member
From: Zoetermeer, the Netherlands
Registered: 2006-12-06
Posts: 154

Re: How to get current window properties?

Not sure if this helps:
"xdpyinfo"generate a lot of  output. Perhaps you'll find what you need.


Somewhere between "too small" and "too large" lies the size that is just right.
- Scott Hayes

Offline

#5 2008-11-28 12:45:11

dav7
Member
From: Australia
Registered: 2008-02-08
Posts: 674

Re: How to get current window properties?

Meet "xprop -root _NET_ACTIVE_WINDOW". big_smile big_smile

To get its properties just trim up to the hexadecimal WID, and pass that to xprop or xwininfo and grep for whatever you want.

Those methods are quite slow though. I've done some Xlib work (although now I've been shown XCB I'm in a quandry since XCB is both faster and less documented mad) and some of this work included writing a panel-type thing. So I could knock up a simple Xlib app to get the properties you wanted, if you want.

-dav7

Last edited by dav7 (2008-11-28 12:47:58)


Windows was made for looking at success from a distance through a wall of oversimplicity. Linux removes the wall, so you can just walk up to success and make it your own.
--
Reinventing the wheel is fun. You get to redefine pi.

Offline

Board footer

Powered by FluxBB