Open ww7 opened 2 years ago
If it is possible to implement logic close to if_not_alone approach?
Seems I need option for minimum keydown delay or minimum timout of "not pressed any keys" before trigger.
Ah, seems I need to-if-held-down
https://karabiner-elements.pqrs.org/docs/json/complex-modifications-manipulator-definition/to-if-held-down/
Serhii, it is a really great idea. Did it work for you? Would you post the code here?
Hey, @ww7 , did you manage to get this working fine with the to-if-held-down
path? I like the idea of using the spacebar as a mod key, but I also find that it triggers too many false positives as well. Meanwhile, I'm still trusting caps as hyper.
@martin-hoger @ldebritto Here is an example gist that I have been using for four years. I also make a PR to https://github.com/pqrs-org/KE-complex_modifications/pull/1436
Yes, such adjusting works good. It can be globally configured on KE app or specifically inside CM, e.g.:
"parameters": {
"basic.to_delayed_action_delay_milliseconds": 150,
"basic.to_if_alone_timeout_milliseconds": 300,
"basic.to_if_held_down_threshold_milliseconds": 150
}
You can decide to make delays bigger (e.g. 200,400,200) if typing slow or older Mac with slower CPU.
Placement delays:
{
"description": "Spacebar to Ctrl+Opt+Cmd modifiers if pressed with other keys or space if pressed alone)",
"manipulators": [
{
"conditions": [
{
"bundle_identifiers": [
"^com\\.parallels\\.desktop\\.console$"
],
"type": "frontmost_application_unless"
}
],
"from": {
"key_code": "spacebar",
"modifiers": { "optional": ["any"] }
},
"to": [
{
"key_code": "left_command",
"modifiers": ["left_control", "left_option"]
}
],
"to_if_alone": [{ "key_code": "spacebar" }],
"to_if_held_down": [{ "key_code": "spacebar" }],
"type": "basic"
}
],
"parameters": {
"basic.to_delayed_action_delay_milliseconds": 150,
"basic.to_if_alone_timeout_milliseconds": 300,
"basic.to_if_held_down_threshold_milliseconds": 150
}
}
Using Ctrl+Opt+Cmd modifiers allows to have additional layer if Spacebar pressed with Shift that works as Ctrl+Opt+Cmd+Shift.
To easy launch apps with this I recommend Keyboard Cowboy or older Apptivate shortcuts managers.
With complex modification
Spacebar to modifiers if pressed with other keys
very often spacebar is not keyUp in time and false activations are triggered.Which timeout settings can improve recognizing
to_if_alone
? If possible to set minimal keyDown delay?I use
spacebar
as complex modifier (Cmd+Ctrl+Opt) and need to post aspace
if it pressed alone.