Team/TOOLS

[ OSX ] Hammerspoon

HEON.D 2022. 7. 23. 00:05

https://www.hammerspoon.org/

 

Hammerspoon

Hammerspoon What is Hammerspoon? This is a tool for powerful automation of macOS. At its core, Hammerspoon is just a bridge between the operating system and a Lua scripting engine. What gives Hammerspoon its power is a set of extensions that expose specifi

www.hammerspoon.org

Settings

-- init.lua
local english = "com.apple.keylayout.ABC"
local escapeBind

function setEnglish()
    local source = hs.keycodes.currentSourceID()
    if not (source == english) then
        hs.keycodes.currentSourceID(english)
    end
    escapeBind:disable()
    hs.eventtap.keyStroke({}, 'escape')
    escapeBind:enable()
end

escapeBind = hs.hotkey.new({}, 'escape', setEnglish):enable()
hs.hotkey.bind({'ctrl'}, 33, setEnglish)