/ .hammerspoon / init.lua
init.lua
1 local SpoonInstall = hs.loadSpoon("SpoonInstall") 2 3 SpoonInstall:asyncUpdateAllRepos() 4 5 SpoonInstall:andUse("ReloadConfiguration", { start = true }) 6 7 SpoonInstall:andUse("WindowGrid", { 8 config = {gridGeometries = { 9 { "4x4" } 10 }}, 11 hotkeys = { show_grid = { { "ctrl", "alt", "cmd" }, "g" } }, 12 fn = function() 13 hs.grid.setMargins(hs.geometry.point(0, 0)) 14 end, 15 start = true 16 }) 17 18 -- open config file 19 hs.hotkey.bind({ "ctrl", "alt", "cmd" }, "c", function() 20 hs.execute("open ~/.hammerspoon/init.lua") 21 end) 22 23 -- switch keyboard layout with Cmd+Shift+1/2/3, equal to Alt+Shift+1/2/3 on Windows 24 for idx, layout in pairs(hs.keycodes.layouts()) do 25 hs.hotkey.bind({ "cmd", "shift" }, tostring(idx), function() 26 hs.keycodes.setLayout(layout) 27 end) 28 end