diff options
author | Jesse Luehrs <doy@stripe.com> | 2020-06-11 10:43:27 -0700 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2020-06-11 10:47:40 -0700 |
commit | 1dd74b8979cb5855dd99bd668c340eac2bd29f66 (patch) | |
tree | c02195909f46856223dfca8af40c694b65a863bf | |
parent | f0d165457b881f1ed219d3d0c53ca3afc45e2be2 (diff) | |
download | conf-1dd74b8979cb5855dd99bd668c340eac2bd29f66.tar.gz conf-1dd74b8979cb5855dd99bd668c340eac2bd29f66.zip |
fix hammerspoon cpu monitor
the timer variable was getting overwritten, causing the cpu monitor to
stop updating once it was garbage collected
-rw-r--r-- | hammerspoon/init.lua | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/hammerspoon/init.lua b/hammerspoon/init.lua index d2e000f..b231421 100644 --- a/hammerspoon/init.lua +++ b/hammerspoon/init.lua @@ -155,7 +155,7 @@ enter_bindings(hs.application.frontmostApplication():name()) current_application_watcher:start() cpu_usage_bar = hs.menubar.new() -timer = hs.timer.doEvery(1, function() +cpu_timer = hs.timer.doEvery(1, function() hs.host.cpuUsage(function(cpu) local cpuUsage = cpu["overall"]["active"] cpu_usage_bar:setTitle(math.floor(cpuUsage + 0.5) .. "%") @@ -163,7 +163,7 @@ timer = hs.timer.doEvery(1, function() end) power_usage_bar = hs.menubar.new() -timer = hs.timer.doEvery(5, function() +power_timer = hs.timer.doEvery(5, function() local watts = hs.execute("/Users/doy/.bin/st-doy2/power-usage") power_usage_bar:setTitle(string.gsub(watts, "\n", "") .. "W") end) |