ref: 7d13a18d58a4f4ea7857dfec22c1620ce7ab55b9
parent: 52eee1a7248f03b76d1599e1615510e4adfa5e4d
author: Sigrid Solveig Haflínudóttir <ftrvxmtrx@gmail.com>
date: Tue Jan 26 06:46:32 EST 2021
fix wet floor
--- a/bar.c
+++ b/bar.c
@@ -192,7 +192,7 @@
Binit(&b, 0, OREAD);
for(;;){
s = Brdstr(&b, '\n', 1);
- sendp(c, s);
+ sendp(c, s ? s : strdup(""));
if(s == nil)
break;
}
@@ -253,6 +253,18 @@
if((local = tzload("local")) == nil)
sysfatal("zone: %r");
+ brgb = DPalegreygreen;
+ if((b = Bopen("/dev/theme", OREAD)) != nil){
+ while((s = Brdline(b, '\n')) != nil){
+ s[Blinelen(b)-1] = 0;
+ if(tokenize(s, v, nelem(v)) > 1 && strcmp(v[0], "ltitle") == 0){
+ brgb = strtoul(v[1], nil, 16)<<8 | 0xff;
+ break;
+ }
+ }
+ Bterm(b);
+ }
+
if((wctl = open("/dev/wctl", ORDWR)) < 0)
sysfatal("%r");
bat = open("/mnt/acpi/battery", OREAD);
@@ -266,27 +278,16 @@
if((kctl = initkeyboard(nil)) == nil)
sysfatal("initkeyboard: %r");
- a[Emouse].c = mctl->c;
- a[Eresize].c = mctl->resizec;
- a[Ekeyboard].c = kctl->c;
- a[Eaux].c = chancreate(sizeof(s), 4);
-
- brgb = DPalegreygreen;
- if((b = Bopen("/dev/theme", OREAD)) != nil){
- while((s = Brdline(b, '\n')) != nil){
- s[Blinelen(b)-1] = 0;
- if(tokenize(s, v, nelem(v)) > 1 && strcmp(v[0], "ltitle") == 0){
- brgb = strtoul(v[1], nil, 16)<<8 | 0xff;
- break;
- }
- }
- Bterm(b);
- }
cback = allocimage(display, Rect(0,0,1,1), RGB24, 1, brgb);
brgb = ~(brgb>>8 | brgb>>16 | brgb>>24);
brgb = brgb<<8 | brgb<<16 | brgb<<24 | 0xff;
ctext = allocimage(display, Rect(0,0,1,1), RGB24, 1, brgb);
+ a[Emouse].c = mctl->c;
+ a[Eresize].c = mctl->resizec;
+ a[Ekeyboard].c = kctl->c;
+ a[Eaux].c = chancreate(sizeof(s), 0);
+
aux = strdup("");
readbattery();
redraw();
@@ -309,13 +310,15 @@
case Eresize:
if(getwindow(display, Refnone) < 0)
threadexitsall(nil);
- /* wet floor */
+ redraw();
+ place();
+ break;
case Eaux:
if(wctl >= 0)
fprint(wctl, bottom ? "bottom" : "top");
free(aux);
- aux = strdup(s ? s : "");
+ aux = s;
redraw();
place();
break;