diff --git a/docs/labwc-actions.5.scd b/docs/labwc-actions.5.scd
index 097cd5c2..37af64bf 100644
--- a/docs/labwc-actions.5.scd
+++ b/docs/labwc-actions.5.scd
@@ -136,7 +136,12 @@ Actions are used in menus and keyboard/mouse bindings.
"both" (default), "horizontal", and "vertical".
**
- Maximize focused window. Supported directions are "both" (default),
+ Maximize focused window in the direction(s) specified. Supported
+ directions are "both" (default), "horizontal", and "vertical".
+
+**
+ Unmaximize focused window in the direction(s) specified and return it to
+ its pre-maximized dimensions. Supported directions are "both" (default),
"horizontal", and "vertical".
**
diff --git a/src/action.c b/src/action.c
index db2b7557..af00f210 100644
--- a/src/action.c
+++ b/src/action.c
@@ -78,6 +78,7 @@ enum action_type {
ACTION_TYPE_SHOW_MENU,
ACTION_TYPE_TOGGLE_MAXIMIZE,
ACTION_TYPE_MAXIMIZE,
+ ACTION_TYPE_UNMAXIMIZE,
ACTION_TYPE_TOGGLE_FULLSCREEN,
ACTION_TYPE_TOGGLE_DECORATIONS,
ACTION_TYPE_TOGGLE_ALWAYS_ON_TOP,
@@ -134,6 +135,7 @@ const char *action_names[] = {
"ShowMenu",
"ToggleMaximize",
"Maximize",
+ "UnMaximize",
"ToggleFullscreen",
"ToggleDecorations",
"ToggleAlwaysOnTop",
@@ -336,6 +338,7 @@ action_arg_from_xml_node(struct action *action, const char *nodename, const char
break;
case ACTION_TYPE_TOGGLE_MAXIMIZE:
case ACTION_TYPE_MAXIMIZE:
+ case ACTION_TYPE_UNMAXIMIZE:
if (!strcmp(argument, "direction")) {
enum view_axis axis = view_axis_parse(content);
if (axis == VIEW_AXIS_NONE) {
@@ -801,6 +804,14 @@ actions_run(struct view *activator, struct server *server,
/*store_natural_geometry*/ true);
}
break;
+ case ACTION_TYPE_UNMAXIMIZE:
+ if (view) {
+ enum view_axis axis = action_get_int(action,
+ "direction", VIEW_AXIS_BOTH);
+ view_maximize(view, view->maximized & ~axis,
+ /*store_natural_geometry*/ true);
+ }
+ break;
case ACTION_TYPE_TOGGLE_FULLSCREEN:
if (view) {
view_toggle_fullscreen(view);