Request: DelayedLayer #114
Replies: 10 comments 1 reply
-
|
Hi @garlandcrow , thanks for trying out the project. Can you try if this works for your need? rule('delay layer').manipulators([
map(1)
.toDelayedAction(toSetVar('delay-layer-1'), [
toKey(1),
toSetVar('delay-layer-1', 0),
])
.toAfterKeyUp(toSetVar('delay-layer-1', 0))
.toIfAlone(toKey(1))
.parameters({ 'basic.to_delayed_action_delay_milliseconds': 200 }),
withCondition(ifVar('delay-layer-1'))({
2: toKey(3), //
}),
])If it does, or you made it work with some modifications, please let me know and I will make a |
Beta Was this translation helpful? Give feedback.
-
|
Sorry @garlandcrow , I've tried it myself but couldn't find a workable solution. The problem is that to_delayed_action is sent even if the key has been released, which causes 2 problems:
The best I got is to use 2 variables to solve the first problem but no solution for the second problem (type 1, release, then 2 will send 112 instead of 12) rule('delay layer').manipulators([
map(1)
.toIfAlone(1)
.to(toSetVar('delay-layer-1-down'))
.toDelayedAction(toSetVar('delay-layer-1-delay'), [
toKey(1),
toSetVar('delay-layer-1-delay', 0),
])
.toAfterKeyUp([
toSetVar('delay-layer-1-down', 0),
toSetVar('delay-layer-1-delay', 0),
])
.parameters({
'basic.to_delayed_action_delay_milliseconds': 200,
}),
withCondition(
ifVar('delay-layer-1-down'),
ifVar('delay-layer-1-delay'),
)({
2: toKey(3),
}),
]),Please let me know if you find a solution as I would love to use this layer to replace simlayer too. |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for trying this! I had tried something similar to your first one, but not as nice and had those problems where the var was sticking so I stopped and was going to read more about all the things karabiner has and give another go. I'll definitely let you know if I get something working as this is the last barrier to me having a super usable MacBook. |
Beta Was this translation helpful? Give feedback.
-
|
Will tap-press good enough for you? Like a double tap but the second tap need to hold to keep the layer active. Update: Sorry I tried but couldn't make it work either. What I was thinking (but doesn't work): rule('delay layer').manipulators([
map(1)
.condition(ifVar('11-delay').unless())
.toVar('11-delay')
.toDelayedAction(
[toSetVar('11-delay', 0), toKey(1)],
[toSetVar('11-delay', 0)],
)
.parameters({
'basic.to_delayed_action_delay_milliseconds': 200,
}),
map(1)
.condition(ifVar('11-delay'))
.toVar('11-layer')
.toAfterKeyUp(toSetVar('11-layer', 0))
.toIfAlone(1)
.parameters({
'basic.to_if_alone_timeout_milliseconds': 200,
}),
withCondition(ifVar('11-layer'))({
2: toKey(3),
}),
]), |
Beta Was this translation helpful? Give feedback.
-
|
Hi @garlandcrow , I'm not sure if it would still be useful for you, but I think I figured it out. If you would like to give it a try: rule('delayedLayer').manipulators([
map(1)
.condition(ifVar('delayed-1').unless())
.toIfHeldDown([
toSetVar('delayed-1'),
toNotificationMessage('delayed-1', '💡 Delayed Layer 1'),
])
.toAfterKeyUp([
toSetVar('delayed-1', 0),
toRemoveNotificationMessage('delayed-1'),
])
.toIfAlone(1)
.toDelayedAction(
[],
[
toKey(1),
toSetVar('delayed-1', 0),
toRemoveNotificationMessage('delayed-1'),
],
)
.parameters({
'basic.to_if_held_down_threshold_milliseconds': 200,
'basic.to_delayed_action_delay_milliseconds': 200,
}),
withCondition(ifVar('delayed-1'))({
2: toKey(3),
}),
]), |
Beta Was this translation helpful? Give feedback.
-
|
Oh just saw this! Ya let me try tonight, that would be amazing to have 🤞 |
Beta Was this translation helpful? Give feedback.
-
|
Yea think you nailed it, seems to work perfect so far and IMO is exactly how you would want this to work, especially for fast typers. I'm changing over all my karabiner layers to be implemented this way, will post something if have any issues in everyday use. Well done!! |
Beta Was this translation helpful? Give feedback.
-
|
Sorry, but I found some issues when I tried it more. Sometimes, the key gets triggered twice when typed fast with other keys. I guess it is a typing habit; maybe you can find proper parameters that avoid that with your typing speed. Maybe try more after changing each key. |
Beta Was this translation helpful? Give feedback.
-
|
Hi @garlandcrow, it's been 2 years, so I am not sure if you are still using Karabiner-Elements. But the latest version added to.conditions, which finally makes the delayed layer possible: rule('delayedLayer').manipulators([
map(1)
.condition(ifVar('delayed-1', 0))
.toVar('delayed-1', 1)
.toIfHeldDown([
toSetVar('delayed-1', 2),
toNotificationMessage('delayed-1', '💡 Delayed Layer 1'),
])
.toAfterKeyUp([
toSetVar('delayed-1', 0),
toRemoveNotificationMessage('delayed-1'),
])
.toIfAlone([toKey('a'), toSetVar('delayed-1', 0)])
.toDelayedAction(
[],
[
toKey('b', {}, { conditions: [ifVar('delayed-1', 1).build()] }),
toSetVar('delayed-1', 0),
toRemoveNotificationMessage('delayed-1'),
],
)
.parameters({
'basic.to_if_held_down_threshold_milliseconds': 200,
'basic.to_delayed_action_delay_milliseconds': 200,
}),
withCondition(ifVar('delayed-1', 2))({
2: toKey(3),
}),
])When I have more time I think I will make it the default for layers in |
Beta Was this translation helpful? Give feedback.
-
|
The Delayed Layer has now been added.
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
First off thanks for this amazing DSL for karabiner! Havent used it for a few years cause I bought a moonlander, but recently got a macbook so its nice to see how much nicer karabiner itself got and how nice it is to configure with this project.
I find myself wanting a layer modifier that I think is not currently covered by the options that exist, but I think should be possible with the karabiner spec. Essentially my problem is typing fast and it not recognizing the key as a press because it is still down when I hit the next key.
SimLayers do the opposite of what I want, they make me type fast to get the layer, but I want the layer only when I am going slow and to be the normal key when fast. So after XXX ms of holding a key down I want to set the layer var to 1, if I release before that it should still be 0. I think this should be possible with to_delayed_action. I might try adding this manually first and then can maybe try to make a PR unless this is something it would be easy for you to add, or if you have any other ideas for this.
Beta Was this translation helpful? Give feedback.
All reactions