add drag mode for click-and-drag / text selection #96
Conversation
…r starting point in floating mode and most right point of label as ending point
|
Thanks for your PR. I like the idea and it's something that was suggested as well (#31). I am wondering however if implementing it as a mode makes the most sense. It doesn't really do anything and most of the logic is already outside. I feel like just being an option, e.g. |
|
After some thought, I realise that the "mode" abstraction is starting to show its limits. What we're really doing is running through modes until we get a selection and then rerun them from the start to get the second selection which then enables us to do the mouse drag so it's not really a "mode". It should make the code simpler then not implementing it as a mode but just as an option, e.g. |
|
If you have it an option as |
|
I think it might make more sense to keep What do you think is the best approach here? |
|
You make a great point. The only thing the I like your suggestion with the Now, for this PR, I think it makes sense to just add the Once it's merged, the |
|
I refactored the code so that drag more is triggered using |
Adds a
--dragflag (-d) that performs a left-button click-and-drag between two selected positions, enabling text selection and UI element dragging via the keyboard.How it works
--dragis a flag that can be combined with any mode chain. It requires two selections:It works with any mode or chain of modes:
wl-kbptr -o modes=tile,click --drag
wl-kbptr -o modes=floating,click --drag
wl-kbptr -o modes=bisect,click --drag
wl-kbptr -o modes=split,click --drag
wl-kbptr -o modes=tile,bisect,click --drag
Demo
recording_20260610_121438.mp4
Configuration (
[mode_drag])start_marker_color#f50dstart_marker_size8start_marker_shapecaretcaret(I-beam),rectangleorcircleImplementation notes
restartcallback tomode_interfaceso the mode chain can be reset for the second selection without re-doing setup (e.g. floating keeps its loaded/detected areas, tile/bisect/split reset their label selection or history)drag_phaseis tracked onstruct state; drag intercept logic lives inenter_next_modeat the terminal pointmode_render, on top of whatever mode is currently active