shithub: patch

Download patch

ref: 368dd6ad29ac747ea16ec6b48617828912d7f3a0
parent: 3f7afb296664f40fd56a48a35321b7c62def5757
author: qwx <qwx@sciops.net>
date: Sun Mar 6 06:57:22 EST 2022

bar-col: update for /dev/theme

--- a/bar-col
+++ b/bar-col
@@ -1,21 +1,45 @@
 diff 46d9e65b6623956bc7b1f8d982dc986951cb4962 uncommitted
 --- a/bar.c
 +++ b/bar.c
-@@ -311,7 +311,7 @@
+@@ -241,7 +241,7 @@
+ 	uvlong t, oldt;
+ 	int oldbuttons;
+ 	char *s, *v[3];
+-	u32int brgb;
++	u32int trgb;
+ 	Biobuf *b;
+ 	Rune key;
+ 	Mouse m;
+@@ -286,12 +286,12 @@
+ 	if((local = tzload("local")) == nil)
+ 		sysfatal("zone: %r");
+ 
+-	brgb = DPalegreygreen;
++	trgb = 0xff;
+ 	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;
++			if(tokenize(s, v, nelem(v)) > 1 && strcmp(v[0], "menutext") == 0){
++				trgb = strtoul(v[1], nil, 16)<<8 | 0xff;
+ 				break;
+ 			}
+ 		}
+@@ -311,14 +311,8 @@
  	if((kctl = initkeyboard(nil)) == nil)
  		sysfatal("initkeyboard: %r");
  
 -	cback = allocimage(display, Rect(0,0,1,1), RGB24, 1, brgb);
-+	cback = display->black;
- 	if(brgb == DPalegreygreen)
- 		brgb = DBlack;
- 	else{ /* dunno, just invert */
-@@ -318,7 +318,7 @@
- 		brgb = ~(brgb>>8 | brgb>>16 | brgb>>24);
- 		brgb = brgb<<8 | brgb<<16 | brgb<<24 | 0xff;
- 	}
+-	if(brgb == DPalegreygreen)
+-		brgb = DBlack;
+-	else{ /* dunno, just invert */
+-		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);
-+	ctext = allocimage(display, Rect(0,0,1,1), RGB24, 1, 0x884400FF);
++	cback = display->black;
++	ctext = allocimage(display, Rect(0,0,1,1), RGB24, 1, trgb);
  
  	a[Emouse].c = mctl->c;
  	a[Eresize].c = mctl->resizec;