mirror of
https://github.com/kogakure/dotfiles.git
synced 2026-02-04 04:35:29 +00:00
chore(hammerspoon): add configuration
https://github.com/Hammerspoon/hammerspoon
This commit is contained in:
20
hammerspoon/caffeine.lua
Normal file
20
hammerspoon/caffeine.lua
Normal file
@@ -0,0 +1,20 @@
|
||||
-- Replace Caffeine.app with 18 lines of Lua :D
|
||||
local caffeine = hs.menubar.new()
|
||||
|
||||
function setCaffeineDisplay(state)
|
||||
local result
|
||||
if state then
|
||||
result = caffeine:setIcon("~/.hammerspoon/icons/sun.pdf")
|
||||
else
|
||||
result = caffeine:setIcon("~/.hammerspoon/icons/moon.pdf")
|
||||
end
|
||||
end
|
||||
|
||||
function caffeineClicked()
|
||||
setCaffeineDisplay(hs.caffeinate.toggle("displayIdle"))
|
||||
end
|
||||
|
||||
if caffeine then
|
||||
caffeine:setClickCallback(caffeineClicked)
|
||||
setCaffeineDisplay(hs.caffeinate.get("displayIdle"))
|
||||
end
|
||||
Reference in New Issue
Block a user