diff options
| author | hhvn <dev@hhvn.uk> | 2024-04-14 13:49:18 +0100 |
|---|---|---|
| committer | hhvn <dev@hhvn.uk> | 2024-04-14 13:49:18 +0100 |
| commit | 612e4fbeb14001d5eef0bb0e3e19ea65eb47cef2 (patch) | |
| tree | c000b5997dabcfe424af25b694a6c05356c03622 /status/01-bat.go | |
| parent | 75a34eb4b035963970c8415316c2b2bd6a81eea6 (diff) | |
Tidy up the status block api a bit
Handle (nearly) all the plumbing (sleeps, goroutines and comms) in register()
Diffstat (limited to 'status/01-bat.go')
| -rw-r--r-- | status/01-bat.go | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/status/01-bat.go b/status/01-bat.go index 85643f1..12882dc 100644 --- a/status/01-bat.go +++ b/status/01-bat.go @@ -12,7 +12,7 @@ import ( "hhvn.uk/hbspbar/common" ) -func bat(name string) error { +func bat(u *Block) error { dir := "/sys/class/power_supply" const ( @@ -21,8 +21,6 @@ func bat(name string) error { discharging ) - u := newUpdate(name) - dirs, err := os.ReadDir(dir) if dirs == nil { return err } @@ -87,12 +85,9 @@ func bat(name string) error { // Fill u.drawRect(4 + iw - w, 4, w + 1, ih, c, true) - updates <- u - sleep(1) - return nil } func init() { - register("bat", bat) + register("bat", bat, 1) } |