shithub: bar

Download patch

ref: b2c7b666c866e32e60134c5ef34ee51705dc3a4d
parent: 0574a2b65135d7ae63cd9910f8fed6f1d0838289
author: Sigrid Solveig Haflínudóttir <[email protected]>
date: Sun Dec 6 07:50:56 EST 2020

rio allows smaller windows, update the logic

--- a/bar.c
+++ b/bar.c
@@ -10,10 +10,10 @@
 #define MAX(a,b) ((a)>=(b)?(a):(b))
 
 enum {
-	Off = 4,
+	Off = 3,
 };
 
-static int wctl, width, bottom, bat;
+static int wctl, width, bottom, bat, minheight;
 static Image *cback, *ctext;
 static char *pos = "rb";
 static Tzone *local;
@@ -71,9 +71,9 @@
 	if(ow != w || oh != h){
 		if(pos[0] == 't' || pos[1] == 't'){
 			miny = 0;
-			maxy = Borderwidth+3*f->height+Borderwidth;
+			maxy = minheight;
 		}else{
-			miny = h - (Borderwidth+3*f->height+Borderwidth);
+			miny = h - minheight;
 			maxy = h;
 		}
 		if(pos[0] == 'l' || pos[1] == 'l'){
@@ -204,6 +204,7 @@
 	if(initdraw(nil, nil, "bar") < 0)
 		sysfatal("initdraw: %r");
 	f = display->defaultfont;
+	minheight = 2*(Borderwidth+1) + f->height;
 	unlockdisplay(display);
 	if((mctl = initmouse(nil, screen)) == nil)
 		sysfatal("initmouse: %r");