action: add UnSnap action

Same untiling behavior as ToggleSnapToEdge/Region,
but unconditionally.

Co-authored-by: tokyo4j <hrak1529@gmail.com>
This commit is contained in:
Jens Peters 2024-09-21 15:54:30 +02:00 committed by Hiroaki Yamamoto
parent cb2e2c1016
commit 694c5a7469
2 changed files with 13 additions and 0 deletions

View file

@ -102,6 +102,7 @@ enum action_type {
ACTION_TYPE_GO_TO_DESKTOP,
ACTION_TYPE_TOGGLE_SNAP_TO_REGION,
ACTION_TYPE_SNAP_TO_REGION,
ACTION_TYPE_UNSNAP,
ACTION_TYPE_TOGGLE_KEYBINDS,
ACTION_TYPE_FOCUS_OUTPUT,
ACTION_TYPE_MOVE_TO_OUTPUT,
@ -165,6 +166,7 @@ const char *action_names[] = {
"GoToDesktop",
"ToggleSnapToRegion",
"SnapToRegion",
"UnSnap",
"ToggleKeybinds",
"FocusOutput",
"MoveToOutput",
@ -1169,6 +1171,13 @@ actions_run(struct view *activator, struct server *server,
wlr_log(WLR_ERROR, "Invalid SnapToRegion id: '%s'", region_name);
}
break;
case ACTION_TYPE_UNSNAP:
if (view && view->maximized == VIEW_AXIS_NONE && !view->fullscreen
&& view_is_tiled(view)) {
view_set_untiled(view);
view_apply_natural_geometry(view);
}
break;
case ACTION_TYPE_TOGGLE_KEYBINDS:
if (view) {
view_toggle_keybinds(view);