input-remapper icon indicating copy to clipboard operation
input-remapper copied to clipboard

Support for keyboard layers

Open matt-vdv opened this issue 3 years ago • 6 comments

Firstly, thanks for the great software!

I think it would be great if you could set up one key (say, right alt) that would toggle between two different keyboard layers. So, you would press the key to go to the second layer, where you could have a numberpad, for example for people without one, then press the same key again to return to normal QWERTY mappings.

matt-vdv avatar Apr 12 '21 19:04 matt-vdv

Thanks.

I think this is a duplicate of https://github.com/sezanzeb/key-mapper/issues/72, or at least it can be solved like that if implemented.

If you would like to propose a different solution, feel free to reopen this

sezanzeb avatar Apr 12 '21 19:04 sezanzeb

lets keep the layers discussion here https://github.com/sezanzeb/key-mapper/issues/72#issuecomment-818501992

what do you think is a good way to configure such a feature in the gui?

sezanzeb avatar Apr 13 '21 17:04 sezanzeb

Here are some simple mock-ups I quickly made (sorry for the poor GIMP usage, not really used it before): key-mapper-mockup1 key-mapper-mockup2

Basically, when the layers selector is set to Main layer, the key map alteration would behave like normal. If the layer selector was set to Secondary layer, you could then set up a mapping for something like w to up arrow. These keybindings wouldn't come into affect until the Layer toggle key was pressed, maybe there would be an option somewhere for this to be a toggle or momentary?

Not sure if this is the best idea, just the first thing that came into my head...

matt-vdv avatar Apr 13 '21 19:04 matt-vdv

nice, well done!

And while a certain layer is active, other keys that are not specific for that layer (i.e. not mapped in that layer again) remain at their previous mapping? Otherwise it would be exactly like a key to switch presets. And when switching back from a layer A to the "Main Layer" mappings from A would be disabled, until A is enabled again.


I'm a bit afraid of adding features to the gui that make it look more complex though. An easy to implement solution that I just thought of might be via macros that can set variables.

A: toggle(1)
B: on(1, k(a), k(b))

writes "a" if 1 is active, otherwise b.

It certainly is harder to discover via macros, but that system provides the easiest way to add features for sure, while the gui remains as simple as possible.

or

A: set(foo, 1)
B: ifeq(foo, 1, k(a), k(b))

which one do you like more? I guess the second one with ifeq would potentially add lots of flexibility in the future. I think I'm gonna do set and ifeq. And I might need to add a popup with more space to write macros.

sezanzeb avatar Apr 13 '21 19:04 sezanzeb

Yeah the second one seems good! As for the GUI, you could maybe have the layers feature disabled by default (i.e the GUI would look the same as at the moment) then the layers toggle would only appear if the user enabled the feature, maybe in an advanced settings tab in the about dialog?

Having the key bindings from the main layer still used if no alternative seems a good idea, especially if it actually makes it feasible to implement!

matt-vdv avatar Apr 13 '21 20:04 matt-vdv

  • set(layer, 1)
  • if_eq($layer, 1, h(b), h(c))

not very fun to configure, but it can work now

Does that work for you?

A toggle button could work with if_eq($layer, 1, set(layer, 2), set(layer, 1))

sezanzeb avatar Apr 25 '21 17:04 sezanzeb