UltimateHackingKeyboard / agent

Ultimate Hacking Keyboard configurator
https://ultimatehackingkeyboard.github.io/agent/
Other
692 stars 77 forks source link

Handle creating layer switch actions on all keymaps targeting a non-existing layer #2309

Open mondalaci opened 3 days ago

mondalaci commented 3 days ago

Let's say you use the Fn2 layer on your main keymap but not on some of your other keymaps. Agent still allows to map a "switch to Fn2 layer" action while using the "Remap on all keymaps" checkbox.

In this case add the following notification:

You're about to target the ${targetLayer} layer on all keymaps, some of which don't have this layer. If you proceed, the ${targetLayer} layer will be added to all your keymaps.

image

Upon remapping, create targetLayer on all keymaps accordingly. Fill the new layers with none actions, except the remapped key.

kareltucek commented 2 days ago

I am not sure about this.

I don't have any strong arguments, but my intuition sais that the layer switch should be mapped only in those keymaps that have the target layer.

mondalaci commented 2 days ago

We can have a checkbox in the notification to make Agent create the target layers explicitly. What do you think? Otherwise, it'd work as you're suggesting.

kareltucek commented 2 days ago

This is quite a niche problem. From developer perspective, I am not sure we want to complicate the code with additional fields.

From users perspective, having the checkbox is definitely a good thing though.

(To be clear, I don't mind any of the three variants, just throwing in an opinion.)

mondalaci commented 2 days ago

Good point. At the very least, we should display a warning.

@ert78gb How much work is it to implement the functionality of the checkbox?

ert78gb commented 2 days ago

Less than 4 hours the checkbox version. I don't know exactly.

mondalaci commented 2 days ago

Then let's only display the following notification:

You're about to target the ${targetLayer} layer on all keymaps, some of which don't have this layer. This mapping will only be added to keymaps which have the ${targetLayer} layer.

Make Agent behave accordingly.