From 40f13f8e8e22b1f0b57a78ee7030ea525cf72092 Mon Sep 17 00:00:00 2001 From: rafasaurus Date: Mon, 2 Feb 2026 09:37:43 +0400 Subject: [PATCH] Add floating status support and visual indicator - Implement IPC floating event handler to track client state - Wrap window title in '**' when the active client is floating --- dwlb.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/dwlb.c b/dwlb.c index faab2d9..40673cd 100644 --- a/dwlb.c +++ b/dwlb.c @@ -161,6 +161,7 @@ typedef struct { CustomText title, status; bool hidden, bottom; + bool floating; bool redraw; struct wl_list link; @@ -469,7 +470,14 @@ draw_frame(Bar *bar) }); x = nx; - x = draw_text(custom_title ? bar->title.text : bar->window_title, + char *title_text = custom_title ? bar->title.text : bar->window_title; + char floating_title[TEXT_MAX]; + if (bar->floating) { + snprintf(floating_title, sizeof(floating_title), "** %s **", title_text); + title_text = floating_title; + } + + x = draw_text(title_text, x, y, foreground, foreground_mask, background, (bar->sel && active_color_title) ? &active_fg_color : &inactive_fg_color, (bar->sel && active_color_title) ? &active_bg_color : &inactive_bg_color, @@ -985,6 +993,12 @@ static void dwl_wm_output_floating(void *data, struct zdwl_ipc_output_v2 *dwl_wm_output, uint32_t is_floating) { + Bar *bar = (Bar *)data; + + if ((is_floating != 0) != bar->floating) { + bar->floating = (is_floating != 0); + bar->redraw = true; + } } static const struct zdwl_ipc_output_v2_listener dwl_wm_output_listener = { @@ -1007,6 +1021,7 @@ setup_bar(Bar *bar) bar->textpadding = textpadding; bar->bottom = bottom; bar->hidden = hidden; + bar->floating = false; bar->xdg_output = zxdg_output_manager_v1_get_xdg_output(output_manager, bar->wl_output); if (!bar->xdg_output)