Replies: 3 comments 1 reply
-
|
Hi @saml-dev. There is no abstraction over it with karabiner.ts right now. I thought about this feature but couldn't find a good API. However, I think it is definitively possible. Can you try if you can make it work yourself:
.leaderMode({ sticky: true })
map('r').toVar('sublayer-raycast')
withCondition(ifVar('sublayer-raycast'))([
map('c')
.toApp('someApp')
.toUnsetVar('sublayer-raycast')
.toUnsetVar('layerVar'),
]),If it works, the unset var part can then be abstracted into a mapper or function. |
Beta Was this translation helpful? Give feedback.
-
|
Hi @saml-dev, I've put together an working example (open in online editor), please let me know if it helps: let raycastEmoji = 'raycast/emoji-symbols/search-emoji-symbols'
let escape = [toUnsetVar('leader'), toRemoveNotificationMessage('leader')]
let rules = [
rule('Leader Key').manipulators([
// When no leader key or nested leader key is on
withCondition(ifVar('leader', 0))([
// Leader key
map('l', 'Hyper') // Or mapSimultaneous(['l', ';']) ...
.toVar('leader', 1)
.toNotificationMessage('leader', 'Leader Key: Open, Raycast, ...'),
]),
// When leader key or nested leader key is on
withCondition(ifVar('leader', 0).unless())([
// Escape key(s)
map('escape').to(escape),
]),
// When leader key but no nested leader key is on
withCondition(ifVar('leader', 1))([
// Nested leader keys
withMapper(['o', 'r'])((x) =>
map(x)
.toVar('leader', x)
.toNotificationMessage('leader', `leader ${x}`),
),
]),
// leader o - Open
withCondition(ifVar('leader', 'o'))(
[
map('f').toApp('Finder'),
// f - Finder, ...
].map((x) => x.to(escape)),
),
// leader r - Raycast
withCondition(ifVar('leader', 'r'))(
[
map('e').to$(`open raycast://extensions/${raycastEmoji}`),
// e - Emoji, ...
].map((x) => x.to(escape)),
),
]),
] |
Beta Was this translation helpful? Give feedback.
-
|
By the way, I've also changed some of my layers to nested leader keys. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Is it possible? For example, a regular leader key layer is easy to set up.
leader tfor terminal,leader mfor messages, etc. But what if I wanted to set up a Raycast layer, whereleader r copens the camera,leader r atoggles system appearance (dark mode),leader r eopens the emoji picker, etc. Is that possible with Karabiner / karabiner.ts?Beta Was this translation helpful? Give feedback.
All reactions