From 1dd74b8979cb5855dd99bd668c340eac2bd29f66 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Thu, 11 Jun 2020 10:43:27 -0700 Subject: fix hammerspoon cpu monitor the timer variable was getting overwritten, causing the cpu monitor to stop updating once it was garbage collected --- hammerspoon/init.lua | 4 ++-- 1 file 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) -- cgit v1.2.3-54-g00ecf