[openbox] [bit OT] Get focus window id?
    Sébastien 
    ml at terranean.eu
       
    Mon Oct 26 15:57:35 EDT 2015
    
    
  
le 2015-10-26, Ian écrivit:
>Is there a way to determine which window has the focus, from a script?
>I checked the old workhorse, wmctrl, but it doesn't seem capable of
>this.  There is the "-r :ACTIVE: " option, but it only works with the
>action subcommands, not with the listing.
xdotool to the rescue!
Returns some kind of window id (not sure what it is): 
$ xdotool getwindowfocus
Get the pid:
$ xdotool getwindowpid $(xdotool getwindowfocus)
Get the name of the program:
cat /proc/$(xdotool getwindowpid $(xdotool getwindowfocus))/comm
Hope this helps!
-- 
Sébastien
    
    
More information about the openbox
mailing list