diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2021-07-18 20:21:06 +0000 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2021-07-18 20:21:06 +0000 |
commit | 90ce513fb0df41c0d6c5cea8dbd612c1859d4392 (patch) | |
tree | 619f59840fd4cb3bdcd8a5013276b2eb9690f2ad | |
parent | 07c32fb3da0731570508e519e4cfaaaaf646ccfb (diff) | |
parent | 187806ad2021994c4e841d4dbddc569d51023bb0 (diff) | |
download | plan9front-90ce513fb0df41c0d6c5cea8dbd612c1859d4392.tar.xz |
merge
-rw-r--r-- | sys/src/cmd/screenlock.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/sys/src/cmd/screenlock.c b/sys/src/cmd/screenlock.c index 9ac9fa064..1b46fc97e 100644 --- a/sys/src/cmd/screenlock.c +++ b/sys/src/cmd/screenlock.c @@ -119,14 +119,19 @@ grabmouse(void*) 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 @@ lockscreen(void) 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); |