git: 9front

Download patch

ref: d353da914d1fcba2055fee396b8555bd079d691f
parent: 966efc2274616b893e261781a990fc3b2f4838d0
parent: 9f25a567d79c5b0937bdd91ba06be2f8c27a3913
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Jul 18 16:21:06 EDT 2021

merge

--- a/sys/src/cmd/screenlock.c
+++ b/sys/src/cmd/screenlock.c
@@ -119,14 +119,19 @@
 void
 top(void*)
 {
-	int fd;
+	int fd, n;
+	char buf[128];
 
-	if((fd = open("/dev/wctl", OWRITE)) < 0)
+	if((fd = open("/dev/wctl", ORDWR)) < 0)
 		return;
 
 	for(;;){
-		write(fd, "current", 7);
-		sleep(500);
+		n = read(fd, buf, sizeof buf-1);
+		if(n > 48){
+			buf[n] = '\0';
+			if(strstr(buf+48, "notcurrent"))
+				write(fd, "current", 7);
+		}
 	}
 }
 
@@ -186,7 +191,7 @@
 		tm = localtime(time(&blank));
 		s = smprint("user %s at %d:%02.2d", getuser(), tm->hour, tm->min);
 		p = subpt(p, Pt(stringwidth(font, "m") * strlen(s) / 2, 0));
-		string(screen, p, screen->display->white, ZP, font, s);
+		stringbg(screen, p, display->white, ZP, font, s, display->black, ZP);
 	}
 	flushimage(display, 1);
 
--