waldobronchart/ShortcutMapper

Change keys combination to keycode

mdtrooper opened this issue · 4 comments

Hi, your project is awesome.

I have been reading your code, it is good code.

But I found a little problem, well I am trying to fixing (in a local branch) but I could not fix it.

The little problem is the differences between languages, for example the action "Zoom out in Timeline panel to show the entire composition duration" in the "Adobe After Effects" is key combination [ shift ] + [ ; ] = [ : ](in english layout), but in spanish layout is key combination [ shift ] + [ . ] = [ : ] .

I think maybe it is better [ keycode ] -> [ action ] instead [ keys combinations ] -> [ action ].

And in the previous example is: [ colon ] -> [ Zoom out in Timeline panel to show the entire composition duration ]

The problem is change the javascript code and the source layouts. It is a lot of work, sorry, but I can help you.

Regards.

Thanks, this is a great suggestion. I've actually thought about doing this, but found out that not all applications do key detection like that. While this is correct for Adobe applications, it doesn't work for Blender. I then decided to take the easy route because thinking about it makes my brain hurt. But it may be worth doing!

We would need to add additional data to the keyboards, maybe something like this:

<button data-key="ONE" data-key-shift="EXCLAMATION">1</button>
<button data-key="TWO" data-key-shift="AT">2</button>
<button data-key="THREE" data-key-shift="HASH">3</button>

And then depending on the application, we'd handle it one way or the other.

There's a similar problem where some apps treat NUMPAD_ZERO and ZERO the same, and others treat them as different keys. I try to solve for that with the --explicit-numpad-keys option in the /utils/export_intermediate_data.py script.

We need to do a bit of research into how different applications behave with various languages. If a pattern can be found, we should be able to solve this problem.

Yes.

I have been trying as this steps:

<button data-key="LESSTHAN" data-key_shift="MORETHAN" data-text_shift=">"><</button>

Regards.

I have a problem as well that seems it could be solved with what you're suggesting here.

I can't access the following symbols "!"#€%&/()=?`" for shortcuts, since they are layered on "1234567890+´" on my keyboard, but modified with the ⇧ key. When I press ⇧ it looks for ⇧ + 1, but this is incorrect for me, because as soon as I press ⇧ the key in 1 position is now representing something else. (in this case "EXCLAMATION") This means that a lot of shortcuts are hidden for my keyboard layout.

Adding additional data for keyboards like you suggested would in my case for Danish Mac keyboard layout be:

<button data-key="ONE" data-key-shift="EXCLAMATION">1</button>
<button data-key="TWO" data-key-shift="AT">DOUBLE_QUOTE</button>
<button data-key="THREE" data-key-shift="HASH">3</button>

In my case it turns out that control and option doesn't change the key, but just works as modifier for "!". This means that I would only need to add data-key for shift in order to acces all the keybinds that include 1.

Assuming a key can only represent one character goes against the whole idea of mapping shortcuts and unfortunately makes this project quite limiting for me... It's the same for "<" that can also represent ">" and using "," becomes ";" and so on.

I'm assuming there isn't currently a way to have one data-key result in multiple options?
If so that could solve the problem if shortcuts were just stored with a shift before. The software I'm working with exports everthing like this, so when I set a shortcut for "!" is exported as "Shift+!".

Another way to solve it is to dictate that "!" is always the same as "Shift + 1", """ the same as "Shift + 2", "#" the same as "Shift + 3" and so on. But I think your approach is probably the best.

Hey @waldobronchart. I've been trying to make a fix for adding shift-values to keys, but without succes. @mdtrooper did you ever find a way to add more than one data-key to a button?

I'm not strong in JavaScript, but for now I've been making a hacky sub-optimal solution. I'm adding an extra layer of keys in the same row and then hiding/showing them with an eventlistener that activates a CSS visibility property, (hidden/visible) when shift is being pressed/released.

This allows to show completely different keys when shift is being held down and therefore allows me to view about 12x4 more shortcuts. (shift/control/option) I'll probably work on adding it to all keys that have a shift modifier. This would optimally need to be added for all keyboards. (lots of manual work)

However this solution for sure has some downsides. First of all it doesn't show that keys some have a hidden shortcut stored with shift since it's not finding a value matching the nomod version. ("1" button doesn't know that there is a shortcut for "!"). Also for now it's not reacting to mouse clicks on keys, since it's only listening to keypresses. (that should be possible)

I really think the solution would be to add options for modified data-key values. I just don't think I'm able to do it. I don't think it's necessary to add keycode as long as it's possible to do the addition more data-key vaues in the keyboard.html files

I've demonstrated my code in this recording:

Shortcut-Mapper.-.Shift-Mod.mp4