Add openbox style decoration actions

- Decorate, set full decorations, ie titlebar and border
- Undecorate, turn off all decorations
- Border, border only decoration, unaffected by keepBorder setting
This commit is contained in:
Droc 2024-09-02 09:12:16 -05:00
parent dda47a5e14
commit 997a7e4e5b
2 changed files with 34 additions and 1 deletions

View file

@ -134,6 +134,18 @@ Actions are used in menus and keyboard/mouse bindings.
windows that have client side decorations if it would increase the
amount of decoration. Default is no.
*<action name="Decorate" />*
Similar to ToggleDecorations below but a single state
- Titlebar and borders
*<action name="Undecorate" />*
Similar to ToggleDecorations below but a single state
- No titlebar or borders
*<action name="Border" />*
Similar to ToggleDecorations below but a single state
- Borders only
*<action name="ToggleDecorations" />*
Toggle decorations of focused window.

View file

@ -118,7 +118,10 @@ enum action_type {
ACTION_TYPE_TOGGLE_TABLET_MOUSE_EMULATION,
ACTION_TYPE_TOGGLE_MAGNIFY,
ACTION_TYPE_ZOOM_IN,
ACTION_TYPE_ZOOM_OUT
ACTION_TYPE_ZOOM_OUT,
ACTION_TYPE_DECORATE,
ACTION_TYPE_UNDECORATE,
ACTION_TYPE_BORDER
};
const char *action_names[] = {
@ -180,6 +183,9 @@ const char *action_names[] = {
"ToggleMagnify",
"ZoomIn",
"ZoomOut",
"Decorate",
"Undecorate",
"Border",
NULL
};
@ -1167,6 +1173,21 @@ actions_run(struct view *activator, struct server *server,
case ACTION_TYPE_ZOOM_OUT:
magnify_set_scale(server, MAGNIFY_DECREASE);
break;
case ACTION_TYPE_DECORATE:
if (view) {
view_set_ssd_mode(view, LAB_SSD_MODE_FULL);
}
break;
case ACTION_TYPE_UNDECORATE:
if (view) {
view_set_ssd_mode(view, LAB_SSD_MODE_NONE);
}
break;
case ACTION_TYPE_BORDER:
if (view) {
view_set_ssd_mode(view, LAB_SSD_MODE_BORDER);
}
break;
case ACTION_TYPE_INVALID:
wlr_log(WLR_ERROR, "Not executing unknown action");
break;