Skip to content
This repository has been archived by the owner on Apr 25, 2024. It is now read-only.

[Enhancement] VK_LAZY_modifier isn't being triggered by key repeats #72

Closed
franciscolourenco opened this issue May 4, 2012 · 17 comments

Comments

@franciscolourenco
Copy link
Contributor

If you keep some key pressed (is such a way it send repeated keydown events), and then activate a VK_LAZY_modifier, the modifier is never triggered.
I don't know if it was mean't to be like this on purpose, but I'm currently suffering from the lack of activation of the modifier in this situation.

cheers

@tekezo
Copy link
Member

tekezo commented May 5, 2012

The current behavior is intended.
Please describe why you want to trigger event.

@franciscolourenco
Copy link
Contributor Author

There is this plugin to smoothly scroll with the keyboard. It uses directional keys to move, and the modifiers to change the speed. The speed change is applied as soon a modifier is pressed, so the user never has to release the directional keys and can use the modifiers to accelerate/slowdown according to content of the page.

Using homerow mode though, the lazy_key_modifiers never get triggered if the directional key is already being pressed, so no speed change, unless the directional key is pressed again.

Having a lazy_key sensible to key repetition would make this issue go away.

@tekezo
Copy link
Member

tekezo commented May 6, 2012

It's a limitation that we cannot change repeated key behavior during repeating.
We need to add new VirtualKey like VK_MOUSEKEY.
(VK_MOUSEKEY_HIGHSPEED is close to what you want to do.)

https://github.com/tekezo/KeyRemap4MacBook/blob/master/src/core/kext/VirtualKey/VK_MOUSEKEY.cpp

If you can do, I welcome pull requests.
If not, I'll add it someday.

@franciscolourenco
Copy link
Contributor Author

Trying to understand this..
What would the new VirtualKey be used for?

@tekezo
Copy link
Member

tekezo commented Jun 10, 2012

We should add 2 types of VirtualKey.

One is direction keys.

  • VK_ACCELERATABLE_UP
  • VK_ACCELERATABLE_DOWN
  • VK_ACCELERATABLE_LEFT
  • VK_ACCELERATABLE_RIGHT

One is accelation key.

  • VK_ACCELERATABLE_ACCELATION_X2
  • VK_ACCELERATABLE_ACCELATION_X3
  • VK_ACCELERATABLE_ACCELATION_X4

These are correspond to VK_MOUSEKEY_UP,VK_MOUSEKEY_DOWN,... and VK_MOUSEKEY_HIGHSPEED.

@franciscolourenco
Copy link
Contributor Author

What will VK_ACCELERATABLE_ACCELATION do to VK_ACCELERATABLE_UP?
Accelerate the key repeat rate?

Is there any way of compiling and running keyboardremap4macbook without having to create a package and install it?

@tekezo
Copy link
Member

tekezo commented Jun 11, 2012

VK_ACCELERATABLE_UP sends KeyCode::CURSOR_UP events periodically by timer.

VK_MOUSEKEY_HIGHSPEED modifies a magnitude of X,Y movements in timer callback.
VK_ACCELERATABLE_ACCELATION_X2 changes count of KeyCode::CURSOR_UP in time callback as well.

You can replace core components temporary by following commands.
(It will be reset when you reboot machine.)

update kext:
$ cd src/core/kext
$ make
$ make reload

update server:
$ cd src/core/server
$ make
$ make run

@franciscolourenco
Copy link
Contributor Author

Sorry for being so much time away from this issue.
Now that I understand better what you were suggesting, I think it is not what I was looking for.

In my application, I'm not measuring the repeat rate to control the speed. In fact the repeat rate is completely ignored and the movement is totally independent from it.

I'm looking for the lazy_modifier keys to be activated if I press them while a directional key is already being pressed. Currently this doesn't happen as they are only activated when another key is pressed after them, but not before.

That's why I talked about the repetition: If the lazy modifiers would activate, not only on key press but also on repetition, they would become enabled even if the other key is already being pressed and is repeating.

Thank you so much for the help! :)

@tekezo
Copy link
Member

tekezo commented Mar 26, 2013

It might not be suitable for your settings because I've forgotten your environment status.
But HoldingKeyToKey is the only way to fire event for lazy modifier.

    <autogen>
      __HoldingKeyToKey__
      <!-- from -->
      KeyCode::OPTION_L,
      <!-- to -->
      KeyCode::VK_LAZY_OPTION_L,
      <!-- separator -->
      KeyCode::VK_NONE,
      <!-- holding -->
      KeyCode::OPTION_L,
    </autogen>

