Add the following tags for the status2d patch: ^w^ -

Swaps bg/fg color.     ^v^ - Saves the current fg/bg color.    ^t^ - Restores
the previously saved bg/fg color.

As proposed by tdu to hackers@suckless.org.
This commit is contained in:
bakkeby 2020-08-27 06:30:48 +02:00
parent e952cc9a81
commit 376b48e4d2

View File

@ -61,6 +61,7 @@ drawstatusbar(int x, char* stext)
short isCode = 0; short isCode = 0;
char *text; char *text;
char *p; char *p;
Clr oldbg, oldfg;
len = strlen(stext) + 1; len = strlen(stext) + 1;
if (!(text = (char*) malloc(sizeof(char)*len))) if (!(text = (char*) malloc(sizeof(char)*len)))
die("malloc"); die("malloc");
@ -125,6 +126,17 @@ drawstatusbar(int x, char* stext)
} else if (text[i] == 'd') { } else if (text[i] == 'd') {
drw->scheme[ColFg] = scheme[SchemeNorm][ColFg]; drw->scheme[ColFg] = scheme[SchemeNorm][ColFg];
drw->scheme[ColBg] = scheme[SchemeNorm][ColBg]; drw->scheme[ColBg] = scheme[SchemeNorm][ColBg];
} else if (text[i] == 'w') {
Clr swp;
swp = drw->scheme[ColFg];
drw->scheme[ColFg] = drw->scheme[ColBg];
drw->scheme[ColBg] = swp;
} else if (text[i] == 'v') {
oldfg = drw->scheme[ColFg];
oldbg = drw->scheme[ColBg];
} else if (text[i] == 't') {
drw->scheme[ColFg] = oldfg;
drw->scheme[ColBg] = oldbg;
} else if (text[i] == 'r') { } else if (text[i] == 'r') {
int rx = atoi(text + ++i); int rx = atoi(text + ++i);
while (text[++i] != ','); while (text[++i] != ',');