ssd: add basic always-on-top button

This commit is contained in:
chocolatemintychip 2026-04-20 01:33:20 +02:00
parent 5f668a82ee
commit 838113cc44
9 changed files with 36 additions and 2 deletions

View file

@ -20,6 +20,8 @@ node_type_parse(const char *context)
return LAB_NODE_BUTTON_SHADE;
} else if (!strcasecmp(context, "AllDesktops")) {
return LAB_NODE_BUTTON_OMNIPRESENT;
} else if (!strcasecmp(context, "OnTop")) {
return LAB_NODE_BUTTON_ONTOP;
} else if (!strcasecmp(context, "Titlebar")) {
return LAB_NODE_TITLEBAR;
} else if (!strcasecmp(context, "Title")) {

View file

@ -184,6 +184,8 @@ fill_section(const char *content, enum lab_node_type *buttons, int *count,
type = LAB_NODE_BUTTON_SHADE;
} else if (!strcmp(identifier, "desk")) {
type = LAB_NODE_BUTTON_OMNIPRESENT;
} else if (!strcmp(identifier, "ontop")) {
type = LAB_NODE_BUTTON_ONTOP;
} else {
wlr_log(WLR_ERROR, "invalid titleLayout identifier '%s'",
identifier);

View file

@ -299,6 +299,14 @@ ssd_titlebar_update(struct ssd *ssd)
ssd->state.was_omnipresent = view->visible_on_all_workspaces;
}
printf("%d\n\n",ssd->state.was_ontop);
if (ssd->state.was_ontop != (view->layer == VIEW_LAYER_ALWAYS_ON_TOP)) {
set_alt_button_icon(ssd, LAB_NODE_BUTTON_ONTOP,
view->layer);
ssd->state.was_ontop = view->layer;
}
if (width == ssd->state.geometry.width) {
return;
}

View file

@ -227,7 +227,8 @@ ssd_update_geometry(struct ssd *ssd)
bool state_changed = ssd->state.was_maximized != maximized
|| ssd->state.was_shaded != view->shaded
|| ssd->state.was_squared != squared
|| ssd->state.was_omnipresent != view->visible_on_all_workspaces;
|| ssd->state.was_omnipresent != view->visible_on_all_workspaces
|| ssd->state.was_ontop != (view->layer == VIEW_LAYER_ALWAYS_ON_TOP);
/*
* (Un)maximization updates titlebar visibility with

View file

@ -316,6 +316,18 @@ load_buttons(struct theme *theme)
.type = LAB_NODE_BUTTON_OMNIPRESENT,
.state_set = LAB_BS_TOGGLED,
}, {
// TODO Add proper bitmaps
.name = "ontop",
.fallback_button = (const char[]){ 0x33, 0x33, 0x00, 0x00, 0x33, 0x33 },
.type = LAB_NODE_BUTTON_ONTOP,
.state_set = 0,
}, {
.name = "ontop_toggled",
.fallback_button = (const char[]){ 0x33, 0x3f, 0x1e, 0x1e, 0x3f, 0x33 },
.type = LAB_NODE_BUTTON_ONTOP,
.state_set = LAB_BS_TOGGLED,
}, {
.name = "close",
.fallback_button = (const char[]){ 0x33, 0x3f, 0x1e, 0x1e, 0x3f, 0x33 },
.type = LAB_NODE_BUTTON_CLOSE,