Skip to content

Instantly share code, notes, and snippets.

@noma4i
Created October 19, 2016 04:31
Show Gist options
  • Save noma4i/145a0bef4e65d93340d671575b32b185 to your computer and use it in GitHub Desktop.
Save noma4i/145a0bef4e65d93340d671575b32b185 to your computer and use it in GitHub Desktop.
hammerspoon config
-- Settings
hs.window.animationDuration = 0
hs.hints.showTitleThresh = 0
--
-- Reload Config onChange
function reloadConfig(files)
doReload = false
for _,file in pairs(files) do
if file:sub(-4) == ".lua" then
doReload = true
end
end
if doReload then
hs.reload()
end
end
hs.pathwatcher.new(os.getenv("HOME") .. "/.hammerspoon/", reloadConfig):start()
hs.alert.show("Config loaded")
--
-- Hotkeys
local hyper = {"⌥"}
local hyper_super = {"⌘", "⌥", "⌃"}
hs.hotkey.bind(hyper, "G", function() hs.application.launchOrFocus("Google Chrome") end)
hs.hotkey.bind(hyper, "S", function() hs.application.launchOrFocus("Safari") end)
hs.hotkey.bind(hyper, "M", function() hs.application.launchOrFocus("Mail") end)
hs.hotkey.bind(hyper, "T", function() hs.application.launchOrFocus("iTerm") end)
hs.hotkey.bind(hyper, "I", function() hs.application.launchOrFocus("Spotify") end)
hs.hotkey.bind(hyper, "L", function() hs.application.launchOrFocus("Telegram") end)
hs.hotkey.bind(hyper, "E", function() hs.application.launchOrFocus("Sublime Text") end)
hs.hotkey.bind(hyper, "K", function() hs.application.launchOrFocus("GitHub Desktop") end)
hs.hotkey.bind(hyper, "P", function() hs.application.launchOrFocus("Quiver") end)
hs.hotkey.bind(hyper_super, "[", function()
hs.keycodes.setLayout("Russian - PC")
end)
hs.hotkey.bind(hyper_super, "]", function()
hs.keycodes.setLayout("Australian")
end)
-- Make SublimeText Always Fullscreen
function applicationWatcher(appName, eventType, appObject)
if (eventType == hs.application.watcher.activated) then
if (appName == "Sublime Text") then
appObject:selectMenuItem({"View", "Enter Full Screen"})
end
end
end
-- local appWatcher = hs.application.watcher.new(applicationWatcher)
-- appWatcher:start()
--
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment