Comments (8)
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 delayedLayer()
method. Or create a PR if you'd like to :)
from karabiner.ts.
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:
- If the key is released before the delay time, the variable is set to 1 and stay at 1 (as
to_delayed_action.to_if_invoked
is sent after key up) - If the key is released fast, then another key is pressed before the delay,
to_delayed_action.to_if_canceled
is sent so the key is sent twice (the first one byto_if_alone
).
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.
from karabiner.ts.
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.
from karabiner.ts.
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),
}),
]),
from karabiner.ts.
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),
}),
]),
from karabiner.ts.
Oh just saw this! Ya let me try tonight, that would be amazing to have π€
from karabiner.ts.
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!!
from karabiner.ts.
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.
from karabiner.ts.
Related Issues (20)
- Doesnβt seem to work with yabai HOT 2
- Playground uses old version? HOT 4
- Help with a layer
- Threshold for activating a layer
- Missing features compared to Goku? HOT 1
- Docs are broken HOT 5
- How to do Key Sequences? HOT 1
- Search feature to docs
- DoubleTap and toIfAlone not working together
- typeSequence() to type a string of keys
- Add modifier to layer()
- Can't map to Backspace HOT 1
- [Bug] if layer has optionalAny, keys should allow optionalAny as well HOT 2
- Modifier Key Layers HOT 5
- Accidental System Diagnostics HOT 1
- Play a sound notice when a certain layer been triggered HOT 1
- Provide an option to disable all the keys that I didn't set for a specific layer HOT 1
- Help needed HOT 1
- Looks like Deno setup doesn't work HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from karabiner.ts.