Export to GitHub

semicomplete - issue #3

RFE: "getwindowfocus" switch to get the top-level parent of the focussed window


Posted on Jan 5, 2009 by Happy Rabbit

What steps will reproduce the problem? 1. start a gnome-terminal 2. run 'wid=xdotool getwindowfocus' 3. run 'xdotool windowmove $wid 200 200'

What is the expected output? What do you see instead?

The window should move to [200, 200]. it doesn't move at all. This appears to be because the returned wid is a subwindow, instead of the top-level gnome-terminal window...

xwininfo -root -tree -int output:

 57542037 "jmason@casper (pts/10)  - /nb": ("gnome-terminal"

"Gnome-terminal") 737 x457+5+49 +5+49 5 children: 57542049 "jmason@casper (pts/10) - /nb": () 722x434+15+23 +20+72 57542060 (has no name): () 15x434+0+23 +5+72 57542053 (has no name): () 737x23+0+0 +5+49 6 children: 57542059 (has no name): () 43x21+231+1 +236+50 57542058 (has no name): () 43x21+188+1 +193+50 57542057 (has no name): () 67x21+121+1 +126+50 57542056 (has no name): () 44x21+77+1 +82+50 57542055 (has no name): () 40x21+37+1 +42+50 57542054 (has no name): () 36x21+1+1 +6+50 57542040 (has no name): () 10x10+0+0 +5+49 57542038 (has no name): () 1x1+200+200 +205+249 <<<

the one highlighted with "<<<" is the wid that getwindowfocus returned. I can turn that into the correct wid using:

xwininfo -id 57542038 -tree -int

xwininfo: Window id: 57542038 (has no name)

Root window id: 139 (the root window) (has no name) Parent window id: 57542037 "jmason@casper (pts/10) - /nb" 0 children.

What version of the product are you using? On what operating system?

20080606-1, also 20080720, Ubuntu intrepid.

Please provide any additional information below.

Comment #1

Posted on Jan 5, 2009 by Happy Rabbit

oh. to be clear, I'm looking for either (a) a switch to automatically traverse the tree up to the nearest top-level window or (b) that to be the default behaviour of getwindowfocus. cheers ;)

Comment #2

Posted on Jan 26, 2009 by Happy Camel

Emacs has this problem, too, or something very similar.

I'll look into it. Thanks :)

Comment #3

Posted on Jan 26, 2009 by Happy Camel

From gnome-terminal:

% xdotool getwindowfocus 56623111 % echo $WINDOWID 56623153

gnome-terminal, xterm, and others, set the env var WINDOWID before launching shells and such.

Seems like the default behavior should be to pull the toplevel window, so I'll work on making this the default and, if necessary, provide a switch to use the current behavior.

Comment #4

Posted on Jan 26, 2009 by Happy Camel

Fixed:

% xwininfo -id $(./xdotool getwindowfocus) | grep 'Window id' xwininfo: Window id: 0x3600007 "zsh"

To get the old behavior, use 'getwindowfocus -f' % xwininfo -id $(./xdotool getwindowfocus -f) | grep 'Window id' xwininfo: Window id: 0x3600008 (has no name)

Comment #5

Posted on Jan 26, 2009 by Happy Camel

(No comment was entered for this change.)

Comment #6

Posted on Jan 26, 2009 by Happy Rabbit

thanks!

Status: Fixed

Labels:
Type-Defect Priority-Medium xdotool-20090126