RamonUnch / AltSnap

Maintained continuation of Stefan Sundin's AltDrag
GNU General Public License v3.0
2.16k stars 71 forks source link

select different function for press-release and press-drag-release (like X11 twm/vtwm f.deltastop functionality) #110

Closed reikred closed 2 years ago

reikred commented 3 years ago

In certain X11 window managers, you can assign different functionality to a mouse button depending on whether you just press-release or press-drag-release.

For example, it is common for button1 to be programmed so that press-release minimizes the window, whereas press-drag-release moves the window. This is a very useful feature that enhances the utility of a 3-button mouse.

My question is whether this functionality might get implemented in AltDrag/AltSnap. It is quite an addictive (useful) feature to have.

PS:

In X11 twm/vtwm parlance, the above functionality is know as f.deltastop, where deltastop I guess refers to whether the mouse position moved by some distance delta after being pressed (before the button is released). The above example (and two more) are expressed in the config file ~/.vtwmrc as follows:

Function "move-or-iconify" {f.move f.deltastop f.iconify} Function "move-or-raise" {f.move f.deltastop f.raise} Function "resize-or-circledown"{f.resize f.deltastop f.circledown}

Button1 = m : window|title|icon : f.function "move-or-iconify" Button2 = m : window|title|icon : f.function "move-or-raise" Button3 = m : window|title|icon : f.function "resize-or-circledown"

(m stand for meta or Alt, it is the qualifier)

RamonUnch commented 3 years ago

Nice idea indeed, I had not used this window manager before, For now it would need some important adjustments to AltSnap, but I really think it would be good to add this at some point.

In the meantime, remember that Ctrl+Alt+Double-left-click minimizes the current window, but for sure adding the ability to make the difference between clic+drag and click would open a lot of options.

RamonUnch commented 3 years ago

Also you may be interested in the StrokeIt program, that add mouse gestures ability to Windows that is quite configurable and I used it for a while. It has not been updated for a while but is quite reliable

xaryangupta commented 3 years ago

may be interested in the StrokeIt program

Is there a newer alternative to this?

RamonUnch commented 3 years ago

There are some alternatives from what I remember, StrokeIt was quite powerful and worked on my old PC without problems. I do not remember precisely but you can google "Mouse gestures under windows" you should find some stuff, for exemple: https://sumtips.com/software/mouse-gestures-support-in-windows/

RamonUnch commented 2 years ago

@reikred Well I am working on implementing this feature: 1) Only move and resize actions could differentiate between click+drag+release and click+release 2) By default The click+release is blocked for the doubleclick actions. This can be disabled using PiercingClick option in the [Advanced] section of the .ini file. However a long click will always work. 3) By default when using

Try with this version of hooks.dll and Add and adjust the following in the .ini file

in the [Input] section:

MoveUp=Nothing
MoveUpB=Nothing
ResizeUp=Nothing
ResizeUpB=Nothing
; Actions that will be performed on the click UP even of a Move/Resize
; IF no drag occured AND the click was long or PiercingClick=1.
; The B sufixed version apply if the ModKey is down, as usual.
; /!\ Those actions are not associated with buttons but with Move/Resize.

It is not exactly the same than X11 twm, But I guess few people would want to have two buttons mapped to the Move action anyway. You may try to set MoveUp=Minimize and a long non-dragging Alt+click will minimize the window on click up. If you set PiercingClick=1 in the [Advanced], the click will no longer need to be long.

This is still WIP, feel free to report problems, do not expect everything to work with every set of options. 32 bits build: hooks_1.50test7_i386.zip 64 bits build: hooks_1.50test7_x64.zip

Ichisich commented 2 years ago

Works surprisingly intuitive, but what are the B entries for?

I mapped minimize to MoveUp and maximizeHV to ResizeUp. The only hurdle was that maximizing with right-click while moving would minimize the maximized window, in case I didn't drag the window beforehand a little.

Curiously, left-click while resizing does not show this behaviour, probably due to the context-menu fix?

RamonUnch commented 2 years ago

The B version if for the secondary action, when the ModKey is down, keep in mind that the ModKey can also changes the mouse button actions, so Alt+Click+Mod+release != Alt+Mod+Click+release, depending on your config.

I see, I should make in sort that click combo disable the mouse up actions. Not sure for the other combo.

Ichisich commented 2 years ago

/!\ Those actions are not associated with buttons but with Move/Resize.

