diff --git a/doc/yambar-modules.5.scd b/doc/yambar-modules.5.scd index 00359c4..b9e1875 100644 --- a/doc/yambar-modules.5.scd +++ b/doc/yambar-modules.5.scd @@ -258,7 +258,7 @@ uses *udev* to monitor for changes. | poll-interval : int : no -: How often, in seconds, to poll for capacity changes (default=*60*) +: How often, in seconds, to poll for capacity changes (default=*60*). Set to `0` to disable polling (*warning*: many batteries do not support asynchronous reporting). ## EXAMPLES diff --git a/modules/battery.c b/modules/battery.c index 564d917..20eaad0 100644 --- a/modules/battery.c +++ b/modules/battery.c @@ -337,7 +337,7 @@ run(struct module *mod) {.fd = mod->abort_fd, .events = POLLIN}, {.fd = udev_monitor_get_fd(mon), .events = POLLIN}, }; - poll(fds, 2, m->poll_interval * 1000); + poll(fds, 2, m->poll_interval > 0 ? m->poll_interval * 1000 : -1); if (fds[0].revents & POLLIN) { ret = 0;