diff --git a/include/common/node-type.h b/include/common/node-type.h index 52fff3b0..ddda2100 100644 --- a/include/common/node-type.h +++ b/include/common/node-type.h @@ -26,8 +26,9 @@ enum lab_node_type { LAB_NODE_BUTTON_WINDOW_MENU, LAB_NODE_BUTTON_SHADE, LAB_NODE_BUTTON_OMNIPRESENT, + LAB_NODE_BUTTON_ONTOP, LAB_NODE_BUTTON_FIRST = LAB_NODE_BUTTON_CLOSE, - LAB_NODE_BUTTON_LAST = LAB_NODE_BUTTON_OMNIPRESENT, + LAB_NODE_BUTTON_LAST = LAB_NODE_BUTTON_ONTOP, LAB_NODE_BUTTON, LAB_NODE_TITLEBAR, diff --git a/include/config/default-bindings.h b/include/config/default-bindings.h index a49f60f4..f2b49cb8 100644 --- a/include/config/default-bindings.h +++ b/include/config/default-bindings.h @@ -291,6 +291,11 @@ static struct mouse_combos { .button = "Left", .event = "Click", .action = "ToggleOmnipresent", + }, { + .context = "OnTop", + .button = "Left", + .event = "Click", + .action = "ToggleAlwaysOnTop", }, { .context = "Maximize", .button = "Right", diff --git a/include/ssd-internal.h b/include/ssd-internal.h index 600b9076..106fdf76 100644 --- a/include/ssd-internal.h +++ b/include/ssd-internal.h @@ -79,6 +79,7 @@ struct ssd { * such a small titlebar. */ bool was_squared; + bool was_ontop; struct wlr_box geometry; struct ssd_state_title { diff --git a/src/common/node-type.c b/src/common/node-type.c index 67958dd4..b3b66f8c 100644 --- a/src/common/node-type.c +++ b/src/common/node-type.c @@ -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")) { diff --git a/src/config/rcxml.c b/src/config/rcxml.c index 20c236b4..217e3e81 100644 --- a/src/config/rcxml.c +++ b/src/config/rcxml.c @@ -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); diff --git a/src/ssd/ssd-titlebar.c b/src/ssd/ssd-titlebar.c index d1a08810..fbedc42c 100644 --- a/src/ssd/ssd-titlebar.c +++ b/src/ssd/ssd-titlebar.c @@ -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; } diff --git a/src/ssd/ssd.c b/src/ssd/ssd.c index e2ab6375..731bc3d0 100644 --- a/src/ssd/ssd.c +++ b/src/ssd/ssd.c @@ -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 diff --git a/src/theme.c b/src/theme.c index 93ac1c5e..d627cc47 100644 --- a/src/theme.c +++ b/src/theme.c @@ -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, diff --git a/subprojects/wayland-protocols.wrap b/subprojects/wayland-protocols.wrap new file mode 100644 index 00000000..6a0fdcfa --- /dev/null +++ b/subprojects/wayland-protocols.wrap @@ -0,0 +1,2 @@ +[wrap-redirect] +filename = wlroots/subprojects/wayland-protocols.wrap