Skip to content

Instantly share code, notes, and snippets.

@scottming
Created August 15, 2018 03:27
Show Gist options
  • Save scottming/65231b8bf41b164836b500774d8617b6 to your computer and use it in GitHub Desktop.
Save scottming/65231b8bf41b164836b500774d8617b6 to your computer and use it in GitHub Desktop.
my hammerspoon
-- private/config.lua
-- Specify Spoons which will be loaded
hspoon_list = {
-- "AClock",
-- "BingDaily",
-- "Calendar",
-- "CircleClock",
-- "ClipShow",
"CountDown",
-- "FnMate",
-- "HCalendar",
-- "HSaria2",
-- "HSearch",
-- "KSheet",
-- "SpeedMenu",
-- "TimeFlow",
-- "UnsplashZ",
"WinWin",
}
-- appM environment keybindings. Bundle `id` is prefered, but application `name` will be ok.
hsapp_list = {
{key = 'f', name = 'Finder'},
{key = '1', name = 'iTerm'},
{key = "B", name = "Bear"},
{key = "M", name = "Emacs"},
-- {key = "M", name = "TextMate"},
{key = "S", name = "Sublime Text"},
{key = "C", id = "com.google.Chrome"},
{key = 'o', name = 'Firefox'},
{key = "W", name = 'WeChat'},
{key = "P", name = "PDF Expert"},
{key = "V", name = "Visual Studio Code"},
{key = "E", name = "EuDic"},
{key = "i", name = "IINA"},
{key = 'y', name = 'System Preferences'},
}
-- Modal supervisor keybinding, which can be used to temporarily disable ALL modal environments.
hsupervisor_keys = {{"cmd", "shift", "ctrl"}, "Q"}
-- Reload Hammerspoon configuration
hsreload_keys = {{"cmd", "ctrl", "alt"}, "R"}
-- Toggle help panel of this configuration.
hshelp_keys = {{"alt", "shift"}, "/"}
----------------------------------------------------------------------------------------------------
-- Those keybindings below could be disabled by setting to {"", ""} or {{}, ""}
-- Window hints keybinding: Focuse to any window you want
-- hswhints_keys = {"alt", "tab"}
hswhints_keys = {"", ""}
-- appM environment keybinding: Application Launcher
hsappM_keys = {"alt", "A"}
-- resizeM environment keybinding: Windows manipulation
hsresizeM_keys = {"alt", "R"}
show_resize_tips = false
-- bind app
local app_map = {
["1"] = "iTerm",
["2"] = "Google Chrome",
["3"] = "Visual Studio Code",
["4"] = "Emacs",
}
local function bind_app()
for key, app in pairs(app_map) do
hs.hotkey.bind({"alt"}, key,
function()
hs.application.open(app)
end
)
end
end
bind_app()
hs.alert.show("Hammerspoon, at your service", 3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment