Closed tollyx closed 4 years ago
Tried recompiling with the winit
feature, same result:
[2019-09-30T14:22:47Z DEBUG rx] event: KeyboardInput(KeyboardInput { state: Pressed, key: Some(Shift), modifiers: ModifiersState { shift: true, ctrl: false, alt: false, meta: false } })
[2019-09-30T14:22:47Z DEBUG rx::session] KeyboardInput { state: Pressed, key: Some(Shift), modifiers: ModifiersState { shift: true, ctrl: false, alt: false, meta: false } }
[2019-09-30T14:22:47Z DEBUG rx::session] command: BrushSet(Multi)
[2019-09-30T14:22:48Z DEBUG rx] event: KeyboardInput(KeyboardInput { state: Pressed, key: Some(Period), modifiers: ModifiersState { shift: true, ctrl: false, alt: false, meta: false } })
[2019-09-30T14:22:48Z DEBUG rx] event: ReceivedCharacter(':')
[2019-09-30T14:22:48Z DEBUG rx::session] KeyboardInput { state: Pressed, key: Some(Period), modifiers: ModifiersState { shift: true, ctrl: false, alt: false, meta: false } }
[2019-09-30T14:22:48Z DEBUG rx::session] command: Zoom(Incr)
[2019-09-30T14:22:48Z DEBUG rx::session] zoom: 1 -> 2
[2019-09-30T14:22:48Z DEBUG rx] event: KeyboardInput(KeyboardInput { state: Released, key: Some(Period), modifiers: ModifiersState { shift: true, ctrl: false, alt: false, meta: false } })
[2019-09-30T14:22:48Z DEBUG rx::session] KeyboardInput { state: Released, key: Some(Period), modifiers: ModifiersState { shift: true, ctrl: false, alt: false, meta: false } }
[2019-09-30T14:22:48Z DEBUG rx] event: KeyboardInput(KeyboardInput { state: Released, key: Some(Shift), modifiers: ModifiersState { shift: false, ctrl: false, alt: false, meta: false } })
[2019-09-30T14:22:48Z DEBUG rx::session] KeyboardInput { state: Released, key: Some(Shift), modifiers: ModifiersState { shift: false, ctrl: false, alt: false, meta: false } }
[2019-09-30T14:22:48Z DEBUG rx::session] command: BrushUnset(Multi)
Thanks for the log output, this should help. In the meantime, you can remap anything by editing the init.rx
file in eg. C:\Users\<User>\AppData\
.
What if ReceivedCharacter
was used for any key that's not a modifier key (in which case it would still use KeyboardInput
)? Or perhaps there is a way to correctly translate the key to the right key+modifier combination?
Also for anyone looking at this, on Linux the path is ~/.config/init.rx
, and the default options are in rx/init.rx
(I think it would be great to link to this file in the guide so people know what they can do).
It's weird that the following init.rx
doesn't work when I press Shift + . (:) though:
map . :mode command
Because on the verbose log I see:
DEBUG [rx] event: KeyboardInput(KeyboardInput { state: Pressed, key: Some(Period), modifiers: ModifiersState { shift: true, ctrl: false, alt: false, meta: false } })
DEBUG [rx] event: ReceivedCharacter(':')
DEBUG [rx] event: KeyboardInput(KeyboardInput { state: Released, key: Some(Period), modifiers: ModifiersState { shift: true, ctrl: false, alt: false, meta: false } })
DEBUG [rx] event: KeyboardInput(KeyboardInput { state: Released, key: Some(Shift), modifiers: ModifiersState { shift: true, ctrl: false, alt: false, meta: false } })
Note the state: Pressed, key: Some(Period)
.
It seems quite similar to https://github.com/cloudhead/rx/issues/66 which I fixed some time ago. Could you try checking that commit out and seeing if that solves the problem?
https://github.com/cloudhead/rx/commit/73f26c2b0b5c216caba8b049e478e5f02e7923f8
I cloned this today, so I was on https://github.com/cloudhead/rx/commit/2dda631ddf921d7c8b07f49b9464c2db0f8f4baa, and seems pressing :
on my keyboard didn't work. Let me know what I should try or what additional information you need and I'll be glad to help.
So the reason it's not working for you is that this behavior is currently hard-coded: when rx
receives <shift> ;
, it switches to command mode, as well as when it received simply :
.
Eventually I'd like to support modifiers in key-mappings, which should allow you to do:
map <shift> . :mode command
What if
ReceivedCharacter
was used for any key that's not a modifier key (in which case it would still useKeyboardInput
)? Or perhaps there is a way to correctly translate the key to the right key+modifier combination?
I need to look into this. I remember trying it out back in the day, and having other problems. Otherwise, I think this could indeed be a good solution.
Ok I remember the issue: if we use ReceivedCharacter
to map keys, we don't get Release
events. Which means we can't express things like "hold e to erase". This is a big limitation.
Eventually I'd like to support modifiers in key-mappings
The init.rx
I linked above made it seem like mappings for modes were already supported but I guess there is more magic going on if you say that :P
if we use
ReceivedCharacter
to map […] we can't express things like "hold e to erase".
Ah yeah that's a big limitation, not really actionable (perhaps a comment could say that in the code though?).
The
init.rx
I linked above made it seem like mappings for modes were already supported but I guess there is more magic going on if you say that :P
It should work, but looking at the debug output, you're holding <shift>
when pressing .
, so it won't trigger the mapping.
Yes, I am holding Shift while pressing . because that's : in my keyboard.
I should clean my keyboard
Eventually I'd like to support modifiers in key-mappings
Oh! Now I read that properly, I missed the "modifiers" part and the <shift>
addition. That makes more sense (I had somehow understood just custom mappings, which are already supported). Anyway, I tried on latest master (8e8deb5bb6db071212795938e68feaf28e19797b) with no luck again.
Hey would you mind trying #88 and see if it fixes the issue?
git clone git@github.com:cloudhead/rx.git
cd rx
git checkout remotes/origin/f/char-mappings
cargo run
And the issue is indeed fixed (on my end, anyway).
Related to #18
Windows 10, compiled with 1.38 stable. (
--vulkan
feature flag)rx does not go into command mode when writing
:
using a Swedish/Nordic keyboard layout (Shift + Period) and instead zooms in one level.It seems to recieve a colon in the
RecievedCharacter
event, but theKeyboardInput
contains a period.Logs: