diff --git a/patches/bar/README.md b/patches/bar/README.md index 1de63f6..0a9431f 100644 --- a/patches/bar/README.md +++ b/patches/bar/README.md @@ -14,7 +14,7 @@ slstatus -s | dwl ### Download - [git branch](https://codeberg.org/sewn/dwl/src/branch/bar) -- [2024-06-10](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/bar/bar.patch) +- [2024-06-26](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/bar/bar.patch) Below is a preview of the patch. diff --git a/patches/bar/bar.patch b/patches/bar/bar.patch index 5d73450..6352c8f 100644 --- a/patches/bar/bar.patch +++ b/patches/bar/bar.patch @@ -1,29 +1,41 @@ -From ebe8a7aca8684c66da54abb50c630f4ad9cb233e Mon Sep 17 00:00:00 2001 +From 20bda56e053413836e227a114327b567fb54041f Mon Sep 17 00:00:00 2001 From: sewn -Date: Mon, 10 Jun 2024 14:41:35 +0300 +Date: Wed, 26 Jun 2024 09:31:26 +0300 Subject: [PATCH] Implement dwm bar clone --- - LICENSE.drwl | 22 +++ - LICENSE.utf8dec | 25 ++++ - Makefile | 2 +- - config.def.h | 28 +++- - drwl.h | 142 ++++++++++++++++++ - dwl.c | 380 ++++++++++++++++++++++++++++++++++++++---------- - 6 files changed, 518 insertions(+), 81 deletions(-) + LICENSE | 3 +- + LICENSE.drwl | 21 +++ + Makefile | 2 +- + config.def.h | 31 ++-- + drwl.h | 284 +++++++++++++++++++++++++++++++++++++ + dwl.c | 391 ++++++++++++++++++++++++++++++++++++++++----------- + 6 files changed, 641 insertions(+), 91 deletions(-) create mode 100644 LICENSE.drwl - create mode 100644 LICENSE.utf8dec create mode 100644 drwl.h +diff --git a/LICENSE b/LICENSE +index 658085a..2c269b2 100644 +--- a/LICENSE ++++ b/LICENSE +@@ -2,7 +2,8 @@ dwl - dwm for Wayland + + Copyright © 2020 dwl team + +-See also the files LICENSE.tinywl, LICENSE.dwm and LICENSE.sway. ++See also the files LICENSE.tinywl, LICENSE.dwm, LICENSE.sway, and ++LICENSE.drwl. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by diff --git a/LICENSE.drwl b/LICENSE.drwl new file mode 100644 -index 0000000..35f0ad3 +index 0000000..4754b85 --- /dev/null +++ b/LICENSE.drwl -@@ -0,0 +1,22 @@ -+Copyright (C) 2023-2024 sewn -+ -+See also the file LICENSE.utf8dec. +@@ -0,0 +1,21 @@ ++Copyright (c) 2023-2024 sewn ++Copyright (c) 2015 Eric Pruitt + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the @@ -43,43 +55,12 @@ index 0000000..35f0ad3 +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -diff --git a/LICENSE.utf8dec b/LICENSE.utf8dec -new file mode 100644 -index 0000000..a11589b ---- /dev/null -+++ b/LICENSE.utf8dec -@@ -0,0 +1,25 @@ -+drwl uses the flexible and economical UTF-8 Decoder made by Bjoern Hoehrmann, -+which is used under the following license: -+ -+--- -+ -+Copyright (c) 2008-2009 Bjoern Hoehrmann -+See http://bjoern.hoehrmann.de/utf-8/decoder/dfa/ for details. -+ -+Permission is hereby granted, free of charge, to any person obtaining a copy -+of this software and associated documentation files (the "Software"), to deal -+in the Software without restriction, including without limitation the rights -+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -+copies of the Software, and to permit persons to whom the Software is -+furnished to do so, subject to the following conditions: -+ -+The above copyright notice and this permission notice shall be included in -+all copies or substantial portions of the Software. -+ -+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -+SOFTWARE. diff --git a/Makefile b/Makefile -index a67fdd3..5578ae2 100644 +index 9308656..eb5c9d8 100644 --- a/Makefile +++ b/Makefile -@@ -9,7 +9,7 @@ DWLDEVCFLAGS = -g -pedantic -Wall -Wextra -Wdeclaration-after-statement -Wno-unu - -Werror=strict-prototypes -Werror=implicit -Werror=return-type -Werror=incompatible-pointer-types -Wfloat-conversion +@@ -12,7 +12,7 @@ DWLDEVCFLAGS = -g -pedantic -Wall -Wextra -Wdeclaration-after-statement \ + -Wfloat-conversion # CFLAGS / LDFLAGS -PKGS = wlroots wayland-server xkbcommon libinput $(XLIBS) @@ -88,37 +69,37 @@ index a67fdd3..5578ae2 100644 LDLIBS = `$(PKG_CONFIG) --libs $(PKGS)` $(LIBS) diff --git a/config.def.h b/config.def.h -index 8847e58..d0bb5bc 100644 +index 646a3d6..6024b7e 100644 --- a/config.def.h +++ b/config.def.h -@@ -7,15 +7,24 @@ +@@ -7,15 +7,21 @@ static const int sloppyfocus = 1; /* focus follows mouse */ static const int bypass_surface_visibility = 0; /* 1 means idle inhibitors will disable idle tracking even if it's surface isn't visible */ static const unsigned int borderpx = 1; /* border pixel of windows */ -static const float rootcolor[] = COLOR(0x222222ff); +-static const float bordercolor[] = COLOR(0x444444ff); +-static const float focuscolor[] = COLOR(0x005577ff); +-static const float urgentcolor[] = COLOR(0xff0000ff); ++static const int showbar = 1; /* 0 means no bar */ ++static const int topbar = 1; /* 0 means bottom bar */ ++static const char *fonts[] = {"monospace:size=10"}; +static const float rootcolor[] = COLOR(0x000000ff); - static const float bordercolor[] = COLOR(0x444444ff); - static const float focuscolor[] = COLOR(0x005577ff); - static const float urgentcolor[] = COLOR(0xff0000ff); /* This conforms to the xdg-protocol. Set the alpha to zero to restore the old behavior */ static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You can also use glsl colors */ ++static uint32_t colors[][3] = { ++ /* fg bg border */ ++ [SchemeNorm] = { 0xbbbbbbff, 0x222222ff, 0x444444ff }, ++ [SchemeSel] = { 0xeeeeeeff, 0x005577ff, 0x005577ff }, ++ [SchemeUrg] = { 0, 0, 0x770000ff }, ++}; -+/* bar */ -+static const int showbar = 1; /* 0 means no bar */ -+static const int topbar = 1; /* 0 means bottom bar */ -+static const char *fonts[] = {"monospace:size=10"}; -+static pixman_color_t normbarfg = { 0xbbbb, 0xbbbb, 0xbbbb, 0xffff }; -+static pixman_color_t normbarbg = { 0x2222, 0x2222, 0x2222, 0xffff }; -+static pixman_color_t selbarfg = { 0xeeee, 0xeeee, 0xeeee, 0xffff }; -+static pixman_color_t selbarbg = { 0x0000, 0x5555, 0x7777, 0xffff }; -+ /* tagging - TAGCOUNT must be no greater than 31 */ -#define TAGCOUNT (9) +static char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; /* logging */ static int log_level = WLR_ERROR; -@@ -122,6 +131,7 @@ static const Key keys[] = { +@@ -126,6 +132,7 @@ static const Key keys[] = { /* modifier key function argument */ { MODKEY, XKB_KEY_p, spawn, {.v = menucmd} }, { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Return, spawn, {.v = termcmd} }, @@ -126,7 +107,7 @@ index 8847e58..d0bb5bc 100644 { MODKEY, XKB_KEY_j, focusstack, {.i = +1} }, { MODKEY, XKB_KEY_k, focusstack, {.i = -1} }, { MODKEY, XKB_KEY_i, incnmaster, {.i = +1} }, -@@ -165,7 +175,15 @@ static const Key keys[] = { +@@ -169,7 +176,15 @@ static const Key keys[] = { }; static const Button buttons[] = { @@ -147,60 +128,168 @@ index 8847e58..d0bb5bc 100644 }; diff --git a/drwl.h b/drwl.h new file mode 100644 -index 0000000..613551e +index 0000000..afcb2bd --- /dev/null +++ b/drwl.h -@@ -0,0 +1,142 @@ +@@ -0,0 +1,284 @@ +/* + * drwl - https://codeberg.org/sewn/drwl -+ * See LICENSE file for copyright and license details. ++ * See LICENSE.drwl file for copyright and license details. + */ ++#pragma once ++ ++#include +#include +#include + -+#define UTF8_ACCEPT 0 -+#define UTF8_REJECT 1 ++#define BETWEEN(X, A, B) ((A) <= (X) && (X) <= (B)) + -+static const uint8_t utf8d[] = { -+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 00..1f -+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 20..3f -+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 40..5f -+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 60..7f -+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, // 80..9f -+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, // a0..bf -+ 8,8,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, // c0..df -+ 0xa,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x4,0x3,0x3, // e0..ef -+ 0xb,0x6,0x6,0x6,0x5,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8, // f0..ff -+ 0x0,0x1,0x2,0x3,0x5,0x8,0x7,0x1,0x1,0x1,0x4,0x6,0x1,0x1,0x1,0x1, // s0..s0 -+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,0,1,0,1,1,1,1,1,1, // s1..s2 -+ 1,2,1,1,1,1,1,2,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1, // s3..s4 -+ 1,2,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,3,1,3,1,1,1,1,1,1, // s5..s6 -+ 1,3,1,1,1,1,1,3,1,3,1,1,1,1,1,1,1,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // s7..s8 -+}; ++enum { ColFg, ColBg, ColBorder }; /* colorscheme index */ ++ ++typedef struct { ++ pixman_image_t *pix; ++ struct fcft_font *font; ++ uint32_t *scheme; ++} Drwl; ++ ++#define UTF_INVALID 0xFFFD ++#define UTF_SIZ 4 ++ ++static const unsigned char utfbyte[UTF_SIZ + 1] = {0x80, 0, 0xC0, 0xE0, 0xF0}; ++static const unsigned char utfmask[UTF_SIZ + 1] = {0xC0, 0x80, 0xE0, 0xF0, 0xF8}; ++static const uint32_t utfmin[UTF_SIZ + 1] = { 0, 0, 0x80, 0x800, 0x10000}; ++static const uint32_t utfmax[UTF_SIZ + 1] = {0x10FFFF, 0x7F, 0x7FF, 0xFFFF, 0x10FFFF}; + +static inline uint32_t -+utf8decode(uint32_t *state, uint32_t *codep, uint8_t byte) ++utf8decodebyte(const char c, size_t *i) +{ -+ uint32_t type = utf8d[byte]; ++ for (*i = 0; *i < (UTF_SIZ + 1); ++(*i)) ++ if (((unsigned char)c & utfmask[*i]) == utfbyte[*i]) ++ return (unsigned char)c & ~utfmask[*i]; ++ return 0; ++} + -+ *codep = (*state != UTF8_ACCEPT) ? -+ (byte & 0x3fu) | (*codep << 6) : -+ (0xff >> type) & (byte); ++static inline size_t ++utf8decode(const char *c, uint32_t *u) ++{ ++ size_t i, j, len, type; ++ uint32_t udecoded; + -+ *state = utf8d[256 + *state*16 + type]; -+ return *state; ++ *u = UTF_INVALID; ++ udecoded = utf8decodebyte(c[0], &len); ++ if (!BETWEEN(len, 1, UTF_SIZ)) ++ return 1; ++ for (i = 1, j = 1; i < UTF_SIZ && j < len; ++i, ++j) { ++ udecoded = (udecoded << 6) | utf8decodebyte(c[i], &type); ++ if (type) ++ return j; ++ } ++ if (j < len) ++ return 0; ++ *u = udecoded; ++ if (!BETWEEN(*u, utfmin[len], utfmax[len]) || BETWEEN(*u, 0xD800, 0xDFFF)) ++ *u = UTF_INVALID; ++ for (i = 1; *u > utfmax[i]; ++i) ++ ; ++ return len; ++} ++ ++static int ++drwl_init(void) ++{ ++ fcft_set_scaling_filter(FCFT_SCALING_FILTER_LANCZOS3); ++ return fcft_init(FCFT_LOG_COLORIZE_AUTO, 0, FCFT_LOG_CLASS_ERROR); ++} ++ ++static Drwl * ++drwl_create(void) ++{ ++ Drwl *drwl; ++ ++ if (!(drwl = calloc(1, sizeof(Drwl)))) ++ return NULL; ++ ++ return drwl; +} + +static void -+drwl_rect(pixman_image_t *pix, -+ int16_t x, int16_t y, uint16_t w, uint16_t h, -+ int filled, pixman_color_t *bg) ++drwl_setfont(Drwl *drwl, struct fcft_font *font) +{ ++ if (drwl) ++ drwl->font = font; ++} ++ ++static struct fcft_font * ++drwl_load_font(Drwl *drwl, size_t fontcount, ++ const char *fonts[static fontcount], const char *attributes) ++{ ++ struct fcft_font *font = fcft_from_name(fontcount, fonts, attributes); ++ if (drwl) ++ drwl_setfont(drwl, font); ++ return font; ++} ++ ++static void ++drwl_destroy_font(struct fcft_font *font) ++{ ++ fcft_destroy(font); ++} ++ ++static inline pixman_color_t ++convert_color(uint32_t clr) ++{ ++ return (pixman_color_t){ ++ ((clr >> 24) & 0xFF) * 0x101, ++ ((clr >> 16) & 0xFF) * 0x101, ++ ((clr >> 8) & 0xFF) * 0x101, ++ (clr & 0xFF) * 0x101 ++ }; ++} ++ ++static void ++drwl_setscheme(Drwl *drwl, uint32_t *scm) ++{ ++ if (drwl) ++ drwl->scheme = scm; ++} ++ ++static inline int ++drwl_stride(unsigned int width) ++{ ++ return (((PIXMAN_FORMAT_BPP(PIXMAN_a8r8g8b8) * width + 7) / 8 + 4 - 1) & -4); ++} ++ ++static void ++drwl_prepare_drawing(Drwl *drwl, unsigned int w, unsigned int h, ++ uint32_t *bits, int stride) ++{ ++ pixman_region32_t clip; ++ ++ if (!drwl) ++ return; ++ ++ drwl->pix = pixman_image_create_bits_no_clear( ++ PIXMAN_a8r8g8b8, w, h, bits, stride); ++ pixman_region32_init_rect(&clip, 0, 0, w, h); ++ pixman_image_set_clip_region32(drwl->pix, &clip); ++ pixman_region32_fini(&clip); ++} ++ ++static void ++drwl_rect(Drwl *drwl, ++ int x, int y, unsigned int w, unsigned int h, ++ int filled, int invert) ++{ ++ pixman_color_t clr; ++ if (!drwl || !drwl->scheme || !drwl->pix) ++ return; ++ ++ clr = convert_color(drwl->scheme[invert ? ColBg : ColFg]); + if (filled) -+ pixman_image_fill_rectangles(PIXMAN_OP_SRC, pix, bg, 1, ++ pixman_image_fill_rectangles(PIXMAN_OP_SRC, drwl->pix, &clr, 1, + &(pixman_rectangle16_t){x, y, w, h}); + else -+ pixman_image_fill_rectangles(PIXMAN_OP_SRC, pix, bg, 4, ++ pixman_image_fill_rectangles(PIXMAN_OP_SRC, drwl->pix, &clr, 4, + (pixman_rectangle16_t[4]){ + { x, y, w, 1 }, + { x, y + h - 1, w, 1 }, @@ -209,62 +298,64 @@ index 0000000..613551e +} + +static int -+drwl_text(pixman_image_t *pix, struct fcft_font *font, ++drwl_text(Drwl *drwl, + int x, int y, unsigned int w, unsigned int h, -+ unsigned int lpad, const char *text, -+ pixman_color_t *fg, pixman_color_t *bg) ++ unsigned int lpad, const char *text, int invert) +{ + int ty; -+ int render = x || y || w || h; ++ int utf8charlen, render = x || y || w || h; + long x_kern; -+ uint32_t cp, last_cp = 0; -+ uint32_t state = UTF8_ACCEPT; ++ uint32_t cp = 0, last_cp = 0; ++ pixman_color_t clr; + pixman_image_t *fg_pix = NULL; -+ const struct fcft_glyph *glyph, *eg; + int noellipsis = 0; ++ const struct fcft_glyph *glyph, *eg; ++ int fcft_subpixel_mode = FCFT_SUBPIXEL_DEFAULT; + -+ if ((render && (!fg || !w)) || !text || !font) ++ if (!drwl || (render && (!drwl->scheme || !w || !drwl->pix)) || !text || !drwl->font) + return 0; + + if (!render) { -+ w = -1; ++ w = invert ? invert : ~invert; + } else { -+ fg_pix = pixman_image_create_solid_fill(fg); ++ clr = convert_color(drwl->scheme[invert ? ColBg : ColFg]); ++ fg_pix = pixman_image_create_solid_fill(&clr); + -+ if (bg) -+ drwl_rect(pix, x, y, w, h, 1, bg); ++ drwl_rect(drwl, x, y, w, h, 1, !invert); + + x += lpad; + w -= lpad; + } + ++ if (render && (drwl->scheme[ColBg] & 0xFF) != 0xFF) ++ fcft_subpixel_mode = FCFT_SUBPIXEL_NONE; ++ + // U+2026 == … -+ eg = fcft_rasterize_char_utf32(font, 0x2026, FCFT_SUBPIXEL_NONE); ++ eg = fcft_rasterize_char_utf32(drwl->font, 0x2026, fcft_subpixel_mode); + -+ for (const char *p = text; *p; p++) { -+ if (utf8decode(&state, &cp, *p)) -+ continue; ++ while (*text) { ++ utf8charlen = utf8decode(text, &cp); + -+ glyph = fcft_rasterize_char_utf32(font, cp, FCFT_SUBPIXEL_NONE); ++ glyph = fcft_rasterize_char_utf32(drwl->font, cp, fcft_subpixel_mode); + if (!glyph) + continue; + + x_kern = 0; + if (last_cp) -+ fcft_kerning(font, last_cp, cp, &x_kern, NULL); ++ fcft_kerning(drwl->font, last_cp, cp, &x_kern, NULL); + last_cp = cp; + -+ ty = y + (h - font->height) / 2 + font->ascent; ++ ty = y + (h - drwl->font->height) / 2 + drwl->font->ascent; + + /* draw ellipsis if remaining text doesn't fit */ -+ if (!noellipsis && x_kern + glyph->advance.x + eg->advance.x > w && *(p + 1) != '\0') { -+ if (drwl_text(NULL, font, 0, 0, 0, 0, 0, p, NULL, NULL) ++ if (!noellipsis && x_kern + glyph->advance.x + eg->advance.x > w && *(text + 1) != '\0') { ++ if (drwl_text(drwl, 0, 0, 0, 0, 0, text, 0) + - glyph->advance.x < eg->advance.x) { + noellipsis = 1; + } else { + w -= eg->advance.x; + pixman_image_composite32( -+ PIXMAN_OP_OVER, fg_pix, eg->pix, pix, 0, 0, 0, 0, ++ PIXMAN_OP_OVER, fg_pix, eg->pix, drwl->pix, 0, 0, 0, 0, + x + eg->x, ty - eg->y, eg->width, eg->height); + } + } @@ -277,13 +368,14 @@ index 0000000..613551e + if (render && pixman_image_get_format(glyph->pix) == PIXMAN_a8r8g8b8) + // pre-rendered glyphs (eg. emoji) + pixman_image_composite32( -+ PIXMAN_OP_OVER, glyph->pix, NULL, pix, 0, 0, 0, 0, ++ PIXMAN_OP_OVER, glyph->pix, NULL, drwl->pix, 0, 0, 0, 0, + x + glyph->x, ty - glyph->y, glyph->width, glyph->height); + else if (render) + pixman_image_composite32( -+ PIXMAN_OP_OVER, fg_pix, glyph->pix, pix, 0, 0, 0, 0, ++ PIXMAN_OP_OVER, fg_pix, glyph->pix, drwl->pix, 0, 0, 0, 0, + x + glyph->x, ty - glyph->y, glyph->width, glyph->height); + ++ text += utf8charlen; + x += glyph->advance.x; + w -= glyph->advance.x; + } @@ -293,8 +385,39 @@ index 0000000..613551e + + return x + (render ? w : 0); +} ++ ++static unsigned int ++drwl_font_getwidth(Drwl *drwl, const char *text) ++{ ++ if (!drwl || !drwl->font || !text) ++ return 0; ++ return drwl_text(drwl, 0, 0, 0, 0, 0, text, 0); ++} ++ ++static void ++drwl_finish_drawing(Drwl *drwl) ++{ ++ if (drwl && drwl->pix) ++ pixman_image_unref(drwl->pix); ++} ++ ++static void ++drwl_destroy(Drwl *drwl) ++{ ++ if (drwl->pix) ++ pixman_image_unref(drwl->pix); ++ if (drwl->font) ++ drwl_destroy_font(drwl->font); ++ free(drwl); ++} ++ ++static void ++drwl_fini(void) ++{ ++ fcft_fini(); ++} diff --git a/dwl.c b/dwl.c -index bf763df..cd484bd 100644 +index 9fb50a7..72b4abb 100644 --- a/dwl.c +++ b/dwl.c @@ -4,6 +4,7 @@ @@ -305,19 +428,15 @@ index bf763df..cd484bd 100644 #include #include #include -@@ -55,8 +56,11 @@ +@@ -56,6 +57,7 @@ #include #include #include +#include #include #include -+#include -+#include #include - #ifdef XWAYLAND - #include -@@ -65,6 +69,7 @@ +@@ -66,6 +68,7 @@ #endif #include "util.h" @@ -325,7 +444,7 @@ index bf763df..cd484bd 100644 /* macros */ #define MAX(A, B) ((A) > (B) ? (A) : (B)) -@@ -74,14 +79,16 @@ +@@ -76,14 +79,17 @@ #define VISIBLEON(C, M) ((M) && (C)->mon == (M) && ((C)->tags & (M)->tagset[(M)->seltags])) #define LENGTH(X) (sizeof X / sizeof X[0]) #define END(A) ((A) + LENGTH(A)) @@ -333,9 +452,10 @@ index bf763df..cd484bd 100644 +#define TAGMASK ((1u << LENGTH(tags)) - 1) #define LISTEN(E, L, H) wl_signal_add((E), ((L)->notify = (H), (L))) #define LISTEN_STATIC(E, H) do { static struct wl_listener _l = {.notify = (H)}; wl_signal_add((E), &_l); } while (0) -+#define TEXTW(mon, text) (drwl_text(NULL, mon->font, 0, 0, 0, 0, 0, text, NULL, NULL) + mon->lrpad) ++#define TEXTW(mon, text) (drwl_font_getwidth(mon->drw, text) + mon->lrpad) /* enums */ ++enum { SchemeNorm, SchemeSel, SchemeUrg }; /* color schemes */ enum { CurNormal, CurPressed, CurMove, CurResize }; /* cursor */ enum { XDGShell, LayerShell, X11 }; /* client types */ enum { LyrBg, LyrBottom, LyrTile, LyrFloat, LyrTop, LyrFS, LyrOverlay, LyrBlock, NUM_LAYERS }; /* scene layers */ @@ -343,7 +463,7 @@ index bf763df..cd484bd 100644 #ifdef XWAYLAND enum { NetWMWindowTypeDialog, NetWMWindowTypeSplash, NetWMWindowTypeToolbar, NetWMWindowTypeUtility, NetLast }; /* EWMH atoms */ -@@ -95,6 +102,7 @@ typedef union { +@@ -97,6 +103,7 @@ typedef union { } Arg; typedef struct { @@ -351,7 +471,7 @@ index bf763df..cd484bd 100644 unsigned int mod; unsigned int button; void (*func)(const Arg *); -@@ -188,6 +196,7 @@ struct Monitor { +@@ -191,6 +198,7 @@ struct Monitor { struct wl_list link; struct wlr_output *wlr_output; struct wlr_scene_output *scene_output; @@ -359,7 +479,7 @@ index bf763df..cd484bd 100644 struct wlr_scene_rect *fullscreen_bg; /* See createmon() for info */ struct wl_listener frame; struct wl_listener destroy; -@@ -195,6 +204,11 @@ struct Monitor { +@@ -198,6 +206,11 @@ struct Monitor { struct wl_listener destroy_lock_surface; struct wlr_session_lock_surface_v1 *lock_surface; struct wlr_box m; /* monitor area, layout-relative */ @@ -371,13 +491,14 @@ index bf763df..cd484bd 100644 struct wlr_box w; /* window area, layout-relative */ struct wl_list layers[4]; /* LayerSurface.link */ const Layout *lt[2]; -@@ -204,9 +218,18 @@ struct Monitor { +@@ -207,10 +220,19 @@ struct Monitor { float mfact; int gamma_lut_changed; int nmaster; + int showbar; char ltsymbol[16]; -+ struct fcft_font *font; + int asleep; ++ Drwl *drw; + int lrpad; }; @@ -390,7 +511,7 @@ index bf763df..cd484bd 100644 typedef struct { const char *name; float mfact; -@@ -247,6 +270,10 @@ static void arrangelayer(Monitor *m, struct wl_list *list, +@@ -251,6 +273,10 @@ static void arrangelayer(Monitor *m, struct wl_list *list, struct wlr_box *usable_area, int exclusive); static void arrangelayers(Monitor *m); static void axisnotify(struct wl_listener *listener, void *data); @@ -401,24 +522,24 @@ index bf763df..cd484bd 100644 static void buttonpress(struct wl_listener *listener, void *data); static void chvt(const Arg *arg); static void checkidleinhibitor(struct wlr_surface *exclude); -@@ -278,6 +305,8 @@ static void destroypointerconstraint(struct wl_listener *listener, void *data); - static void destroysessionlock(struct wl_listener *listener, void *data); +@@ -284,6 +310,8 @@ static void destroysessionlock(struct wl_listener *listener, void *data); static void destroysessionmgr(struct wl_listener *listener, void *data); + static void destroykeyboardgroup(struct wl_listener *listener, void *data); static Monitor *dirtomon(enum wlr_direction dir); +static void drawbar(Monitor *m); +static void drawbars(void); static void focusclient(Client *c, int lift); static void focusmon(const Arg *arg); static void focusstack(const Arg *arg); -@@ -306,7 +335,6 @@ static void outputmgrapplyortest(struct wlr_output_configuration_v1 *config, int +@@ -312,7 +340,6 @@ static void outputmgrapplyortest(struct wlr_output_configuration_v1 *config, int static void outputmgrtest(struct wl_listener *listener, void *data); static void pointerfocus(Client *c, struct wlr_surface *surface, double sx, double sy, uint32_t time); -static void printstatus(void); + static void powermgrsetmode(struct wl_listener *listener, void *data); static void quit(const Arg *arg); static void rendermon(struct wl_listener *listener, void *data); - static void requestdecorationmode(struct wl_listener *listener, void *data); -@@ -327,9 +355,11 @@ static void setsel(struct wl_listener *listener, void *data); +@@ -334,9 +361,11 @@ static void setsel(struct wl_listener *listener, void *data); static void setup(void); static void spawn(const Arg *arg); static void startdrag(struct wl_listener *listener, void *data); @@ -430,7 +551,7 @@ index bf763df..cd484bd 100644 static void togglefloating(const Arg *arg); static void togglefullscreen(const Arg *arg); static void toggletag(const Arg *arg); -@@ -338,6 +368,7 @@ static void unlocksession(struct wl_listener *listener, void *data); +@@ -345,6 +374,7 @@ static void unlocksession(struct wl_listener *listener, void *data); static void unmaplayersurfacenotify(struct wl_listener *listener, void *data); static void unmapnotify(struct wl_listener *listener, void *data); static void updatemons(struct wl_listener *listener, void *data); @@ -438,7 +559,7 @@ index bf763df..cd484bd 100644 static void updatetitle(struct wl_listener *listener, void *data); static void urgent(struct wl_listener *listener, void *data); static void view(const Arg *arg); -@@ -405,6 +436,15 @@ static struct wlr_box sgeom; +@@ -411,6 +441,15 @@ static struct wlr_box sgeom; static struct wl_list mons; static Monitor *selmon; @@ -454,7 +575,7 @@ index bf763df..cd484bd 100644 #ifdef XWAYLAND static void activatex11(struct wl_listener *listener, void *data); static void associatex11(struct wl_listener *listener, void *data); -@@ -531,6 +571,11 @@ arrangelayers(Monitor *m) +@@ -551,6 +590,11 @@ arrangelayers(Monitor *m) if (!m->wlr_output->enabled) return; @@ -466,7 +587,7 @@ index bf763df..cd484bd 100644 /* Arrange exclusive surfaces from top->bottom */ for (i = 3; i >= 0; i--) arrangelayer(m, &m->layers[i], &usable_area, 1); -@@ -573,17 +618,77 @@ axisnotify(struct wl_listener *listener, void *data) +@@ -593,17 +637,82 @@ axisnotify(struct wl_listener *listener, void *data) event->delta_discrete, event->source); } @@ -500,7 +621,9 @@ index bf763df..cd484bd 100644 + return true; +} + -+void buffer_end_data_ptr_access(struct wlr_buffer *buffer) { ++void ++buffer_end_data_ptr_access(struct wlr_buffer *buffer) ++{ +} + void @@ -524,8 +647,11 @@ index bf763df..cd484bd 100644 + if (c) + click = ClkClient; + -+ if (!c && (node = wlr_scene_node_at(&layers[LyrBottom]->node, cursor->x, cursor->y, NULL, NULL)) && ++ if (!c && !exclusive_focus && ++ (node = wlr_scene_node_at(&layers[LyrBottom]->node, cursor->x, cursor->y, NULL, NULL)) && + (buffer = wlr_scene_buffer_from_node(node)) && buffer == selmon->scene_buffer) { ++ cursor->x *= selmon->wlr_output->scale; ++ cursor->y *= selmon->wlr_output->scale; + x = selmon->m.x; + do + x += TEXTW(selmon, tags[i]); @@ -544,11 +670,10 @@ index bf763df..cd484bd 100644 switch (event->state) { case WLR_BUTTON_PRESSED: cursor_mode = CurPressed; -@@ -592,16 +697,14 @@ buttonpress(struct wl_listener *listener, void *data) - break; +@@ -612,15 +721,14 @@ buttonpress(struct wl_listener *listener, void *data) /* Change focus if the button was _pressed_ over a client */ -- xytonode(cursor->x, cursor->y, NULL, &c, NULL, NULL, NULL); + xytonode(cursor->x, cursor->y, NULL, &c, NULL, NULL, NULL); - if (c && (!client_is_unmanaged(c) || client_wants_focus(c))) + if (click == ClkClient && (!client_is_unmanaged(c) || client_wants_focus(c))) focusclient(c, 1); @@ -564,26 +689,25 @@ index bf763df..cd484bd 100644 return; } } -@@ -675,6 +778,9 @@ cleanup(void) +@@ -691,6 +799,8 @@ cleanup(void) /* Destroy after the wayland display (when the monitors are already destroyed) to avoid destroying them with an invalid scene output. */ wlr_scene_node_destroy(&scene->tree.node); + -+ -+ fcft_fini(); ++ drwl_fini(); } void -@@ -690,6 +796,8 @@ cleanupmon(struct wl_listener *listener, void *data) +@@ -706,6 +816,8 @@ cleanupmon(struct wl_listener *listener, void *data) wlr_layer_surface_v1_destroy(l->layer_surface); } -+ fcft_destroy(m->font); ++ drwl_destroy(m->drw); + wl_list_remove(&m->destroy.link); wl_list_remove(&m->frame.link); wl_list_remove(&m->link); -@@ -726,7 +834,7 @@ closemon(Monitor *m) +@@ -745,7 +857,7 @@ closemon(Monitor *m) setmon(c, selmon, c->tags); } focusclient(focustop(selmon), 1); @@ -592,10 +716,13 @@ index bf763df..cd484bd 100644 } void -@@ -912,8 +1020,13 @@ createmon(struct wl_listener *listener, void *data) +@@ -970,8 +1082,16 @@ createmon(struct wl_listener *listener, void *data) wlr_output_commit_state(wlr_output, &state); wlr_output_state_finish(&state); ++ if (!(m->drw = drwl_create())) ++ die("failed to create drwl context"); ++ + m->scene_buffer = wlr_scene_buffer_create(layers[LyrBottom], NULL); + m->scene_buffer->point_accepts_input = bar_accepts_input; + m->showbar = showbar; @@ -607,7 +734,7 @@ index bf763df..cd484bd 100644 /* The xdg-protocol specifies: * -@@ -1233,6 +1346,99 @@ dirtomon(enum wlr_direction dir) +@@ -1303,6 +1423,89 @@ dirtomon(enum wlr_direction dir) return selmon; } @@ -615,35 +742,30 @@ index bf763df..cd484bd 100644 +drawbar(Monitor *m) +{ + int x, w, tw = 0; -+ int sel; -+ int boxs = m->font->height / 9; -+ int boxw = m->font->height / 6 + 2; ++ int boxs = m->drw->font->height / 9; ++ int boxw = m->drw->font->height / 6 + 2; + uint32_t i, occ = 0, urg = 0; -+ uint32_t stride, size; -+ pixman_image_t *pix; ++ int32_t stride, size; + Client *c; + Buffer *buf; + + if (!m->showbar) + return; + -+ stride = m->b.width * 4; ++ stride = drwl_stride(m->b.width); + size = stride * m->b.height; + + buf = ecalloc(1, sizeof(Buffer) + size); + buf->stride = stride; + wlr_buffer_init(&buf->base, &buffer_impl, m->b.width, m->b.height); + -+ pix = pixman_image_create_bits( -+ PIXMAN_a8r8g8b8, m->b.width, m->b.height, buf->data, stride); ++ drwl_prepare_drawing(m->drw, m->b.width, m->b.height, buf->data, stride); + + /* draw status first so it can be overdrawn by tags later */ -+ if (m == selmon) { -+ if (stext[0] == '\0') -+ strncpy(stext, "dwl-"VERSION, sizeof(stext)); -+ tw = TEXTW(m, stext) - m->lrpad; -+ drwl_text(pix, m->font, m->b.width - tw, 0, tw, m->b.height, 0, -+ stext, &normbarfg, &normbarbg); ++ if (m == selmon) { /* status is only drawn on selected monitor */ ++ drwl_setscheme(m->drw, colors[SchemeNorm]); ++ tw = TEXTW(m, stext) - m->lrpad + 2; /* 2px right padding */ ++ drwl_text(m->drw, m->b.width - tw, 0, tw, m->b.height, 0, stext, 0); + } + + wl_list_for_each(c, &clients, link) { @@ -654,39 +776,34 @@ index bf763df..cd484bd 100644 + urg |= c->tags; + } + x = 0; ++ c = focustop(m); + for (i = 0; i < LENGTH(tags); i++) { + w = TEXTW(m, tags[i]); -+ sel = m->tagset[m->seltags] & 1 << i; -+ -+ drwl_text(pix, m->font, x, 0, w, m->b.height, m->lrpad / 2, tags[i], -+ urg & 1 << i ? &selbarbg : (sel ? &selbarfg : &normbarfg), -+ urg & 1 << i ? &selbarfg : (sel ? &selbarbg : &normbarbg)); -+ ++ drwl_setscheme(m->drw, colors[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]); ++ drwl_text(m->drw, x, 0, w, m->b.height, m->lrpad / 2, tags[i], urg & 1 << i); + if (occ & 1 << i) -+ drwl_rect(pix, x + boxs, boxs, boxw, boxw, sel, -+ urg & 1 << i ? &selbarbg : (sel ? &selbarfg : &normbarfg)); -+ ++ drwl_rect(m->drw, x + boxs, boxs, boxw, boxw, ++ m == selmon && c && c->tags & 1 << i, ++ urg & 1 << i); + x += w; + } -+ + w = TEXTW(m, m->ltsymbol); -+ x = drwl_text(pix, m->font, x, 0, w, m->b.height, m->lrpad / 2, -+ m->ltsymbol, &normbarfg, &normbarbg); ++ drwl_setscheme(m->drw, colors[SchemeNorm]); ++ x = drwl_text(m->drw, x, 0, w, m->b.height, m->lrpad / 2, m->ltsymbol, 0); + + if ((w = m->b.width - tw - x) > m->b.height) { -+ if ((c = focustop(m)) != NULL) { -+ drwl_text(pix, m->font, x, 0, w, m->b.height, m->lrpad / 2, -+ client_get_title(c), -+ m == selmon ? &selbarfg : &normbarfg, -+ (m == selmon && c) ? &selbarbg : &normbarbg); ++ if (c) { ++ drwl_setscheme(m->drw, colors[m == selmon ? SchemeSel : SchemeNorm]); ++ drwl_text(m->drw, x, 0, w, m->b.height, m->lrpad / 2, client_get_title(c), 0); + if (c && c->isfloating) -+ drwl_rect(pix, x + boxs, boxs, boxw, boxw, 0, -+ m == selmon ? &selbarfg : &normbarfg); -+ } else -+ drwl_rect(pix, x, 0, w, m->b.height, 1, &normbarbg); ++ drwl_rect(m->drw, x + boxs, boxs, boxw, boxw, 0, 0); ++ } else { ++ drwl_setscheme(m->drw, colors[SchemeNorm]); ++ drwl_rect(m->drw, x, 0, w, m->b.height, 1, 1); ++ } + } + -+ pixman_image_unref(pix); ++ drwl_finish_drawing(m->drw); + wlr_scene_buffer_set_dest_size(m->scene_buffer, + m->b.real_width, m->b.real_height); + wlr_scene_node_set_position(&m->scene_buffer->node, m->m.x, @@ -707,7 +824,29 @@ index bf763df..cd484bd 100644 void focusclient(Client *c, int lift) { -@@ -1290,7 +1496,7 @@ focusclient(Client *c, int lift) +@@ -1338,13 +1541,13 @@ focusclient(Client *c, int lift) + /* Don't change border color if there is an exclusive focus or we are + * handling a drag operation */ + if (!exclusive_focus && !seat->drag) +- client_set_border_color(c, focuscolor); ++ client_set_border_color(c, (float[])COLOR(colors[SchemeSel][ColBorder])); + } + + /* Deactivate old client if focus is changing */ + if (old && (!c || client_surface(c) != old)) { + /* If an overlay is focused, don't focus or activate the client, +- * but only update its position in fstack to render its border with focuscolor ++ * but only update its position in fstack to render its border with its color + * and focus it after the overlay is closed. */ + if (old_client_type == LayerShell && wlr_scene_node_coords( + &old_l->scene->node, &unused_lx, &unused_ly) +@@ -1355,12 +1558,11 @@ focusclient(Client *c, int lift) + /* Don't deactivate old client if the new one wants focus, as this causes issues with winecfg + * and probably other clients */ + } else if (old_c && !client_is_unmanaged(old_c) && (!c || !client_wants_focus(c))) { +- client_set_border_color(old_c, bordercolor); +- ++ client_set_border_color(old_c, (float[])COLOR(colors[SchemeNorm][ColBorder])); client_activate_surface(old, 0); } } @@ -716,7 +855,16 @@ index bf763df..cd484bd 100644 if (!c) { /* With no client, all we have left is to clear focus */ -@@ -1618,7 +1824,7 @@ mapnotify(struct wl_listener *listener, void *data) +@@ -1664,7 +1866,7 @@ mapnotify(struct wl_listener *listener, void *data) + + for (i = 0; i < 4; i++) { + c->border[i] = wlr_scene_rect_create(c->scene, 0, 0, +- c->isurgent ? urgentcolor : bordercolor); ++ (float[])COLOR(colors[c->isurgent ? SchemeUrg : SchemeNorm][ColBorder])); + c->border[i]->node.data = c; + } + +@@ -1687,7 +1889,7 @@ mapnotify(struct wl_listener *listener, void *data) } else { applyrules(c); } @@ -725,7 +873,7 @@ index bf763df..cd484bd 100644 unset_fullscreen: m = c->mon ? c->mon : xytomon(c->geom.x, c->geom.y); -@@ -1904,46 +2110,6 @@ pointerfocus(Client *c, struct wlr_surface *surface, double sx, double sy, +@@ -1980,46 +2182,6 @@ pointerfocus(Client *c, struct wlr_surface *surface, double sx, double sy, wlr_seat_pointer_notify_motion(seat, time, sx, sy); } @@ -771,8 +919,8 @@ index bf763df..cd484bd 100644 -} void - quit(const Arg *arg) -@@ -2074,23 +2240,14 @@ run(char *startup_cmd) + powermgrsetmode(struct wl_listener *listener, void *data) +@@ -2173,24 +2335,16 @@ run(char *startup_cmd) /* Now that the socket exists and the backend is started, run the startup command */ if (startup_cmd) { @@ -782,6 +930,8 @@ index bf763df..cd484bd 100644 if ((child_pid = fork()) < 0) die("startup: fork:"); if (child_pid == 0) { ++ close(STDIN_FILENO); + setsid(); - dup2(piperw[0], STDIN_FILENO); - close(piperw[0]); - close(piperw[1]); @@ -797,7 +947,7 @@ index bf763df..cd484bd 100644 /* At this point the outputs are initialized, choose initial selmon based on * cursor position, and set default cursor image */ -@@ -2155,7 +2312,7 @@ setfloating(Client *c, int floating) +@@ -2256,7 +2410,7 @@ setfloating(Client *c, int floating) (p && p->isfullscreen) ? LyrFS : c->isfloating ? LyrFloat : LyrTile]); arrange(c->mon); @@ -806,7 +956,7 @@ index bf763df..cd484bd 100644 } void -@@ -2178,7 +2335,7 @@ setfullscreen(Client *c, int fullscreen) +@@ -2279,7 +2433,7 @@ setfullscreen(Client *c, int fullscreen) resize(c, c->prev, 0); } arrange(c->mon); @@ -815,7 +965,7 @@ index bf763df..cd484bd 100644 } void -@@ -2203,7 +2360,7 @@ setlayout(const Arg *arg) +@@ -2304,7 +2458,7 @@ setlayout(const Arg *arg) selmon->lt[selmon->sellt] = (Layout *)arg->v; strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, LENGTH(selmon->ltsymbol)); arrange(selmon); @@ -824,12 +974,19 @@ index bf763df..cd484bd 100644 } /* arg > 1.0 will set mfact absolutely */ -@@ -2506,6 +2663,12 @@ setup(void) +@@ -2377,6 +2531,7 @@ setup(void) + for (i = 0; i < (int)LENGTH(sig); i++) + sigaction(sig[i], &sa, NULL); + ++ + wlr_log_init(log_level, NULL); + + /* The Wayland display is managed by libwayland. It handles accepting +@@ -2563,6 +2718,11 @@ setup(void) wlr_scene_set_presentation(scene, wlr_presentation_create(dpy, backend)); -+ fcft_init(FCFT_LOG_COLORIZE_AUTO, 0, FCFT_LOG_CLASS_ERROR); -+ fcft_set_scaling_filter(FCFT_SCALING_FILTER_LANCZOS3); ++ drwl_init(); + + status_event_source = wl_event_loop_add_fd(wl_display_get_event_loop(dpy), + STDIN_FILENO, WL_EVENT_READABLE, status_in, NULL); @@ -837,7 +994,7 @@ index bf763df..cd484bd 100644 /* Make sure XWayland clients don't connect to the parent X server, * e.g when running in the x11 backend or the wayland backend and the * compositor has Xwayland support */ -@@ -2530,6 +2693,7 @@ void +@@ -2587,6 +2747,7 @@ void spawn(const Arg *arg) { if (fork() == 0) { @@ -845,7 +1002,7 @@ index bf763df..cd484bd 100644 dup2(STDERR_FILENO, STDOUT_FILENO); setsid(); execvp(((char **)arg->v)[0], (char **)arg->v); -@@ -2548,6 +2712,30 @@ startdrag(struct wl_listener *listener, void *data) +@@ -2605,6 +2766,30 @@ startdrag(struct wl_listener *listener, void *data) LISTEN_STATIC(&drag->icon->events.destroy, destroydragicon); } @@ -876,7 +1033,7 @@ index bf763df..cd484bd 100644 void tag(const Arg *arg) { -@@ -2558,7 +2746,7 @@ tag(const Arg *arg) +@@ -2615,7 +2800,7 @@ tag(const Arg *arg) sel->tags = arg->ui & TAGMASK; focusclient(focustop(selmon), 1); arrange(selmon); @@ -885,7 +1042,7 @@ index bf763df..cd484bd 100644 } void -@@ -2603,6 +2791,14 @@ tile(Monitor *m) +@@ -2660,6 +2845,14 @@ tile(Monitor *m) } } @@ -900,7 +1057,7 @@ index bf763df..cd484bd 100644 void togglefloating(const Arg *arg) { -@@ -2631,7 +2827,7 @@ toggletag(const Arg *arg) +@@ -2688,7 +2881,7 @@ toggletag(const Arg *arg) sel->tags = newtags; focusclient(focustop(selmon), 1); arrange(selmon); @@ -909,7 +1066,7 @@ index bf763df..cd484bd 100644 } void -@@ -2644,7 +2840,7 @@ toggleview(const Arg *arg) +@@ -2701,7 +2894,7 @@ toggleview(const Arg *arg) selmon->tagset[selmon->seltags] = newtagset; focusclient(focustop(selmon), 1); arrange(selmon); @@ -918,7 +1075,7 @@ index bf763df..cd484bd 100644 } void -@@ -2692,7 +2888,7 @@ unmapnotify(struct wl_listener *listener, void *data) +@@ -2749,7 +2942,7 @@ unmapnotify(struct wl_listener *listener, void *data) } wlr_scene_node_destroy(&c->scene->node); @@ -927,11 +1084,13 @@ index bf763df..cd484bd 100644 motionnotify(0, NULL, 0, 0, 0, 0); } -@@ -2788,6 +2984,12 @@ updatemons(struct wl_listener *listener, void *data) +@@ -2849,6 +3042,14 @@ updatemons(struct wl_listener *listener, void *data) } } + /* Update bar */ ++ if (stext[0] == '\0') ++ strncpy(stext, "dwl-"VERSION, sizeof(stext)); + wl_list_for_each(m, &mons, link) { + updatebar(m); + drawbar(m); @@ -940,7 +1099,7 @@ index bf763df..cd484bd 100644 /* FIXME: figure out why the cursor image is at 0,0 after turning all * the monitors on. * Move the cursor image where it used to be. It does not generate a -@@ -2798,12 +3000,36 @@ updatemons(struct wl_listener *listener, void *data) +@@ -2859,12 +3060,36 @@ updatemons(struct wl_listener *listener, void *data) wlr_output_manager_v1_set_configuration(output_mgr, config); } @@ -954,17 +1113,17 @@ index bf763df..cd484bd 100644 + m->b.width = rw; + m->b.real_width = (int)((float)m->b.width / m->wlr_output->scale); + -+ if (m->b.scale == m->wlr_output->scale && m->font) ++ if (m->b.scale == m->wlr_output->scale && m->drw) + return; + -+ fcft_destroy(m->font); ++ drwl_destroy_font(m->drw->font); + snprintf(fontattrs, sizeof(fontattrs), "dpi=%.2f", 96. * m->wlr_output->scale); -+ if (!(m->font = fcft_from_name(LENGTH(fonts), fonts, fontattrs))) ++ if (!(drwl_load_font(m->drw, LENGTH(fonts), fonts, fontattrs))) + die("Could not load font"); + + m->b.scale = m->wlr_output->scale; -+ m->lrpad = m->font->height; -+ m->b.height = m->font->height + 2; ++ m->lrpad = m->drw->font->height; ++ m->b.height = m->drw->font->height + 2; + m->b.real_height = (int)((float)m->b.height / m->wlr_output->scale); +} + @@ -978,7 +1137,7 @@ index bf763df..cd484bd 100644 } void -@@ -2816,7 +3042,7 @@ urgent(struct wl_listener *listener, void *data) +@@ -2877,10 +3102,10 @@ urgent(struct wl_listener *listener, void *data) return; c->isurgent = 1; @@ -986,8 +1145,12 @@ index bf763df..cd484bd 100644 + drawbars(); if (client_surface(c)->mapped) - client_set_border_color(c, urgentcolor); -@@ -2832,7 +3058,7 @@ view(const Arg *arg) +- client_set_border_color(c, urgentcolor); ++ client_set_border_color(c, (float[])COLOR(colors[SchemeUrg][ColBorder])); + } + + void +@@ -2893,7 +3118,7 @@ view(const Arg *arg) selmon->tagset[selmon->seltags] = arg->ui & TAGMASK; focusclient(focustop(selmon), 1); arrange(selmon); @@ -996,7 +1159,7 @@ index bf763df..cd484bd 100644 } void -@@ -2871,6 +3097,7 @@ xytonode(double x, double y, struct wlr_surface **psurface, +@@ -2934,6 +3159,7 @@ xytonode(double x, double y, struct wlr_surface **psurface, { struct wlr_scene_node *node, *pnode; struct wlr_surface *surface = NULL; @@ -1004,7 +1167,7 @@ index bf763df..cd484bd 100644 Client *c = NULL; LayerSurface *l = NULL; int layer; -@@ -2879,9 +3106,12 @@ xytonode(double x, double y, struct wlr_surface **psurface, +@@ -2942,9 +3168,12 @@ xytonode(double x, double y, struct wlr_surface **psurface, if (!(node = wlr_scene_node_at(&layers[layer]->node, x, y, nx, ny))) continue; @@ -1020,7 +1183,7 @@ index bf763df..cd484bd 100644 /* Walk the tree to find a node that knows the client */ for (pnode = node; pnode && !c; pnode = &pnode->parent->node) c = pnode->data; -@@ -3020,7 +3250,7 @@ sethints(struct wl_listener *listener, void *data) +@@ -3083,10 +3312,10 @@ sethints(struct wl_listener *listener, void *data) return; c->isurgent = xcb_icccm_wm_hints_get_urgency(c->surface.xwayland->hints); @@ -1028,7 +1191,11 @@ index bf763df..cd484bd 100644 + drawbars(); if (c->isurgent && surface && surface->mapped) - client_set_border_color(c, urgentcolor); +- client_set_border_color(c, urgentcolor); ++ client_set_border_color(c, COLOR(colors[SchemeUrg][ColBorder]); + } + + void -- -2.45.0 +2.45.2 diff --git a/patches/barborder/README.md b/patches/barborder/README.md index 9400fc7..dcb23e1 100644 --- a/patches/barborder/README.md +++ b/patches/barborder/README.md @@ -3,7 +3,8 @@ Add a border around the [bar](https://codeberg.org/dwl/dwl-patches/wiki/bar) similar to how a client is given a border. ### Download -- [2024-06-10](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/barborder/barborder.patch) (bar 2024-06-10) +- [git branch](https://codeberg.org/sewn/dwl/src/branch/barborder) +- [2024-06-26](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/barborder/barborder.patch) (bar 2024-06-26) ### Authors - [sewn](https://codeberg.org/sewn) diff --git a/patches/barborder/barborder.patch b/patches/barborder/barborder.patch index c616dd1..36244ba 100644 --- a/patches/barborder/barborder.patch +++ b/patches/barborder/barborder.patch @@ -1,15 +1,15 @@ -From 1589ba9e16216e13dcc77e08b638f86ba41d47eb Mon Sep 17 00:00:00 2001 +From 7fbc305cacfba68568caed79b73603dae5389328 Mon Sep 17 00:00:00 2001 From: sewn Date: Mon, 10 Jun 2024 14:59:12 +0300 Subject: [PATCH] add border to bar --- config.def.h | 3 ++- - dwl.c | 27 ++++++++++++++++----------- - 2 files changed, 18 insertions(+), 12 deletions(-) + dwl.c | 31 +++++++++++++++++++------------ + 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/config.def.h b/config.def.h -index d0bb5bc..9387dea 100644 +index 6024b7e..86c07d6 100644 --- a/config.def.h +++ b/config.def.h @@ -6,7 +6,7 @@ @@ -18,111 +18,115 @@ index d0bb5bc..9387dea 100644 static const int bypass_surface_visibility = 0; /* 1 means idle inhibitors will disable idle tracking even if it's surface isn't visible */ -static const unsigned int borderpx = 1; /* border pixel of windows */ +static const unsigned int borderpx = 1; /* border pixel of windows & bar */ - static const float rootcolor[] = COLOR(0x000000ff); - static const float bordercolor[] = COLOR(0x444444ff); - static const float focuscolor[] = COLOR(0x005577ff); -@@ -18,6 +18,7 @@ static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You ca - static const int showbar = 1; /* 0 means no bar */ - static const int topbar = 1; /* 0 means bottom bar */ - static const char *fonts[] = {"monospace:size=10"}; -+static pixman_color_t borderbar = { 0x5555, 0x7777, 0x0000, 0xffff }; - static pixman_color_t normbarfg = { 0xbbbb, 0xbbbb, 0xbbbb, 0xffff }; - static pixman_color_t normbarbg = { 0x2222, 0x2222, 0x2222, 0xffff }; - static pixman_color_t selbarfg = { 0xeeee, 0xeeee, 0xeeee, 0xffff }; + static const int showbar = 1; /* 0 means no bar */ + static const int topbar = 1; /* 0 means bottom bar */ + static const char *fonts[] = {"monospace:size=10"}; +@@ -18,6 +18,7 @@ static uint32_t colors[][3] = { + [SchemeNorm] = { 0xbbbbbbff, 0x222222ff, 0x444444ff }, + [SchemeSel] = { 0xeeeeeeff, 0x005577ff, 0x005577ff }, + [SchemeUrg] = { 0, 0, 0x770000ff }, ++ [SchemeBar] = { 0, 0, 0x557700ff }, + }; + + /* tagging - TAGCOUNT must be no greater than 31 */ diff --git a/dwl.c b/dwl.c -index cd484bd..679409f 100644 +index 72b4abb..1f40d5e 100644 --- a/dwl.c +++ b/dwl.c -@@ -1349,7 +1349,8 @@ dirtomon(enum wlr_direction dir) +@@ -85,7 +85,7 @@ + #define TEXTW(mon, text) (drwl_font_getwidth(mon->drw, text) + mon->lrpad) + + /* enums */ +-enum { SchemeNorm, SchemeSel, SchemeUrg }; /* color schemes */ ++enum { SchemeNorm, SchemeSel, SchemeUrg, SchemeBar }; /* color schemes */ + enum { CurNormal, CurPressed, CurMove, CurResize }; /* cursor */ + enum { XDGShell, LayerShell, X11 }; /* client types */ + enum { LyrBg, LyrBottom, LyrTile, LyrFloat, LyrTop, LyrFS, LyrOverlay, LyrBlock, NUM_LAYERS }; /* scene layers */ +@@ -1426,7 +1426,8 @@ dirtomon(enum wlr_direction dir) void drawbar(Monitor *m) { - int x, w, tw = 0; + int x, y = borderpx, w, tw = 0; + int mh, mw; - int sel; - int boxs = m->font->height / 9; - int boxw = m->font->height / 6 + 2; -@@ -1362,6 +1363,8 @@ drawbar(Monitor *m) + int boxs = m->drw->font->height / 9; + int boxw = m->drw->font->height / 6 + 2; + uint32_t i, occ = 0, urg = 0; +@@ -1437,6 +1438,8 @@ drawbar(Monitor *m) if (!m->showbar) return; + mh = m->b.height - borderpx * 2; + mw = m->b.width - borderpx * 2; - stride = m->b.width * 4; + stride = drwl_stride(m->b.width); size = stride * m->b.height; -@@ -1372,12 +1375,14 @@ drawbar(Monitor *m) - pix = pixman_image_create_bits( - PIXMAN_a8r8g8b8, m->b.width, m->b.height, buf->data, stride); +@@ -1446,11 +1449,15 @@ drawbar(Monitor *m) -+ drwl_rect(pix, 0, 0, m->b.width, m->b.height, 1, &borderbar); + drwl_prepare_drawing(m->drw, m->b.width, m->b.height, buf->data, stride); + ++ drwl_setscheme(m->drw, colors[SchemeBar]); ++ drwl_rect(m->drw, 0, 0, m->b.width, m->b.height, 1, 1); ++ drwl_setscheme(m->drw, colors[SchemeNorm]); + /* draw status first so it can be overdrawn by tags later */ - if (m == selmon) { - if (stext[0] == '\0') - strncpy(stext, "dwl-"VERSION, sizeof(stext)); - tw = TEXTW(m, stext) - m->lrpad; -- drwl_text(pix, m->font, m->b.width - tw, 0, tw, m->b.height, 0, -+ drwl_text(pix, m->font, borderpx + mw - tw, y, tw, mh, 0, - stext, &normbarfg, &normbarbg); + if (m == selmon) { /* status is only drawn on selected monitor */ + drwl_setscheme(m->drw, colors[SchemeNorm]); + tw = TEXTW(m, stext) - m->lrpad + 2; /* 2px right padding */ +- drwl_text(m->drw, m->b.width - tw, 0, tw, m->b.height, 0, stext, 0); ++ drwl_text(m->drw, borderpx + mw - tw, y, tw, mh, 0, stext, 0); } -@@ -1388,37 +1393,37 @@ drawbar(Monitor *m) + wl_list_for_each(c, &clients, link) { +@@ -1460,31 +1467,31 @@ drawbar(Monitor *m) if (c->isurgent) urg |= c->tags; } - x = 0; + x = borderpx; + c = focustop(m); for (i = 0; i < LENGTH(tags); i++) { w = TEXTW(m, tags[i]); - sel = m->tagset[m->seltags] & 1 << i; - -- drwl_text(pix, m->font, x, 0, w, m->b.height, m->lrpad / 2, tags[i], -+ drwl_text(pix, m->font, x, y, w, mh, m->lrpad / 2, tags[i], - urg & 1 << i ? &selbarbg : (sel ? &selbarfg : &normbarfg), - urg & 1 << i ? &selbarfg : (sel ? &selbarbg : &normbarbg)); - + drwl_setscheme(m->drw, colors[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]); +- drwl_text(m->drw, x, 0, w, m->b.height, m->lrpad / 2, tags[i], urg & 1 << i); ++ drwl_text(m->drw, x, y, w, mh, m->lrpad / 2, tags[i], urg & 1 << i); if (occ & 1 << i) -- drwl_rect(pix, x + boxs, boxs, boxw, boxw, sel, -+ drwl_rect(pix, x + boxs, y + boxs, boxw, boxw, sel, - urg & 1 << i ? &selbarbg : (sel ? &selbarfg : &normbarfg)); - +- drwl_rect(m->drw, x + boxs, boxs, boxw, boxw, ++ drwl_rect(m->drw, x + boxs, y + boxs, boxw, boxw, + m == selmon && c && c->tags & 1 << i, + urg & 1 << i); x += w; } - w = TEXTW(m, m->ltsymbol); -- x = drwl_text(pix, m->font, x, 0, w, m->b.height, m->lrpad / 2, -+ x = drwl_text(pix, m->font, x, y, w, mh, m->lrpad / 2, - m->ltsymbol, &normbarfg, &normbarbg); + drwl_setscheme(m->drw, colors[SchemeNorm]); +- x = drwl_text(m->drw, x, 0, w, m->b.height, m->lrpad / 2, m->ltsymbol, 0); ++ x = drwl_text(m->drw, x, y, w, mh, m->lrpad / 2, m->ltsymbol, 0); - if ((w = m->b.width - tw - x) > m->b.height) { + if ((w = mw - tw - x + borderpx) > mh) { - if ((c = focustop(m)) != NULL) { -- drwl_text(pix, m->font, x, 0, w, m->b.height, m->lrpad / 2, -+ drwl_text(pix, m->font, x, y, w, mh, m->lrpad / 2, - client_get_title(c), - m == selmon ? &selbarfg : &normbarfg, - (m == selmon && c) ? &selbarbg : &normbarbg); + if (c) { + drwl_setscheme(m->drw, colors[m == selmon ? SchemeSel : SchemeNorm]); +- drwl_text(m->drw, x, 0, w, m->b.height, m->lrpad / 2, client_get_title(c), 0); ++ drwl_text(m->drw, x, y, w, mh, m->lrpad / 2, client_get_title(c), 0); if (c && c->isfloating) -- drwl_rect(pix, x + boxs, boxs, boxw, boxw, 0, -+ drwl_rect(pix, x + boxs, y + boxs, boxw, boxw, 0, - m == selmon ? &selbarfg : &normbarfg); - } else -- drwl_rect(pix, x, 0, w, m->b.height, 1, &normbarbg); -+ drwl_rect(pix, x, y, w, mh, 1, &normbarbg); +- drwl_rect(m->drw, x + boxs, boxs, boxw, boxw, 0, 0); ++ drwl_rect(m->drw, x + boxs, y + boxs, boxw, boxw, 0, 0); + } else { + drwl_setscheme(m->drw, colors[SchemeNorm]); +- drwl_rect(m->drw, x, 0, w, m->b.height, 1, 1); ++ drwl_rect(m->drw, x, y, w, mh, 1, 1); + } } - pixman_image_unref(pix); -@@ -3020,7 +3025,7 @@ updatebar(Monitor *m) +@@ -3080,7 +3087,7 @@ updatebar(Monitor *m) m->b.scale = m->wlr_output->scale; - m->lrpad = m->font->height; -- m->b.height = m->font->height + 2; -+ m->b.height = m->font->height + 2 + borderpx * 2; + m->lrpad = m->drw->font->height; +- m->b.height = m->drw->font->height + 2; ++ m->b.height = m->drw->font->height + 2 + borderpx * 2; m->b.real_height = (int)((float)m->b.height / m->wlr_output->scale); } -- -2.45.0 +2.45.2 diff --git a/patches/barpadding/README.md b/patches/barpadding/README.md index a18207b..cb6e4af 100644 --- a/patches/barpadding/README.md +++ b/patches/barpadding/README.md @@ -3,7 +3,8 @@ Add vertical and horizontal space between the [bar](https://codeberg.org/dwl/dwl-patches/wiki/bar) and the edge of the screen. ### Download -- [2024-06-10](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/barpadding/barpadding.patch) (bar 2024-06-10) +- [git branch](https://codeberg.org/sewn/dwl/src/branch/barborder) +- [2024-06-26](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/barpadding/barpadding.patch) (bar 2024-06-26) ### Authors - [sewn](https://codeberg.org/sewn) diff --git a/patches/barpadding/barpadding.patch b/patches/barpadding/barpadding.patch index d704f8a..728d687 100644 --- a/patches/barpadding/barpadding.patch +++ b/patches/barpadding/barpadding.patch @@ -1,4 +1,4 @@ -From 69af490e9ad6213463c043db736547bffddd77d2 Mon Sep 17 00:00:00 2001 +From 504fb68dc63072b7184273c658f572bca1688996 Mon Sep 17 00:00:00 2001 From: sewn Date: Mon, 10 Jun 2024 16:33:52 +0300 Subject: [PATCH] add vertical and horizontal spacing to bar @@ -10,23 +10,23 @@ https://dwm.suckless.org/patches/barpadding/ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/config.def.h b/config.def.h -index d0bb5bc..8dc2e85 100644 +index 6024b7e..4d438ab 100644 --- a/config.def.h +++ b/config.def.h -@@ -17,6 +17,8 @@ static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You ca - /* bar */ - static const int showbar = 1; /* 0 means no bar */ - static const int topbar = 1; /* 0 means bottom bar */ -+static const int vertpad = 10; /* vertical padding of bar */ -+static const int sidepad = 10; /* horizontal padding of bar */ - static const char *fonts[] = {"monospace:size=10"}; - static pixman_color_t normbarfg = { 0xbbbb, 0xbbbb, 0xbbbb, 0xffff }; - static pixman_color_t normbarbg = { 0x2222, 0x2222, 0x2222, 0xffff }; +@@ -9,6 +9,8 @@ static const int bypass_surface_visibility = 0; /* 1 means idle inhibitors will + static const unsigned int borderpx = 1; /* border pixel of windows */ + static const int showbar = 1; /* 0 means no bar */ + static const int topbar = 1; /* 0 means bottom bar */ ++static const int vertpad = 10; /* vertical padding of bar */ ++static const int sidepad = 10; /* horizontal padding of bar */ + static const char *fonts[] = {"monospace:size=10"}; + static const float rootcolor[] = COLOR(0x000000ff); + /* This conforms to the xdg-protocol. Set the alpha to zero to restore the old behavior */ diff --git a/dwl.c b/dwl.c -index cd484bd..eec0dd7 100644 +index 72b4abb..b26cb9c 100644 --- a/dwl.c +++ b/dwl.c -@@ -572,8 +572,8 @@ arrangelayers(Monitor *m) +@@ -591,8 +591,8 @@ arrangelayers(Monitor *m) return; if (m->showbar) { @@ -37,8 +37,8 @@ index cd484bd..eec0dd7 100644 } /* Arrange exclusive surfaces from top->bottom */ -@@ -1424,8 +1424,8 @@ drawbar(Monitor *m) - pixman_image_unref(pix); +@@ -1491,8 +1491,8 @@ drawbar(Monitor *m) + drwl_finish_drawing(m->drw); wlr_scene_buffer_set_dest_size(m->scene_buffer, m->b.real_width, m->b.real_height); - wlr_scene_node_set_position(&m->scene_buffer->node, m->m.x, @@ -48,7 +48,7 @@ index cd484bd..eec0dd7 100644 wlr_scene_buffer_set_buffer(m->scene_buffer, &buf->base); wlr_buffer_drop(&buf->base); } -@@ -3007,7 +3007,7 @@ updatebar(Monitor *m) +@@ -3067,7 +3067,7 @@ updatebar(Monitor *m) char fontattrs[12]; wlr_output_transformed_resolution(m->wlr_output, &rw, &rh); @@ -56,7 +56,7 @@ index cd484bd..eec0dd7 100644 + m->b.width = rw - 2 * sidepad; m->b.real_width = (int)((float)m->b.width / m->wlr_output->scale); - if (m->b.scale == m->wlr_output->scale && m->font) + if (m->b.scale == m->wlr_output->scale && m->drw) -- -2.45.0 +2.45.2 diff --git a/patches/hide_vacant_tags/README.md b/patches/hide_vacant_tags/README.md index fa04572..fa81201 100644 --- a/patches/hide_vacant_tags/README.md +++ b/patches/hide_vacant_tags/README.md @@ -4,7 +4,8 @@ Prevent [bar](https://codeberg.org/dwl/dwl-patches/wiki/bar) from drawing tags w It also stops drawing empty rectangles on the bar for non-vacant tags as there is no need anymore to distinguish vacant tags and it offers a more visible contrast than if there were filled/empty rectangles. ### Download -- [2024-06-10](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/hide_vacant_tags/hide_vacant_tags.patch) (bar 2024-06-10) +- [git branch](https://codeberg.org/sewn/dwl/src/branch/hide_vacant_tags) +- [2024-06-26](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/hide_vacant_tags/hide_vacant_tags.patch) (bar 2024-06-26) ### Authors - [sewn](https://codeberg.org/sewn) diff --git a/patches/hide_vacant_tags/hide_vacant_tags.patch b/patches/hide_vacant_tags/hide_vacant_tags.patch index 93c2224..6c413ff 100644 --- a/patches/hide_vacant_tags/hide_vacant_tags.patch +++ b/patches/hide_vacant_tags/hide_vacant_tags.patch @@ -1,18 +1,18 @@ -From be3ef9ff5373e004cd8ed564a9671cd190e1db40 Mon Sep 17 00:00:00 2001 +From fcf10002eb978d724bc2e53f3a88409eb4422b7e Mon Sep 17 00:00:00 2001 From: sewn Date: Mon, 10 Jun 2024 14:50:07 +0300 Subject: [PATCH] hide vacant tags https://dwm.suckless.org/patches/hide_vacant_tags/ --- - dwl.c | 23 ++++++++++++++--------- - 1 file changed, 14 insertions(+), 9 deletions(-) + dwl.c | 17 +++++++++++++---- + 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/dwl.c b/dwl.c -index cd484bd..de474a6 100644 +index 72b4abb..63cf7b7 100644 --- a/dwl.c +++ b/dwl.c -@@ -654,7 +654,7 @@ void buffer_end_data_ptr_access(struct wlr_buffer *buffer) { +@@ -675,7 +675,7 @@ buffer_end_data_ptr_access(struct wlr_buffer *buffer) void buttonpress(struct wl_listener *listener, void *data) { @@ -21,9 +21,9 @@ index cd484bd..de474a6 100644 unsigned int click; struct wlr_pointer_button_event *event = data; struct wlr_keyboard *keyboard; -@@ -675,9 +675,16 @@ buttonpress(struct wl_listener *listener, void *data) - if (!c && (node = wlr_scene_node_at(&layers[LyrBottom]->node, cursor->x, cursor->y, NULL, NULL)) && - (buffer = wlr_scene_buffer_from_node(node)) && buffer == selmon->scene_buffer) { +@@ -699,9 +699,16 @@ buttonpress(struct wl_listener *listener, void *data) + cursor->x *= selmon->wlr_output->scale; + cursor->y *= selmon->wlr_output->scale; x = selmon->m.x; - do + wl_list_for_each(c, &clients, link) { @@ -40,7 +40,7 @@ index cd484bd..de474a6 100644 if (i < LENGTH(tags)) { click = ClkTagBar; arg.ui = 1 << i; -@@ -1384,23 +1391,21 @@ drawbar(Monitor *m) +@@ -1456,13 +1463,15 @@ drawbar(Monitor *m) wl_list_for_each(c, &clients, link) { if (c->mon != m) continue; @@ -50,24 +50,13 @@ index cd484bd..de474a6 100644 urg |= c->tags; } x = 0; + c = focustop(m); for (i = 0; i < LENGTH(tags); i++) { -- w = TEXTW(m, tags[i]); - sel = m->tagset[m->seltags] & 1 << i; -+ if(!(occ & 1 << i || sel)) ++ if(!(occ & 1 << i || m->tagset[m->seltags] & 1 << i)) + continue; -+ w = TEXTW(m, tags[i]); - - drwl_text(pix, m->font, x, 0, w, m->b.height, m->lrpad / 2, tags[i], - urg & 1 << i ? &selbarbg : (sel ? &selbarfg : &normbarfg), - urg & 1 << i ? &selbarfg : (sel ? &selbarbg : &normbarbg)); - -- if (occ & 1 << i) -- drwl_rect(pix, x + boxs, boxs, boxw, boxw, sel, -- urg & 1 << i ? &selbarbg : (sel ? &selbarfg : &normbarfg)); -- - x += w; - } - + w = TEXTW(m, tags[i]); + drwl_setscheme(m->drw, colors[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]); + drwl_text(m->drw, x, 0, w, m->b.height, m->lrpad / 2, tags[i], urg & 1 << i); -- -2.45.0 +2.45.2