feat: single-key and number-key toolbar shortcuts
Hi folks, this is my very first community PR ever, and I'm also doing this to learn Rust, so bear that in mind.
Description
This PR introduces changes to allow tool selection via keyboard shorcuts and closes https://github.com/gabm/Satty/issues/50.
| Tool | Shortcut |
|---|---|
| Pointer | P |
| Crop | C or 1 |
| Brush | B or 2 |
| Line | L or 3 |
| Arrow | A or 4 |
| Rectangle | R or 5 |
| Ellipse | E or 6 |
| Text | T or 7 |
| Marker | M or 8 |
| Blur | U or 9 |
| Highlight | H or 0 |
Would be nice to have [keybinds] section in config to customize it.
thank you for your contribution.. does IM Context still work? e.g. Chinese input?
I really like the idea of one key shortcuts to tools. That said, I see potential clashes with future zooming/panning functionality:
Shift 1-5 and 1-5 are used for zoom in gimp, we could reuse those for zooming. But on the other hand, Ctrl+/Ctrl-- might just be good enough. WASD and HJKL might be familiar for moving around, we might use that to move around in a zoomed image. Not sure we need both, the latter doesn't lend itself to moving the canvas, I think, but maybe the cursor even though admittedly it has limited usefulness for sure.
I'd probably do away with the number shortcuts for now and leave that for (later) remapping via config file if users want to use those for tools.
- Arrow A-> Z (no better idea, sorry)
- hiGhlight H->G
- lIne L->I
Yes, sadly it is not as intuitive, but I think it's less painful than having to move them later.
Sorry for the remarks at this late stage when the PR was already here for a while. Thoughts? Feel free to tell me to get out of here ;)
What about we unlock this PR with:
- Remove numbers at the moment (until further discussions about zoom handling can progress)
- Choose between HJKL or WASD, but IMO it's wasting keys to offer 3 different arrow-shortcuts (arrows, HJKL and WASD...)
- Use whatever letters that fit and we can work on another PR to bring these letters to the config file :bulb:
IMO it would bring a lot of value to start with just these few shortcuts. :bow:
What about we unlock this PR with:
1. Remove numbers at the moment (until further discussions about zoom handling can progress) 2. Choose between HJKL or WASD, but IMO it's wasting keys to offer 3 different arrow-shortcuts (arrows, HJKL and WASD...) 3. Use whatever letters that fit and we can work on another PR to bring these letters to the config file 💡IMO it would bring a lot of value to start with just these few shortcuts. 🙇
Personally, I'd be happy to leave configurability for a followup feature. I could also live with just removing the number shortcuts (there's more than one reason against them), and then just mark all the rest as "Experimental" in the readme, which means we could still change them at a later point in time as we see fit.
But that's not even the biggest problem IMO.
- does IM Context introduced in #52 still work? Question asked here, not answered. Somebody would have to test this.
- does anyone want to continue to work on this? Because there are conflicts that need resolving.