Skip to content

Commit 54ca77c

Browse files
authored
getmouselocation now updates the window stack. (#322)
This allows you to do 'getmouselocation windowactivate' for example, to activate the window the mouse is currently hovering over. Add docs about getmouselocation updating the window stack. Fixes #118
1 parent dd45db4 commit 54ca77c

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

cmd_getmouselocation.c

+5-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,11 @@ int cmd_getmouselocation(context_t *context) {
5252
xdotool_output(context, "%sSCREEN=%d", out_prefix, screen_num);
5353
xdotool_output(context, "%sWINDOW=%d", out_prefix, window);
5454
} else {
55-
xdotool_output(context, "x:%d y:%d screen:%d window:%ld", x, y, screen_num, window);
55+
/* only print if we're the last command */
56+
if (context->argc == 0) {
57+
xdotool_output(context, "x:%d y:%d screen:%d window:%ld", x, y, screen_num, window);
58+
}
59+
window_save(context, window);
5660
}
5761
return ret;
5862
}

xdotool.pod

+2
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,8 @@ Same as B<click>, except only a mouse up is sent.
260260
Outputs the x, y, screen, and window id of the mouse cursor. Screen numbers will
261261
be nonzero if you have multiple monitors and are not using Xinerama.
262262

263+
This command updates the window stack with the window id of the window directly underneath the mouse.
264+
263265
=over
264266

265267
=item B<--shell>

0 commit comments

Comments
 (0)