Unified · Split
| @@ -13,7 +13,7 @@ enum { · 12 unmodified lines | |||
| 13 | Off = 3, | 13 | Off = 3, |
| 14 | }; | 14 | }; |
| 15 | 15 | ||
| 16 | static int wctl, owidth, width, twidth, bottom, bat, minheight, seplen, sepw, hlitem; | 16 | static int wctl = -1, owidth, width, twidth, bottom, bat, minheight, seplen, sepw, hlitem; |
| 17 | static char sep[16], bats[16], *aux; | 17 | static char sep[16], bats[16], *aux; |
| 18 | static char *pos = "rb", *dfmt = "YYYY/MM/DD WW hh:mm:ss", *items[64]; | 18 | static char *pos = "rb", *dfmt = "YYYY/MM/DD WW hh:mm:ss", *items[64]; |
| 19 | static int itemw[64], nitems; | 19 | static int itemw[64], nitems; |
| @@ -68,6 +68,9 @@ place(void) · 48 unmodified lines | |||
| 68 | char t[64]; | 68 | char t[64]; |
| 69 | static int ow, oh; | 69 | static int ow, oh; |
| 70 | 70 | ||
| 71 | if(wctl < 0 && (wctl = open("/dev/wctl", OWRITE)) < 0) | ||
| 72 | return; | ||
| 73 | |||
| 71 | fprint(wctl, bottom ? "bottom" : "top"); | 74 | fprint(wctl, bottom ? "bottom" : "top"); |
| 72 | w = Dx(display->image->r); | 75 | w = Dx(display->image->r); |
| 73 | h = Dy(display->image->r); | 76 | h = Dy(display->image->r); |
| @@ -298,8 +301,6 @@ threadmain(int argc, char **argv) · 224 unmodified lines | |||
| 298 | Bterm(b); | 301 | Bterm(b); |
| 299 | } | 302 | } |
| 300 | 303 | ||
| 301 | if((wctl = open("/dev/wctl", ORDWR)) < 0) | ||
| 302 | sysfatal("%r"); | ||
| 303 | bat = open("/mnt/pm/battery", OREAD); | 304 | bat = open("/mnt/pm/battery", OREAD); |
| 304 | if(initdraw(nil, nil, "bar") < 0) | 305 | if(initdraw(nil, nil, "bar") < 0) |
| 305 | sysfatal("initdraw: %r"); | 306 | sysfatal("initdraw: %r"); |