summaryrefslogtreecommitdiffstats
path: root/hammerspoon
diff options
context:
space:
mode:
authorJesse Luehrs <doy@stripe.com>2018-11-12 09:16:07 -0800
committerJesse Luehrs <doy@tozt.net>2018-11-12 09:19:45 -0800
commitab4754b16e3685ff7758f2628bc432726242132d (patch)
tree7625b6b1c1120f07701c8a37b7d52ddae30b5c41 /hammerspoon
parent0954f16ef2b45479b0169a223bb3d4765bb212e2 (diff)
downloadconf-ab4754b16e3685ff7758f2628bc432726242132d.tar.gz
conf-ab4754b16e3685ff7758f2628bc432726242132d.zip
add power usage to my menu bar in osx
Diffstat (limited to 'hammerspoon')
-rw-r--r--hammerspoon/init.lua10
1 files changed, 8 insertions, 2 deletions
diff --git a/hammerspoon/init.lua b/hammerspoon/init.lua
index f72699d..2f6b836 100644
--- a/hammerspoon/init.lua
+++ b/hammerspoon/init.lua
@@ -134,14 +134,20 @@ end)
enter_bindings(hs.application.frontmostApplication():name())
current_application_watcher:start()
-menubar = hs.menubar.new()
+cpu_usage_bar = hs.menubar.new()
timer = hs.timer.doEvery(1, function()
hs.host.cpuUsage(function(cpu)
local cpuUsage = cpu["overall"]["active"]
- menubar:setTitle(math.floor(cpuUsage + 0.5) .. "%")
+ cpu_usage_bar:setTitle(math.floor(cpuUsage + 0.5) .. "%")
end)
end)
+power_usage_bar = hs.menubar.new()
+timer = hs.timer.doEvery(5, function()
+ local watts = hs.execute("/Users/doy/.bin/st-doy1.local/power-usage")
+ power_usage_bar:setTitle(string.gsub(watts, "\n", "") .. "W")
+end)
+
hs.caffeinate.set("systemIdle", true, true)
hs.alert("Hammerspoon config reloaded")