diff --git a/docs/labwc-actions.5.scd b/docs/labwc-actions.5.scd
index 2af1f0bc..984f35f0 100644
--- a/docs/labwc-actions.5.scd
+++ b/docs/labwc-actions.5.scd
@@ -73,6 +73,13 @@ Actions are used in menus and keyboard/mouse bindings.
**
Move to position (x, y)
+**
+ Resize window
+
+ *width* The width to resize the window to in pixels.
+
+ *height* The height to resize the window to in pixels.
+
**
Move to be centered on cursor.
Tries to prevent any part of the window from going off-screen.
diff --git a/src/action.c b/src/action.c
index 07a52dd2..3a97efe4 100644
--- a/src/action.c
+++ b/src/action.c
@@ -88,6 +88,7 @@ enum action_type {
ACTION_TYPE_RESIZE,
ACTION_TYPE_RESIZE_RELATIVE,
ACTION_TYPE_MOVETO,
+ ACTION_TYPE_RESIZETO,
ACTION_TYPE_MOVETO_CURSOR,
ACTION_TYPE_MOVE_RELATIVE,
ACTION_TYPE_SEND_TO_DESKTOP,
@@ -131,6 +132,7 @@ const char *action_names[] = {
"Resize",
"ResizeRelative",
"MoveTo",
+ "ResizeTo",
"MoveToCursor",
"MoveRelative",
"SendToDesktop",
@@ -327,6 +329,12 @@ action_arg_from_xml_node(struct action *action, const char *nodename, const char
goto cleanup;
}
break;
+ case ACTION_TYPE_RESIZETO:
+ if (!strcmp(argument, "width") || !strcmp(argument, "height")) {
+ action_arg_add_int(action, argument, atoi(content));
+ goto cleanup;
+ }
+ break;
case ACTION_TYPE_SEND_TO_DESKTOP:
if (!strcmp(argument, "follow")) {
action_arg_add_bool(action, argument, parse_bool(content, true));
@@ -801,6 +809,25 @@ actions_run(struct view *activator, struct server *server,
view_move(view, x, y);
}
break;
+ case ACTION_TYPE_RESIZETO:
+ if (view) {
+ int width = action_get_int(action, "width", 0);
+ int height = action_get_int(action, "height", 0);
+
+ /*
+ * To support only setting one of width/height
+ * in
+ * we fall back to current dimension when unset.
+ */
+ struct wlr_box box = {
+ .x = view->pending.x,
+ .y = view->pending.y,
+ .width = width ? : view->pending.width,
+ .height = height ? : view->pending.height,
+ };
+ view_move_resize(view, box);
+ }
+ break;
case ACTION_TYPE_MOVE_RELATIVE:
if (view) {
int x = action_get_int(action, "x", 0);