@franciscolourenco
Copy link
Contributor Author

Sorry, I think I don't understand exactly what is the behaviour of HoldingKeyToKey and what each parameter does..
Can you give some more details?

Thank you

@tekezo
Copy link
Member

tekezo commented Mar 27, 2013

HoldingKeyToKey changes a key to two kinds.
(1) When you press and release a key immediately.
(2) When you hold down a key.

You can specify this two keys by separating KeyCode::VK_NONE.
There are some examples:
https://github.com/tekezo/KeyRemap4MacBook/blob/master/src/core/server/Resources/include/checkbox/samples.xml#L553

You can adjust a threshold of holding down time by "[Holding Key to Key] Holding Threshold" in Key Repeat tab on Preferences.

@franciscolourenco
Copy link
Contributor Author

I'm trying to implement some ideas you gave me and also clean homerow_mode.xml which seems to be a bit messy.

However I forgot how to built checkbox.xml and include it. The documentation I found only teaches how to build the entire app or how to use private.xml. Can you revive my memory?

Thanks

@tekezo
Copy link
Member

tekezo commented Mar 27, 2013

Please execute these command in Terminal.app.

cd src/core/server/Resources
make install

Then, checkbox.xml and include xml files will be updated and reloaded.

@franciscolourenco
Copy link
Contributor Author

Sweet it's even more streamlined!
Thanks

On Wednesday, 27 March 2013 at 13:30 , Takayama Fumihiko wrote:

Please execute these command in Terminal.app.
cd src/core/server/Resources
make install
Then, checkbox.xml and include xml files will be updated and reloaded.


Reply to this email directly or view it on GitHub (#72 (comment)).

@franciscolourenco
Copy link
Contributor Author

By the way, are you using any one of these 2 option?
Because I'm not using them, was thinking about deleting them as their use seems far fetched.
Screen Shot 2013-03-27 at 15 50 08

@franciscolourenco
Copy link
Contributor Author

Hi, I'm trying to catch an EXTRA1 like this:

<autogen>__KeyToKey__ KeyCode::D, ModifierKey::EXTRA1, KeyCode::OPTION_L</autogen>

However, the EXTRA1 doesn't seem to be activated or catched. There are the 3 ways I've been trying without success:

<autogen>__KeyToKey__ KeyCode::K, KeyCode::CURSOR_DOWN, KeyCode::VK_MODIFIER_EXTRA1</autogen>
<autogen>__KeyToKey__ KeyCode::K, KeyCode::CURSOR_DOWN, ModifierFlag::EXTRA1</autogen>
<autogen>__KeyToKey__ KeyCode::K, KeyCode::CURSOR_DOWN | KeyCode::VK_MODIFIER_EXTRA1</autogen>

Any idea on how to make this work?

@tekezo
Copy link
Member

tekezo commented Mar 28, 2013

@aristidesfl
I do not know the usage of "Option+O to Tab" or other options because
other general users seems to use "Home Row Arrow mode".

This autogen works on my machine.

    <autogen>__KeyToKey__ KeyCode::D, ModifierFlag::EXTRA1, KeyCode::OPTION_L</autogen>
    <autogen>__KeyToKey__ KeyCode::K, KeyCode::CURSOR_DOWN, KeyCode::VK_MODIFIER_EXTRA1</autogen>

If you want to repeat Down key, use these autogens.

  <item>
    <name>My Custom Setting</name>
    <identifier>private.my_custom_setting</identifier>
    <block>
      <config_only>notsave.homerow_flags1</config_only>
      <autogen>__KeyToKey__ KeyCode::D, KeyCode::OPTION_L</autogen>
    </block>
    <autogen>
      __KeyToKey__
      KeyCode::K,
      KeyCode::CURSOR_DOWN,

      Option::KEYTOKEY_BEFORE_KEYDOWN,
      KeyCode::VK_CONFIG_FORCE_ON_notsave_homerow_flags1,

      Option::KEYTOKEY_AFTER_KEYUP,
      KeyCode::VK_CONFIG_FORCE_OFF_notsave_homerow_flags1,
    </autogen>
  </item>

  <item hidden="true">
    <name>flags</name>
    <identifier vk_config="true">notsave.homerow_flags1</identifier>
    <autogen>__ShowStatusMessage__ moge</autogen>
  </item>
```xml

@tekezo tekezo closed this as completed in 99d3eef Mar 28, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants