Skip to content

Commit

Permalink
Update hammerspoon
Browse files Browse the repository at this point in the history
  • Loading branch information
bravmi committed Dec 21, 2024
1 parent 590ab10 commit 9becf48
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .luarc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"diagnostics.globals": [
"insertLink"
]
}
15 changes: 10 additions & 5 deletions hammerspoon/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,14 @@ hs.audiodevice.watcher:start()

local slackAppName = "Slack"

hs.hotkey.bind({ "cmd" }, "k", function()
local focusedApp = hs.application.frontmostApplication()
if focusedApp:name() == slackAppName then
hs.eventtap.keyStroke({ "cmd", "shift" }, "u")
end
local insertLink = hs.hotkey.new({ "cmd" }, "k", function()
hs.eventtap.keyStroke({ "cmd", "shift" }, "u")
end)

hs.window.filter.new(slackAppName)
:subscribe(hs.window.filter.windowFocused, function()
insertLink:enable()
end)
:subscribe(hs.window.filter.windowUnfocused, function()
insertLink:disable()
end)

0 comments on commit 9becf48

Please sign in to comment.