From 87726760de4d491d1324ed2102734a0ea4502207 Mon Sep 17 00:00:00 2001 From: Dmitry Zakharchenko Date: Thu, 16 Mar 2023 16:46:02 +0200 Subject: [PATCH] backports --- config.h | 1 - dwl.c | 12 ++++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/config.h b/config.h index 126f6a9..e647f2b 100644 --- a/config.h +++ b/config.h @@ -9,7 +9,6 @@ static const unsigned int gappiv = 15; static const unsigned int gappoh = 15; static const unsigned int gappov = 15; -static const float rootcolor[] = {0.13, 0.13, 0.13, 1.0}; static const float bordercolor[] = {0.26, 0.26, 0.26, 1.0}; static const float focuscolor[] = {0.0, 0.33, 0.46, 1.0}; static const float fullscreen_bg[] = {0.1, 0.1, 0.1, 1.0}; diff --git a/dwl.c b/dwl.c index c08c8c0..3dddfa5 100644 --- a/dwl.c +++ b/dwl.c @@ -202,6 +202,7 @@ struct Monitor { unsigned int tagset[2]; double mfact; int nmaster; + char ltsymbol[16]; }; typedef struct { @@ -553,7 +554,8 @@ arrange(Monitor *m) wlr_scene_node_set_enabled(&m->fullscreen_bg->node, (c = focustop(m)) && c->isfullscreen); - + if (m) + strncpy(m->ltsymbol, m->lt[m->sellt]->symbol, LENGTH(m->ltsymbol)); if (m && m->lt[m->sellt]->arrange) m->lt[m->sellt]->arrange(m); motionnotify(0); @@ -1062,6 +1064,7 @@ createmon(struct wl_listener *listener, void *data) wlr_output_layout_add_auto(output_layout, wlr_output); else wlr_output_layout_add(output_layout, wlr_output, m->m.x, m->m.y); + strncpy(m->ltsymbol, m->lt[m->sellt]->symbol, LENGTH(m->ltsymbol)); } void @@ -1788,12 +1791,16 @@ void monocle(Monitor *m) { Client *c; + int n = 0; wl_list_for_each(c, &clients, link) { if (!VISIBLEON(c, m) || c->isfloating || c->isfullscreen) continue; resize(c, m->w, 0); + n++; } + if (n) + snprintf(m->ltsymbol, LENGTH(m->ltsymbol), "[%d]", n); if ((c = focustop(m))) wlr_scene_node_raise_to_top(&c->scene->node); } @@ -2081,7 +2088,7 @@ printstatus(void) printf("%s selmon %u\n", m->wlr_output->name, m == selmon); printf("%s tags %u %u %u %u\n", m->wlr_output->name, occ, m->tagset[m->seltags], sel, urg); - printf("%s layout %s\n", m->wlr_output->name, m->lt[m->sellt]->symbol); + printf("%s layout %s\n", m->wlr_output->name, m->ltsymbol); } fflush(stdout); } @@ -2287,6 +2294,7 @@ setlayout(const Arg *arg) if (arg && arg->v) selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt] = (Layout *)arg->v; /* TODO change layout symbol? */ + strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, LENGTH(selmon->ltsymbol)); arrange(selmon); printstatus(); }