dwm-status2d-swap-save-restore-6.2.diff - sites - public wiki contents of suckless.org
(HTM) git clone git://git.suckless.org/sites
(DIR) Log
(DIR) Files
(DIR) Refs
---
dwm-status2d-swap-save-restore-6.2.diff (1369B)
---
1 From dfd158c8dea87a0a4dbc5b2eda7c096069d1484a Mon Sep 17 00:00:00 2001
2 From: tdu <tdukv@protonmail.com>
3 Date: Wed, 26 Aug 2020 18:50:09 +0300
4 Subject: [PATCH] Add the following tags for the status2d patch: ^w^ -
5 Swaps bg/fg color. ^v^ - Saves the current fg/bg color. ^t^ - Restores
6 the previously saved bg/fg color.
7
8 ---
9 dwm.c | 12 ++++++++++++
10 1 file changed, 12 insertions(+)
11
12 diff --git a/dwm.c b/dwm.c
13 index 931044f..de07b66 100644
14 --- a/dwm.c
15 +++ b/dwm.c
16 @@ -699,6 +699,7 @@ drawstatusbar(Monitor *m, int bh, char* stext) {
17 short isCode = 0;
18 char *text;
19 char *p;
20 + Clr oldbg, oldfg;
21
22 len = strlen(stext) + 1 ;
23 if (!(text = (char*) malloc(sizeof(char)*len)))
24 @@ -769,6 +770,17 @@ drawstatusbar(Monitor *m, int bh, char* stext) {
25 } else if (text[i] == 'd') {
26 drw->scheme[ColFg] = scheme[SchemeNorm][ColFg];
27 drw->scheme[ColBg] = scheme[SchemeNorm][ColBg];
28 + } else if (text[i] == 'w') {
29 + Clr swp;
30 + swp = drw->scheme[ColFg];
31 + drw->scheme[ColFg] = drw->scheme[ColBg];
32 + drw->scheme[ColBg] = swp;
33 + } else if (text[i] == 'v') {
34 + oldfg = drw->scheme[ColFg];
35 + oldbg = drw->scheme[ColBg];
36 + } else if (text[i] == 't') {
37 + drw->scheme[ColFg] = oldfg;
38 + drw->scheme[ColBg] = oldbg;
39 } else if (text[i] == 'r') {
40 int rx = atoi(text + ++i);
41 while (text[++i] != ',');
42 --
43 2.28.0
44