diff --git a/docs/labwc-actions.5.scd b/docs/labwc-actions.5.scd index 4e76407e..5d725023 100644 --- a/docs/labwc-actions.5.scd +++ b/docs/labwc-actions.5.scd @@ -117,7 +117,7 @@ Actions are used in menus and keyboard/mouse bindings. upper-left corner of the window associated with the action. Default is yes. -** +** Toggle decorations of focused window. This is a 3-state action which can be executed multiple times: @@ -125,15 +125,19 @@ Actions are used in menus and keyboard/mouse bindings. - Remaining decorations will be disabled - Decorations will be shown normally - By disabling the theme configuration 'keepBorder' the first step - will be removed and the action only toggles between on and off. + *keepBorder* [yes|no] If set to no, the first step will be removed and + the action only toggles between on and off. Default is the theme + configuration of the same name. ** Enable decorations of focused window. -** +** Disable decorations of focused window. + *keepBorder* [yes|no] Keep a small border (and resize area) around the + window. Default is the theme configuration of the same name. + ** Toggle fullscreen state of focused window. diff --git a/include/view.h b/include/view.h index 3654fc68..893a5504 100644 --- a/include/view.h +++ b/include/view.h @@ -446,7 +446,7 @@ void view_maximize(struct view *view, enum view_axis axis, bool store_natural_geometry); void view_set_fullscreen(struct view *view, bool fullscreen); void view_toggle_maximize(struct view *view, enum view_axis axis); -void view_toggle_decorations(struct view *view); +void view_toggle_decorations(struct view *view, bool keep_border); bool view_is_always_on_top(struct view *view); bool view_is_always_on_bottom(struct view *view); diff --git a/src/action.c b/src/action.c index 9195d930..eccba0e1 100644 --- a/src/action.c +++ b/src/action.c @@ -344,6 +344,13 @@ action_arg_from_xml_node(struct action *action, const char *nodename, const char goto cleanup; } break; + case ACTION_TYPE_TOGGLE_DECORATIONS: + case ACTION_TYPE_UNDECORATE: + if (!strcasecmp(argument, "keepBorder")) { + action_arg_add_bool(action, argument, parse_bool(content, true)); + goto cleanup; + } + break; case ACTION_TYPE_RESIZE_RELATIVE: if (!strcmp(argument, "left") || !strcmp(argument, "right") || !strcmp(argument, "top") || !strcmp(argument, "bottom")) { @@ -791,7 +798,9 @@ actions_run(struct view *activator, struct server *server, break; case ACTION_TYPE_TOGGLE_DECORATIONS: if (view) { - view_toggle_decorations(view); + bool keep_border = action_get_bool( + action, "keepBorder", rc.ssd_keep_border); + view_toggle_decorations(view, keep_border); } break; case ACTION_TYPE_DECORATE: @@ -801,7 +810,13 @@ actions_run(struct view *activator, struct server *server, break; case ACTION_TYPE_UNDECORATE: if (view) { - view_set_decorations(view, LAB_SSD_MODE_NONE); + bool keep_border = action_get_bool( + action, "keepBorder", rc.ssd_keep_border); + if (keep_border) { + view_set_decorations(view, LAB_SSD_MODE_BORDER); + } else { + view_set_decorations(view, LAB_SSD_MODE_NONE); + } } break; case ACTION_TYPE_TOGGLE_ALWAYS_ON_TOP: diff --git a/src/view.c b/src/view.c index 57842634..cd21b1a5 100644 --- a/src/view.c +++ b/src/view.c @@ -1194,12 +1194,11 @@ view_toggle_maximize(struct view *view, enum view_axis axis) } void -view_toggle_decorations(struct view *view) +view_toggle_decorations(struct view *view, bool keep_border) { assert(view); - if (rc.ssd_keep_border && view->ssd_enabled - && !view->ssd_titlebar_hidden) { + if (keep_border && view->ssd_enabled && !view->ssd_titlebar_hidden) { view_set_decorations(view, LAB_SSD_MODE_BORDER); } else if (view->ssd_enabled) { view_set_decorations(view, LAB_SSD_MODE_NONE);