From 888dbedeed416ee18e73129fc5bb0a23eebc31d8 Mon Sep 17 00:00:00 2001 From: tokyo4j Date: Thu, 21 Aug 2025 13:56:37 +0900 Subject: [PATCH] ssd: allow hiding titlebar on maximization hides the titlebar when a window is maximized. Co-authored-by: @CosmicFusion --- docs/labwc-config.5.scd | 6 ++++++ docs/rc.xml.all | 1 + include/config/rcxml.h | 1 + src/config/rcxml.c | 7 +++++++ src/ssd/ssd.c | 6 ++++++ src/view.c | 4 ++++ 6 files changed, 25 insertions(+) diff --git a/docs/labwc-config.5.scd b/docs/labwc-config.5.scd index 860391c9..e86fb75f 100644 --- a/docs/labwc-config.5.scd +++ b/docs/labwc-config.5.scd @@ -171,6 +171,7 @@ this is for compatibility with Openbox. ``` server + titlebar 0 no no @@ -186,6 +187,11 @@ this is for compatibility with Openbox. that it is not always possible to turn off client side decorations. Default is server. +** [titlebar|none] + Specify how server side decorations are shown for maximized windows. + *titlebar* shows titlebar above a maximized window. *none* shows no server + side decorations around a maximized window. Default is titlebar. + ** The distance in pixels between windows and output edges when using movement actions, for example MoveToEdge. Default is 0. diff --git a/docs/rc.xml.all b/docs/rc.xml.all index 3084aee5..91dc7791 100644 --- a/docs/rc.xml.all +++ b/docs/rc.xml.all @@ -11,6 +11,7 @@ server + titlebar 0 no no diff --git a/include/config/rcxml.h b/include/config/rcxml.h index a7eb22bd..cb3dd1b9 100644 --- a/include/config/rcxml.h +++ b/include/config/rcxml.h @@ -66,6 +66,7 @@ struct rcxml { /* core */ bool xdg_shell_server_side_deco; + bool hide_maximized_window_titlebar; int gap; enum adaptive_sync_mode adaptive_sync; enum tearing_mode allow_tearing; diff --git a/src/config/rcxml.c b/src/config/rcxml.c index 8746836b..52e02c4b 100644 --- a/src/config/rcxml.c +++ b/src/config/rcxml.c @@ -1094,6 +1094,12 @@ entry(xmlNode *node, char *nodename, char *content) } else { rc.xdg_shell_server_side_deco = true; } + } else if (!strcasecmp(nodename, "maximizedDecoration.core")) { + if (!strcasecmp(content, "titlebar")) { + rc.hide_maximized_window_titlebar = false; + } else if (!strcasecmp(content, "none")) { + rc.hide_maximized_window_titlebar = true; + } } else if (!strcmp(nodename, "gap.core")) { rc.gap = atoi(content); } else if (!strcasecmp(nodename, "adaptiveSync.core")) { @@ -1370,6 +1376,7 @@ rcxml_init(void) rc.placement_cascade_offset_y = 0; rc.xdg_shell_server_side_deco = true; + rc.hide_maximized_window_titlebar = false; rc.show_title = true; rc.title_layout_loaded = false; rc.ssd_keep_border = true; diff --git a/src/ssd/ssd.c b/src/ssd/ssd.c index db706085..3d0dd7a0 100644 --- a/src/ssd/ssd.c +++ b/src/ssd/ssd.c @@ -312,6 +312,12 @@ ssd_update_geometry(struct ssd *ssd) || ssd->state.was_squared != squared || ssd->state.was_omnipresent != view->visible_on_all_workspaces; + /* + * (Un)maximization updates titlebar visibility with + * maximizedDecoration=none + */ + ssd_set_titlebar(ssd, view_titlebar_visible(view)); + if (update_extents) { ssd_extents_update(ssd); } diff --git a/src/view.c b/src/view.c index 75f8bad1..a81b03ad 100644 --- a/src/view.c +++ b/src/view.c @@ -1660,6 +1660,10 @@ undecorate(struct view *view) bool view_titlebar_visible(struct view *view) { + if (view->maximized == VIEW_AXIS_BOTH + && rc.hide_maximized_window_titlebar) { + return false; + } return view->ssd_mode == LAB_SSD_MODE_FULL; }