diff --git a/doc/xdo.1.txt b/doc/xdo.1.txt index 42ad8b5..f09810f 100644 --- a/doc/xdo.1.txt +++ b/doc/xdo.1.txt @@ -55,6 +55,9 @@ Actions *resize*:: Resize the window. +*reparent*:: + Reparent the window into the target (see *-t*). + *activate*:: Activate the window. @@ -111,7 +114,7 @@ When options are provided, the action applies to all the children of the root wi The window has the given wm name. *-t* 'WID':: - The target window for the *below* and *above* actions. + The target window for the *below*, *above* and *reparent* actions. *-p* 'PID':: The window has the given pid. diff --git a/xdo.c b/xdo.c index 3dc8813..fde5ca7 100644 --- a/xdo.c +++ b/xdo.c @@ -35,6 +35,8 @@ int main(int argc, char *argv[]) action = window_move; } else if (strcmp(argv[1], "resize") == 0) { action = window_resize; + } else if (strcmp(argv[1], "reparent") == 0) { + action = window_reparent; } else if (strcmp(argv[1], "close") == 0) { action = window_close; } else if (strcmp(argv[1], "kill") == 0) { @@ -452,6 +454,13 @@ void window_resize(xcb_window_t win) #undef SETGEOM +void window_reparent(xcb_window_t win) +{ + if (cfg.target == 0) + err("reparent requires target (-t) argument\n"); + xcb_reparent_window(dpy, win, cfg.target, 0, 0); +} + void window_activate(xcb_window_t win) { xcb_ewmh_request_change_active_window(ewmh, default_screen, win, XCB_EWMH_CLIENT_SOURCE_TYPE_OTHER, XCB_CURRENT_TIME, XCB_NONE); diff --git a/xdo.h b/xdo.h index bf0ff51..f80ef49 100644 --- a/xdo.h +++ b/xdo.h @@ -64,6 +64,7 @@ void window_above(xcb_window_t win); void window_below(xcb_window_t win); void window_move(xcb_window_t win); void window_resize(xcb_window_t win); +void window_reparent(xcb_window_t win); void window_activate(xcb_window_t win); void window_id(xcb_window_t win); void window_pid(xcb_window_t win);