hammerspoon: sync

This commit is contained in:
Konstantin Bukley
2021-01-14 14:28:52 +02:00
parent 284c85d37d
commit dc5f007df8
12 changed files with 1117 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
local log = hs.logger.new('init.lua', 'debug')
-- Use Control+` to reload Hammerspoon config
hs.hotkey.bind({'ctrl'}, '`', nil, function()
hs.reload()
end)
keyUpDown = function(modifiers, key)
-- Un-comment & reload config to log each keystroke that we're triggering
-- log.d('Sending keystroke:', hs.inspect(modifiers), key)
hs.eventtap.keyStroke(modifiers, key, 0)
end
-- Subscribe to the necessary events on the given window filter such that the
-- given hotkey is enabled for windows that match the window filter and disabled
-- for windows that don't match the window filter.
--
-- windowFilter - An hs.window.filter object describing the windows for which
-- the hotkey should be enabled.
-- hotkey - The hs.hotkey object to enable/disable.
--
-- Returns nothing.
enableHotkeyForWindowsMatchingFilter = function(windowFilter, hotkey)
windowFilter:subscribe(hs.window.filter.windowFocused, function()
hotkey:enable()
end)
windowFilter:subscribe(hs.window.filter.windowUnfocused, function()
hotkey:disable()
end)
end
require('keyboard.control-escape')
require('keyboard.delete-words')
require('keyboard.hyper')
require('keyboard.markdown')
require('keyboard.microphone')
require('keyboard.panes')
require('keyboard.windows')
hs.notify.new({title='Hammerspoon', informativeText='Ready to rock 🤘'}):send()