Skip to content

Commit

Permalink
add hammerspoon
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Steinke committed May 29, 2024
1 parent 6800f51 commit 460a7ba
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
2 changes: 2 additions & 0 deletions config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ bottles = [
"gopls",
"gradle",
"gradle-completion",
"hammerspoon",
"haskell-language-server",
"haskell-stack",
"htop",
Expand Down Expand Up @@ -176,4 +177,5 @@ links = [
{ sourceFile ="${PWD}/zsh", linkName="${HOME}/.zsh" },
{ sourceFile ="${PWD}/R/RProfile", linkName="${HOME}/.RProfile" },
{ sourceFile ="${PWD}/vscode/settings.json", linkName="${HOME}/Library/Application Support/Code/User/settings.json" },
{ sourceFile ="${PWD}/hammerspoon/", linkName="${HOME}/.hammerspoon" },
]
28 changes: 28 additions & 0 deletions hammerspoon/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
-- focus apps
local apps = {
{ "k", "Kitty" },
{ "s", "Safari" },
}
for _, item in ipairs(apps) do
local shortcut = item[1]
local name = item[2]
hs.hotkey.bind({ "cmd", "ctrl", "alt" }, shortcut, name, function()
hs.application.launchOrFocus(name)
end)
end

-- Reload the Hammerspoon configuration
local reloadConfig = function(files)
local 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

ConfigReloadWatcher = hs.pathwatcher.new(hs.configdir, reloadConfig):start()
hs.alert.show("Config loaded")

0 comments on commit 460a7ba

Please sign in to comment.