On Thursday 05 July 2018 02:42:51 pm Dr. Nikolaus Klepp wrote:
Am Donnerstag, 5. Juli 2018 schrieb Michael:
[...]
A) Would someone either show me what the command(s) would be to minimize
whatever is the top most window under the current mouse position. Or
point me at the right tool to be able to find it?
[...]
You could try "xdotool getactivewindow windowminimize".
Thanks Nik,
I so wanted this to work, but it doesn’t. It closes the active window not the
window under the mouse. I wasn’t able to find any other workaround (xdotool
seems to have a bug with non-active window usage).
Anyone know the ‘dcop’ or ‘kdesktop’ commands? Is there a GUI assist tool for
either?
Best,
Michael
#### The results of testing:
Further testing of xdotool shows that, while it does maintain consistent
[window] variable values across instances, it doesn’t report the correct
[window] or [window_id] for anything but the active window. Which kills
about all of it’s ability to be scripted. And subsequently to do about
anything with a random non-active window under the mouse.
The tell is that different [window] values ($WINDOW, $WINDOWFOCUS below) are
returned for the same window.
When the mouse is over, and clicked in, the currently active window (Konsole
shell) this:
#!/bin/bash
eval $(xdotool getmouselocation --shell)
echo "|$X,$Y|"
echo S: "|$SCREEN|"
echo W: "|$WINDOW|"
echo A1
xdotool selectwindow
echo A2
xdotool windowminimize --sync $WINDOW
echo B1
xdotool getwindowname $WINDOW
echo B2
xdotool getwindowname
echo C
# xdotool getwindowfocus
echo D
WINDOWFOCUS=`xdotool getwindowfocus -f`
echo WF: $WINDOWFOCUS
echo E
xdotool getwindowname $WINDOWFOCUS
echo F
xdotool getactivewindow
echo G
#windowunmap [options] [window_id=%1]
xdotool windowunmap window_id=$WINDOW
echo H
xdotool search --sync --onlyvisible --name ".*"
echo I
Results in:
|1233,467|
S: |0|
W: |23068904|
A1
23068904
A2
B1
B2
There are no windows in the stack
Invalid window '%1'
Usage: getwindowname [window=%1]
If no window is given, %1 is used. See WINDOW STACK in xdotool(1)
C
D
WF: 44040202
E
Shell - Konsole
F
44040202
G
X Error of failed request: BadWindow (invalid Window parameter)
Major opcode of failed request: 10 (X_UnmapWindow)
Resource id in failed request: 0x0
Serial number of failed request: 17
Current serial number in output stream: 19
H
926
23069862
23068879
23198258
{snip ~780 entires}
I
Ref:
http://manpages.ubuntu.com/manpages/trusty/man1/xdotool.1.html
####
I also tried these variations in the .xbindkeysrc file:
## Works, minimizes wrong window
#"xdotool getactivewindow windowminimize"
#"xdotool key super+space"
## Does nothing
#"xdotool keydown alt click 2 keyup alt"
#"xdotool getmouselocation windowminimize"
#"xdotool getmouselocation windowactivate windowminimize"
#"xdotool selectwindow windowactivate windowminimize"
#"xdotool selectwindow windowminimize"
#"xdotool click 1"
Oddly both 23068904 and 44040202 are contained in the ‘xdotool search’ output,
so my best guess is it’s a deeper bug within xdotool, especially since
the ‘selectwindow’ attempts didn’t even set the focus on, or activate, the
window under the mouse.