Commands are being interpreted as "repeats" after manual window adjustments
Discussed in https://github.com/rxhanson/Rectangle/discussions/727
Originally posted by slifty January 13, 2022 I often find myself moving a window / resizing it, and wanting to put it back in it's normal place with my handy Rectangle hotkey -- for instance:
- Signal "Top Left" via Rectangle
- Adjust the window for whatever reason (moving out of the way temporarily for instance)
- Signal "Top Left" via Rectangle (to put it back)
Right now if f I do this, Rectangle treats that second "top left" command a "repeat" -- but it isn't really a repeat -- I actually just want it to go to the top left since that's not where it is right now. This can cause unpredictable behavior if I have special handling of repeat commands in Rectangle set up.
My current solution is to disable repeat commands, but I'd love to use them.
One solution to this problem would be to have the command associated with a window "reset" if the window is manually adjusted; another would be to have the "repeat" version of commands only trigger if the window is in the "correct" position given the most recent command.
@rxhanson I might be able to find some bandwidth to take a stab at fixing this, but could use a nudge in the right direction since it sounded like you might have an idea where this bug lives.
@slifty Thanks for checking in and looking to work on it. I did start thinking through this one again for the previous release but didn't make any changes because there is a bit of a dilemma with the correct path forward. Here's my previous thought from the discussion:
I think the proper path forward would be to disconnect that behavior from that checkbox [snap on drag] and provide a hidden setting for disabling listening to click and drag events, even though that would be rather annoying for some users.
The problem with that approach is that it is a breaking change for those users. Going the opposite direction and making a hidden setting for your desired functionality is basically just propagating this confusing behavior for users that don't have snap on drag checked but want repeat commands to work properly (and unsnap restore).
That leaves us with maybe a middle ground of adding another checkbox to allow both behaviors, but that might be hard to communicate properly.
What are your thoughts?
In terms of implementation, the SnappingManager is where all of this happens, because that's where the click & drag listening occurs.