Move window relative to its current position. Positive value of x moves
it right, negative left. Positive value of y moves it down, negative up.
+*<action name="ToggleSnapToEdge" direction="value" />*++
*<action name="SnapToEdge" direction="value" />*
Resize window to fill half the output in the given direction. Supports
directions "left", "up", "right", "down" and "center".
+ ToggleSnapToEdge additionally toggles the active window between
+ tiled to the given direction and its untiled position.
+
+*<action name="ToggleSnapToRegion" region="value" />*++
*<action name="SnapToRegion" region="value" />*
Resize and move active window according to the given region.
+
+ ToggleSnapToRegion additionally toggles the active window between
+ tiled to the given region and its untiled position.
+
See labwc-config(5) for further information on how to define regions.
*<action name="NextWindow" />*++
ACTION_TYPE_EXECUTE,
ACTION_TYPE_EXIT,
ACTION_TYPE_MOVE_TO_EDGE,
+ ACTION_TYPE_TOGGLE_SNAP_TO_EDGE,
ACTION_TYPE_SNAP_TO_EDGE,
ACTION_TYPE_GROW_TO_EDGE,
ACTION_TYPE_SHRINK_TO_EDGE,
ACTION_TYPE_MOVE_RELATIVE,
ACTION_TYPE_SEND_TO_DESKTOP,
ACTION_TYPE_GO_TO_DESKTOP,
+ ACTION_TYPE_TOGGLE_SNAP_TO_REGION,
ACTION_TYPE_SNAP_TO_REGION,
ACTION_TYPE_TOGGLE_KEYBINDS,
ACTION_TYPE_FOCUS_OUTPUT,
"Execute",
"Exit",
"MoveToEdge",
+ "ToggleSnapToEdge",
"SnapToEdge",
"GrowToEdge",
"ShrinkToEdge",
"MoveRelative",
"SendToDesktop",
"GoToDesktop",
+ "ToggleSnapToRegion",
"SnapToRegion",
"ToggleKeybinds",
"FocusOutput",
goto cleanup;
}
/* Falls through */
+ case ACTION_TYPE_TOGGLE_SNAP_TO_EDGE:
case ACTION_TYPE_SNAP_TO_EDGE:
case ACTION_TYPE_GROW_TO_EDGE:
case ACTION_TYPE_SHRINK_TO_EDGE:
if (!strcmp(argument, "direction")) {
enum view_edge edge = view_edge_parse(content);
- if ((edge == VIEW_EDGE_CENTER && action->type != ACTION_TYPE_SNAP_TO_EDGE)
+ bool allow_center = action->type == ACTION_TYPE_TOGGLE_SNAP_TO_EDGE
+ || action->type == ACTION_TYPE_SNAP_TO_EDGE;
+ if ((edge == VIEW_EDGE_CENTER && !allow_center)
|| edge == VIEW_EDGE_INVALID) {
wlr_log(WLR_ERROR, "Invalid argument for action %s: '%s' (%s)",
action_names[action->type], argument, content);
goto cleanup;
}
break;
+ case ACTION_TYPE_TOGGLE_SNAP_TO_REGION:
case ACTION_TYPE_SNAP_TO_REGION:
if (!strcmp(argument, "region")) {
action_arg_add_str(action, argument, content);
arg_name = "command";
break;
case ACTION_TYPE_MOVE_TO_EDGE:
+ case ACTION_TYPE_TOGGLE_SNAP_TO_EDGE:
case ACTION_TYPE_SNAP_TO_EDGE:
case ACTION_TYPE_GROW_TO_EDGE:
case ACTION_TYPE_SHRINK_TO_EDGE:
case ACTION_TYPE_SEND_TO_DESKTOP:
arg_name = "to";
break;
+ case ACTION_TYPE_TOGGLE_SNAP_TO_REGION:
case ACTION_TYPE_SNAP_TO_REGION:
arg_name = "region";
break;
view_move_to_edge(view, edge, snap_to_windows);
}
break;
+ case ACTION_TYPE_TOGGLE_SNAP_TO_EDGE:
case ACTION_TYPE_SNAP_TO_EDGE:
if (view) {
/* Config parsing makes sure that direction is a valid direction */
enum view_edge edge = action_get_int(action, "direction", 0);
+ if (action->type == ACTION_TYPE_TOGGLE_SNAP_TO_EDGE
+ && view->maximized == VIEW_AXIS_NONE
+ && !view->fullscreen
+ && view_is_tiled(view)
+ && view->tiled == edge) {
+ view_set_untiled(view);
+ view_apply_natural_geometry(view);
+ break;
+ }
view_snap_to_edge(view, edge,
/*across_outputs*/ true,
/*store_natural_geometry*/ true);
}
view_constrain_size_to_that_of_usable_area(view);
break;
+ case ACTION_TYPE_TOGGLE_SNAP_TO_REGION:
case ACTION_TYPE_SNAP_TO_REGION:
if (!view) {
break;
const char *region_name = action_get_str(action, "region", NULL);
struct region *region = regions_from_name(region_name, output);
if (region) {
+ if (action->type == ACTION_TYPE_TOGGLE_SNAP_TO_REGION
+ && view->maximized == VIEW_AXIS_NONE
+ && !view->fullscreen
+ && view_is_tiled(view)
+ && view->tiled_region == region) {
+ view_set_untiled(view);
+ view_apply_natural_geometry(view);
+ break;
+ }
view_snap_to_region(view, region,
/*store_natural_geometry*/ true);
} else {