UltimateHackingKeyboard / agent

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

Copy-paste layers #1954

Open likern opened 1 year ago

likern commented 1 year ago

As a heavy user of layers I have some proposals to make life a little bit smoother.

  1. Allow to add custom names to layers. Let's say I've utilized fn4 layer because I've expected to use fn, fn2, fn3 for some other things. But it turns out they are now empty. Ideally I'd want either move all fn4settings to just fn (without breaking macros) or rename fn4 so that it's name becomes meaningful to what this layer does. It can be done only at UI layer (macroses continue to use fn4 internally) or even better to add this support to macroses.
  2. Allow to duplicate layer. So I can just duplicate easily all fn4 to new (let's say fn5 or fn3) layer.
  3. Allow to overwrite layer. If I have layers fn4 and fn3, allow to overwrite fn3 with what fn4 has, so I can experiment on a new layer. It's effectively like p. 2 - delete layer fn3 and then duplicate layer fn4 to fn3.
  4. Allow to sync layers (advanced, optional). It's like p.3 but doesn't touch keys of fn3 which has some (any) bindings. Only empty keys gets rebinded from fn4.
IzK666 commented 1 year ago

@likern I've created a tool to copy-paste layers which solves your problems 2 and 3. https://izk666.github.io/UHK-Viewer-v5

mondalaci commented 1 year ago

@likern Thanks for elaborating on your request. I'm thinking about an unintrusive UI that enables the requested features.

@IzK666 Excellent work! What's your use case?

IzK666 commented 1 year ago

Almost since the beginning I was using karel's firmware. I've a numpad on the right side of the fn layer and sometimes I want to fix this layer (double tap fn), but I don't want to loose the ability to use the arrow keys on the mod layer, so I created a new keymap with the fn and the base layers swapped.

Also, copy-pasting layers was very useful when you implemented the new layers, as I had some layers on other keymaps which I could use with macros and I wanted to transfer them to the new layers without assigning one by one all the keys.

And lastly, when I made a change on my default IZK keymap, I usually want to spread those changes to other specific keymaps I have.

mondalaci commented 1 year ago

I've been thinking about the least obtrusive UI enabling the requested features. The customer layer names and the sync layers feature is not planned, but the rest would be possible.

At the end of the layer dropdown menu that contains the layer checkboxes, we'd add a separator followed by a "copy current layer to clipboard" and a "overwrite current layer with copied layer" menu item.

What do you think, guys?

IzK666 commented 1 year ago

As the copy-paste (copy-overwrite) is a function related to layers and the main goal is to keep the UI as clean as possible, it may work well. I can't think of a better place.

mhantsch commented 1 year ago

I've created a tool to copy-paste layers

Brilliant! Thanks for sharing this. Just what I was looking for.

Use cases:

mhantsch commented 1 year ago

At the end of the layer dropdown menu that contains the layer checkboxes, we'd add a separator followed by a "copy current layer to clipboard" and a "overwrite current layer with copied layer" menu item.

Why go through a clipboard? When you copy a keymap you also do not use a clipboard, you just click the Duplicate button.

I would simply show a dropdown "Copy this layer to:" and then it lists keymaps, and when you hover over a keymap name it drops down all the layers. So you would click a "..." menu and follow a structure like: ... -> Copy layer -> QTY -> Fn3

Or just start with a "Copy layer" button next to the layer selection buttons.

mhantsch commented 1 year ago

Thinking about this again, I may be gold-plating this, but here it comes:

You want sync. But you only need this if you create an actual copy. What if you could simply reference (link) to an existing layer. Agent would copy that layer only when you "Save" to the keyboard, but not within Agent.

So, if you change the original layer, all the references will also update on the next "Save". The UI would show a referenced layer in gray, and a link to jump to the original (in case you want to edit it).

You could also decide to break the link, and create an actual copy, then they won't "sync" again as the layer won't be a reference anymore.

Thoughts?

mondalaci commented 1 year ago

I wouldn't necessarily use the clipboard of the OS, but maybe an internal application-specific pseudo-clipboard.

A duplicate function is less general than an overwrite function. One can create a new layer and overwrite it, resulting in duplicating the copied layer.

I find the suggested multi-layer menu system hard to navigate, and I'm confident that the suggested copy-overwrite method is easier to navigate.

Making layer linking a first-class citizen would complicate the mental model of the layer system, and I don't believe this feature is widely requested enough to justify the added complexity. I'm sure many users would be confused, so I'd only allow layer linking via smart macros.

mhantsch commented 1 year ago

I thought about this again, and I think you are right: layer linking should be via smart macros, as this is an "absolutely expert"-mode feature.

Copying layers in Agent: I'm trying to understand how a typical use case would work. I've created my awesome super-special layer (or modified it), and now I want to copy it to 3 other keymaps. So I click "Copy layer". Then I navigate to the first of my other keymaps, select the layer I want to copy to, and click "Paste layer". Repeat for the other 2 keymaps. Correct?

mondalaci commented 1 year ago

Yes, correct.

mhantsch commented 3 months ago

I've been creating a few special layers and I really think naming them in the "Layers" boxes and the drop-downs with something else than Fn2, Fn5 etc. would be nice. But I see the trouble with macro commands such as holdLayer fn2...

Users are allowed to name their keymaps though, and you can change keymaps in macros using those names. You could argue that it would be consistent to also allow the naming of layers, at least with short words.

I am thinking of layer names such as "mirror", "numtab", "media".

mondalaci commented 3 months ago

I think the cost-benefit ratio of renaming layers is very low, considering their prevalence across the firmware, Agent, and documentation. Also, nobody has asked for this feature yet.

mhantsch commented 3 months ago

Also, nobody has asked for this feature yet.

@likern asked for it in the initial post: "Allow to add custom names to layers"

I do agree to your statement about cost-benefit. It's a "nice-to-have" wish.