Closed dmitrym0 closed 2 years ago
hey @dmitrym0 π the plugin only shows defined key bindings :)
firstly, you need to create a new HyperBindings instance:
local hyper =
keys:createHyperBindings(
{
hyperKey = "f20" -- use karabiner to remap any key to f20
}
)
secondly, add custom key bindings by using hyper:setGlobalBindings
(global, top row) or hyper:setAppBindings
(app-specific, bottom row), you can actually find a few examples in README.md
once you did it, you can (de)activate the "cheatsheet" with F20 (or any other hyper key you set in the config)
This is what I'm trying, but I don't get any hints:
local hyper = {"β", "β₯", "β", "β§"}
local hyper =
keys:createHyperBindings(
{
hyperKey = "=",
hyperMods = hyper,
backgroundColor = {hex = "#000", alpha = 0.9},
textColor = {hex = "#FFF", alpha = 0.8},
modsColor = {hex = "#FA58B6"},
keyColor = {hex = "#f5d76b"},
fontFamily = "JetBrains Mono",
separator = "(β οΎ β οΎ)β βββ",
position = {x = "center", y = "bottom"}
}
)
hyper:setGlobalBindings(
{
key = "r",
fn = function()
local result =
hs.dialog.blockAlert("Hammerspoon", "You're about to reload hammerspoon config, are you sure?", "OK", "Cancel")
if result == "OK" then
hs.reload()
end
end
},
{
key = "t",
fn = function()
hs.alert("test")
end
}
)
Ahh here it is:
2022-03-07 09:13:20: 09:13:20 ** Warning: LuaSkin: invalid font specified: JetBrains Mono
I was missing a font, it's all good now, I see the hints.
great to hear that! π I thought if a font isn't installed, Hammerspoon will use the system font by default, but apparently, it doesn't do that
@mobily I've got a couple of other questions if you don't mind!
So far this is really great π
@dmitrym0
keys:setGlobalBindings
? (and not in hyper:setGlobalBindings
) if so, then, unfortunately, it's impossible at the moment, but I'm open to suggestions!hyperExitKey
param, see: https://github.com/mobily/awesome-keys#spoonawesomekeyscreatehyperbindingsconfigFor #1 there is https://www.hammerspoon.org/Spoons/HSKeybindings.html, It's working fairly well for me, of course not as attractive as yours!
For #2, then awesomekeys uses the modal approach, kind of like vim?
Hi @mobily , wonderful package. I can't seem to figure out how to show the cheatsheet (all the key mappings). Are you using a separate spoon for this?