Re: bash scripting fluxbox windows

Simon Bowden <[email protected]>
Newsgroups gmane.comp.window-managers.fluxbox.user
Message-ID <Pine.LNX.4.62.0505111924160.7051@ossicles.orchestra.cse.unsw.EDU.AU>
Hi,

I'd be happy to answer any specific "How can you do X" questions. Try here 
or in #fluxbox (I'm Rathnor).

Your question here is:
  * How to get the front-most window?
    - do you really want that, or do you want the current-focused window?

The best bet for most info is to access the EWMH hints, detailed here:
   http://standards.freedesktop.org/wm-spec/1.3/

If you want a hint and flux doesn't seem to support it now, then check 
with a developer and it may be simple to add.

Currently focused window:

  xprop -root _NET_ACTIVE_WINDOW | cut -d \# -f 2

Getting the top-most window is harder, especially on the current 
workspace. The bottom one is easier because xprop by default shows the 
first one in the list:

  xprop -root _NET_CLIENT_LIST_STACKING

To make it give you a list is a bit tricky... I managed to do it with:

xprop -root -f _NET_CLIENT_LIST_STACKING 32x ' =$0+\n' _NET_CLIENT_LIST_STACKING | cut -f2 -d=

Things that are this complicated are probably useful things for something 
like wmctrl to help with.

You can use the above list of windows - the highest is at the end. You may 
need to loop through them to find the highest one on the current 
workspace... this is why I hope you're wanting the current focused one 
instead.

Cheers,

  - Simon


On Wed, 11 May 2005, Darin Nelson wrote:

> Hi:
>
> I want to bind keys to more complex window actions than fluxbox's native 
> scripting facility allows. For example, I want a single key to move a window 
> rightward by one half of a screen, but wrap to the next workspace up if it is 
> already at the extreme edge of the screen.
>
> I managed to write a bash script that did this and a few similar things 
> --external scripting is possible with the right binaries to help. xwininfo 
> (part of the xorg.x11 distribution) and wmcntrl 
> (http://sweb.cz/tripie/utils/wmctrl/) can be used to gather window 
> information and then modify it, and fluxbox is reasonably gracious about 
> accepting the modifications.
>
> However, in my hands, getting some important information using these tools 
> requires hideous acrobatics. For example, the only way I've found to figure 
> out which window is frontmost is to use xtrapin to fake a keypress that 
> fluxbox has bound to a MoveUp 1 command. Fluxbox knows what's frontmost, so 
> it moves the correct window, then my script has to check again to see what 
> moved.
>
> Discovering some other useful information, like which windows are minimized, 
> is currently beyond my grasp.
>
> Does fluxbox export window information like this more directly? If so how do 
> I get at it? Has anyone had better success with external scripting of 
> fluxbox?
>
> --Darin
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by Oracle Space Sweepstakes
> Want to be the first software developer in space?
> Enter now for the Oracle Space Sweepstakes!
> http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click
> _______________________________________________
> Fluxbox-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/fluxbox-users
>


-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.