wl-kbptr icon indicating copy to clipboard operation
wl-kbptr copied to clipboard

Add a new config setting to change the keys used to select labels

Open jirassimok opened this issue 5 months ago • 3 comments

(My other two PRs are minor and probably-uncontroversial bug fixes. This one is a significant enhancement that includes some design decisions.)

I find that it's easier to read capital letters at a glance when using tile mode, so I want my labels to show capital letters. But if I set mode_tile.label_symbols=ABCD..., I have to press shift to select a target.

This PR introduces a second, optional configuration option for tiling and floating modes, which I named keys. If it is empty, no behavior changes. If it is set, it must be the same length as label_symbols, and it represents the keys to listen for to select the corresponding symbols.

So if mode_tile.label_symbols=ABCDE and mode_tile.keys=abcde, the tile will display labels like AA BA CA, but will listen for regular, lowercase keyboard keys.

To achieve this result without interfering with UTF-8 symbols, I added a new field to label_symbols_t that represents the keys (and renamed .data to .symbols), and changed several of the label_symbol_* functions to refer explicitly to keys.

One potential issue here is that I did not name static methods as nicely as I could have; two of the new helpers for setting up label symbols don't start with label_symbol_.


I'm not sure looking at the individual commits will be very helpful to understand these changes more than looking at the total diff. Maybe dc14cafa would be useful, though. That's my initial implementation, without as many renames to confuse the diff. But several of the later commits swap the meaning/effect of the options/fields, so it doesn't really look like the final version.

~~(Also, note that the first commit here is the commit from #63.)~~

jirassimok avatar Sep 27 '25 02:09 jirassimok

Update: I added a second bugfix to #63, so I've rebased these changes onto that as well.

jirassimok avatar Sep 29 '25 18:09 jirassimok

Rebased onto main again.

jirassimok avatar Oct 21 '25 13:10 jirassimok

I see what you're trying to accomplish. Whilst I don't have a use for it, it's not a bad idea.

I think it would be easier to test and introduce less code if you were to just have two label_symbols_t structs in the bisect_state structure and use one for rendering and the other for the key matching. Just checking that there are the same size would do the trick.

moverest avatar Nov 05 '25 20:11 moverest