Last active
May 23, 2025 01:23
-
-
Save anzdaddy/b56171e2504e6b3d29a42292c81aa656 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- https://gist.github.com/marcelocantos/91d14aa9f51c76cd7903439afb74f22a | |
logger = require("hs.logger").new("init", "debug") | |
-- bind binds keys more conveniently. Input should be some variant of "⌥⌘⇧-k". | |
function bind(bindings) | |
for input, char in pairs(bindings) do | |
local modifiers = {} | |
for code, key in pairs({["⌥"]="alt", ["⌘"]="cmd", ["⇧"]="shift"}) do | |
if input:find(code) then | |
table.insert(modifiers, key) | |
end | |
end | |
hotkey = string.match(input, "-(.*)") | |
hs.hotkey.bind(modifiers, hotkey, function() hs.eventtap.keyStrokes(char) end) | |
end | |
end | |
-- some handy rebindings | |
bind({ | |
["⌥ -["] = "‘", | |
["⌥ -\\"] = "«", | |
["⌥ -]"] = "’", | |
["⌥ ⇧-["] = "“", | |
["⌥ ⇧-]"] = "”", | |
["⌥ ⇧-;"] = "⋮", | |
[" ⌘⇧-8"] = "×", | |
["⌥⌘⇧-right"] = "→", | |
["⌥⌘⇧-up"] = "↑", | |
["⌥⌘⇧-down"] = "↓", | |
["⌥⌘⇧-left"] = "←", | |
["⌥⌘⇧-left"] = "←", | |
["⌥⌘⇧-,"] = "❮", | |
["⌥⌘⇧-."] = "❯", | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment