From 376b48e4d21258e6de5e8da014e555aca399703b Mon Sep 17 00:00:00 2001 From: bakkeby Date: Thu, 27 Aug 2020 06:30:48 +0200 Subject: [PATCH] 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. --- patch/bar_status2d.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/patch/bar_status2d.c b/patch/bar_status2d.c index d7ae08f..48bccdf 100644 --- a/patch/bar_status2d.c +++ b/patch/bar_status2d.c @@ -61,6 +61,7 @@ drawstatusbar(int x, char* stext) short isCode = 0; char *text; char *p; + Clr oldbg, oldfg; len = strlen(stext) + 1; if (!(text = (char*) malloc(sizeof(char)*len))) die("malloc"); @@ -125,6 +126,17 @@ drawstatusbar(int x, char* stext) } else if (text[i] == 'd') { drw->scheme[ColFg] = scheme[SchemeNorm][ColFg]; 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') { int rx = atoi(text + ++i); while (text[++i] != ',');