Rebased barcolors patch onto 0.7

This commit is contained in:
Kerberoge 2024-08-06 14:52:09 +02:00
parent b6c3f3dc75
commit 8a3694b588
2 changed files with 17 additions and 19 deletions

View File

@ -1,12 +1,9 @@
### Description ### Description
Adds support for colored status text. Text can be colored in the same manner as with dwlb, namely by wrapping it between `^fg(color)` and `^fg()` or `^bg(color)` and `^bg()`, where `color` is a 6-digit hexadecimal value. This patch only works if the bar patch has been applied before. Add support for colored status text to the [bar](/dwl/dwl-patches/wiki/bar). Text can be colored in the same manner as with dwlb, namely by wrapping it between `^fg(color)` and `^fg()` or `^bg(color)` and `^bg()`, where `color` is a 6-digit hexadecimal value.
### Download ### Download
- [git branch](https://codeberg.org/kerberoge/dwl/src/branch/barcolors) - [git branch](/kerberoge/dwl/src/branch/barcolors)
- [2024-07-28](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/barcolors/barcolors.patch) - [0.7](/dwl/dwl-patches/raw/branch/main/patches/barcolors/barcolors.patch)
### Authors ### Authors
- [Kerberoge](https://codeberg.org/kerberoge) - [kerberoge](https://codeberg.org/kerberoge)
sjoerdenjh@gmail.com
kerberoge at [Libera IRC dwl channel](https://web.libera.chat/?channels=#dwl)
kerberoge at [dwl Discord](https://discord.gg/jJxZnrGPWN)

View File

@ -1,17 +1,17 @@
From 14d59d55fe815a081d99db4090febaf69b482ded Mon Sep 17 00:00:00 2001 From 48802fb29c352edcf77e7c85dca1eed872ccb62a Mon Sep 17 00:00:00 2001
From: Kerberoge <sjoerdenjh@gmail.com> From: Kerberoge <sjoerdenjh@gmail.com>
Date: Sun, 28 Jul 2024 13:02:41 +0200 Date: Tue, 6 Aug 2024 14:22:23 +0200
Subject: [PATCH] Created barcolors patch Subject: [PATCH 1/1] Updated barcolors patch
--- ---
dwl.c | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++++++---- dwl.c | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++++++----
1 file changed, 82 insertions(+), 6 deletions(-) 1 file changed, 83 insertions(+), 6 deletions(-)
diff --git a/dwl.c b/dwl.c diff --git a/dwl.c b/dwl.c
index 60f3087..40c094e 100644 index 8614fdd..551bdcf 100644
--- a/dwl.c --- a/dwl.c
+++ b/dwl.c +++ b/dwl.c
@@ -313,6 +313,7 @@ static void destroykeyboardgroup(struct wl_listener *listener, void *data); @@ -312,6 +312,7 @@ static void destroykeyboardgroup(struct wl_listener *listener, void *data);
static Monitor *dirtomon(enum wlr_direction dir); static Monitor *dirtomon(enum wlr_direction dir);
static void drawbar(Monitor *m); static void drawbar(Monitor *m);
static void drawbars(void); static void drawbars(void);
@ -19,7 +19,7 @@ index 60f3087..40c094e 100644
static void focusclient(Client *c, int lift); static void focusclient(Client *c, int lift);
static void focusmon(const Arg *arg); static void focusmon(const Arg *arg);
static void focusstack(const Arg *arg); static void focusstack(const Arg *arg);
@@ -443,7 +444,7 @@ static struct wlr_box sgeom; @@ -442,7 +443,7 @@ static struct wlr_box sgeom;
static struct wl_list mons; static struct wl_list mons;
static Monitor *selmon; static Monitor *selmon;
@ -28,7 +28,7 @@ index 60f3087..40c094e 100644
static struct wl_event_source *status_event_source; static struct wl_event_source *status_event_source;
static const struct wlr_buffer_impl buffer_impl = { static const struct wlr_buffer_impl buffer_impl = {
@@ -1480,11 +1481,8 @@ drawbar(Monitor *m) @@ -1479,11 +1480,8 @@ drawbar(Monitor *m)
drwl_prepare_drawing(m->drw, 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 */ /* draw status first so it can be overdrawn by tags later */
@ -42,7 +42,7 @@ index 60f3087..40c094e 100644
wl_list_for_each(c, &clients, link) { wl_list_for_each(c, &clients, link) {
if (c->mon != m) if (c->mon != m)
@@ -1539,6 +1537,84 @@ drawbars(void) @@ -1538,6 +1536,85 @@ drawbars(void)
drawbar(m); drawbar(m);
} }
@ -120,7 +120,8 @@ index 60f3087..40c094e 100644
+ } + }
+ } + }
+ iw = TEXTW(m, itext) - m->lrpad; + iw = TEXTW(m, itext) - m->lrpad;
+ drwl_text(m->drw, x, 0, iw, m->b.height, 0, itext, 0); + if (*itext)
+ drwl_text(m->drw, x, 0, iw, m->b.height, 0, itext, 0);
+ return tw; + return tw;
+} +}
+ +
@ -128,5 +129,5 @@ index 60f3087..40c094e 100644
focusclient(Client *c, int lift) focusclient(Client *c, int lift)
{ {
-- --
2.45.2 2.46.0