25 lines
683 B
Lua
25 lines
683 B
Lua
-- Function to simulate key presses
|
|
local function pressFn(mods, key)
|
|
if key == nil then
|
|
key = mods
|
|
mods = {}
|
|
end
|
|
|
|
return function() hs.eventtap.keyStroke(mods, key, 1000) end
|
|
end
|
|
|
|
-- Function to remap keys
|
|
local function remap(mods, key, pressFn)
|
|
hs.hotkey.bind(mods, key, pressFn, nil, pressFn)
|
|
end
|
|
|
|
-- Define Caps Lock as the Hyperkey
|
|
local hyper = {'ctrl', 'alt', 'cmd'}
|
|
|
|
-- Remap HJKL to arrow keys using Caps Lock as a Hyperkey
|
|
remap(hyper, 'h', pressFn({}, 'left')) -- Move left
|
|
remap(hyper, 'j', pressFn({}, 'down')) -- Move down
|
|
remap(hyper, 'k', pressFn({}, 'up')) -- Move up
|
|
remap(hyper, 'l', pressFn({}, 'right')) -- Move right
|
|
|