-- Auto-hide WezTerm when it loses focus weztermAppWatcher = hs.application.watcher.new(function(appName, eventType, appObject) if eventType == hs.application.watcher.deactivated and appName == "WezTerm" then print("WezTerm lost focus, hiding...") appObject:hide() end end) weztermAppWatcher:start() print("WezTerm auto-hide enabled") -- 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