I see, I have to map move and resize to either LMBB or RMBB to use "Non-Drag-Actions" with the modkey.

RamonUnch commented 2 years ago

Yep it is a bit complicated but configured properly it should be powerful, and most people will not need to go so deep. Here is the fix to avoid combo/ClickUp intercation, Actually the Left+Right click combo is quite special because the "move" action is not finished, as you can toggle and keep moving the cursor. Because of this it was buggy, but the fix is easy, just need to check that a movement is not ongoing before handling mouse up events:

hooks_1.50test8_i386.zip hooks_1.50test8_x64.zip

Ichisich commented 2 years ago

Yes, you keep the hand cursor even after maximizing, but it works. The click-combos in general are a good addition because they elude the double click limitation of piercing click. Besides, users with disabilities have an alternative.

Currently, Use AltSnap for normal titlebar movement has the passive effect that you can use the left-click action, and not movement specifically, without hotkey. Not sure if worthy of an own issue, but it happens to be that you can use Not-Drag-Actions as well. Would be nice to have all options in the title bar available, and it wouldn't matter any more if move window is mapped to the left mouse key to work.

RamonUnch commented 2 years ago

I am not sure I understand the problem. The 'normal' movement is a left click in the title-bar and AltSnap grabs it like a movement, to replace the native movement. If someone wants to move windows with the right click for instance, he can change the native Windows Mouse setting and AltDrag should behave.

Something to be done in the future would be to have a selected list of actions for each mouse button when clicking in the title-bar without having to press the hotkey. For now it is hard coded stuff such as the lower with middle mouse button, and the Use AltSnap for normal titlebar movement. This could be made in a more generic fashion.

Do you think the not-drag action should not be performed when moving from the title bar? I am not sure what is really desirable at this point. Or maybe always after a long click regardless of the PiercingClick option?

RamonUnch commented 2 years ago

I am not sure I want to implement this generic title bar stuff, because in general I am not a fan of actions that rely on accurate position of the click, this is already performed natively by Windows, you can still resize even without AltSnap, it can be made. What would the resize action look if it was done in the title bar? Always up? not very interesting.

Ichisich commented 2 years ago

I would either go full hardcoded or general. Whatever is mapped to the LMB contrasted to MMB specifically lowers and Shift+MMB specifically minimizes isn't really consistent. I would either hardcode movement in the title bar to left-click, or just let all buttons be active in the title bar without hotkey, including non-drag-actions using the primary actions.

I'd advocate for general. Shift+MMB is already redundant, when you have to press a key plus mouse, you can just minimize with a standard hotkey-action.

With non-drag-actions included, you could use 7 actions without any hotkey. e.g. my setup: LMB=moves -> NDA=maximizesHV -> CK=maximizes MMB=closes RMB=resizes -> NDA=minimizes MouseWheel=Volume

Admittedly, resizing isn't really thrilling and always better done by a hotkey-action, grid or zones.

RamonUnch commented 2 years ago

Good point. Better to create a new issue though because this one was about actions on mouse up.

reikred commented 1 year ago

Hi Ramon,

I have installed hooks_1.50test8_x64.zip to replace hooks.dll in the currently latest version AltSnap 1.59 and it works great!!

I'm sorry I missed out on the original notification of your work a year ago!! It got lost among some noise, sorry about that. But I would like to report back that I'm having success in using this new feature.. Perhaps you can include it in the next release?

Much obliged RR


Settings: I programmed the AltDrag.ini file as follows

;(at the top of the [Input] section) MoveUp=Minimize MoveUpB=Minimize ResizeUp=Minimize ResizeUpB=Minimize

;(at the top of the [Advanced] section) PiercingClick=1


RamonUnch commented 1 year ago

It is present in the latest 1.59 release. I would recommend you upgrade. All most of the logic happens in hooks.dll and AltSnap.exe is mostly the user interface.

You can access those options via the GUI, they are named Drag-free Move and Drag-free Resize.

reikred commented 1 year ago

Hi Ramon, do you think you could also implement "move-or-raise" (see original post), where raise means to foreground the window (not sure what that is called in windows parlance).

If not clear why this is useful: I can raise a window simply by clicking the mouse1 button (LMB?), but the problem is that it is completely ingrained in me to press the Alt key when I use X11 (or AltSnap), and in that case there is no programming of AltSnap that will raise the window (move-or-raise is the desired functionality).