From 997a7e4e5b591499e0d36826232c946bf77786b0 Mon Sep 17 00:00:00 2001 From: Droc Date: Mon, 2 Sep 2024 09:12:16 -0500 Subject: [PATCH] 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 --- docs/labwc-actions.5.scd | 12 ++++++++++++ src/action.c | 23 ++++++++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/docs/labwc-actions.5.scd b/docs/labwc-actions.5.scd index 6b9dfe8d..32a95312 100644 --- a/docs/labwc-actions.5.scd +++ b/docs/labwc-actions.5.scd @@ -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. +** + Similar to ToggleDecorations below but a single state + - Titlebar and borders + +** + Similar to ToggleDecorations below but a single state + - No titlebar or borders + +** + Similar to ToggleDecorations below but a single state + - Borders only + ** Toggle decorations of focused window. diff --git a/src/action.c b/src/action.c index 79008566..7aad9016 100644 --- a/src/action.c +++ b/src/action.c @@ -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;