RamonUnch / AltSnap

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

[Question] Just right-click to resize, right-click in center to move? (like NiftyWindows) #490

Closed aand18 closed 1 year ago

aand18 commented 1 year ago

TL;DR: Set the following values in AltSnap.ini to use right-click like in NiftyWindows:

; use right-click to move/resize
Hotclicks=3       ; Enables resizing/moving windows using right-click
ResizeCenter=2    ; Initiates move action with right-click in window center
PiercingClick=1   ; Pass right-click to the window when not in move/resize mode
DragThreshold=3   ; Ignore small mouse movements during right-click
; next settings might not mirror exactly how NiftyWindows worked
AutoFocus=1       ; Automatically brings target window to the foreground
CenterFraction=60 ; Defines a larger 'move' command area and smaller 'resize' area
UseCursor=0       ; Prevents cursor change during moving/resizing actions

Original:

Hello, I'm really excited to find this neat program!

I wonder if it can replicate the behaviour of an older program I used called NiftyWindows (no longer maintained):

TL;DR: to enable NiftyWindows behaviour, set this in AltSnap.ini

Hotclicks=3 ; use just right click to resize/move a window
ResizeCenter=2 ; activate move action for right click in window center
PiercingClick=1 ; fix right click not being passed to the target window when not moving/resizing
DragThreshold=3 ; ignore negligible mouse motion when right-clicking
AutoFocus=1 ; move target window to foreground
CenterFraction=60 ; use bigger area for 'move' command vs. resize
UseCursor=0 ; don't change the cursor when moving/resizing

I've tried:

I apologise if it's already answered somewhere else, I couldn't find it. I've looked at the pinned items and tried a few different settings.

Ichisich commented 1 year ago

I wonder if it can replicate the behaviour of an older program I used (no longer maintained):

* resize: `right click` + `drag`

* move: `right click` in center window

move

I've tried:

* the default (`Alt` + `Click`) behaviour - it requires too much precision (press an exact key) and requires keyboard use. I find it very uncomfortable, compared to what I'm used to (`right click `+ `drag`) which requires no keyboard and `right click` + `drag` needn't be precise

* activation with a second mouse button - it's difficult to drag the mouse while pressing multiple buttons, uncomfortable vs. what I've used before (`right click `+ `drag`)

I'm not sure if I understand you correctly, but you can bind resizing to the middle mouse or the back forward buttons and use them without the activation key.

click

aand18 commented 1 year ago

@Ichisich thanks for the reply!

  1. Yes! "Center resize mode - Move" is exactly what I was looking for and resolves the moving issue for me.
  2. Adding "Right mouse button" to the "Hotclick/Activate with click" section would solve the activation issue for me. (Should I open a feature request?)

I'm afraid other mouse buttons aren't practical for my work with browsers, and interfering with default mouse functionality is problematic:

From my point of view, activating with right click is the nicest option because:

EDIT: the following setup with mouse button 2 would be perfect:

image

EDIT 2: currently not good enough because it disables the click action of the button. I've tested mouse back btn, like in the screenshot above. Moving/resizing works perfectly but clicking does nothing. My suggestion would be to have an activation threshold for the drag.

Therefore, two improvement suggestions:

  1. Add the "Right mouse button" option to the "Hotclick/Activate with click" feature.
  2. Implement a "drag activation threshold":
    1. A click with the "Right mouse button" activates AltSnap.
    2. When the "Right mouse button" action is set to "Resize window":
      • If the mouse is dragged fewer than the "threshold" number of pixels (e.g., 5px), then no action should be taken.
      • If the "Right mouse button" is released without any dragging, forward a "Right mouse button click" event to the target window.
      • If the mouse is dragged beyond the "threshold" number of pixels, then execute the "Resize window" action.

Hope I was clear enough. Any thoughts?

RamonUnch commented 1 year ago

EDIT 2: currently not good enough because it disables the click action of the button. I've tested mouse back btn, like in the screenshot above. Moving/resizing works perfectly but clicking does nothing. My suggestion would be to have an activation threshold for the drag.

I did not read everything, but the Resize action forwards the click if you perform a long click. You can also check the Avoids blocking Alt+Click option in the general tab and you will no longer need a long click.

Also you can already ues MB1 and 2 as a hot-click if you directly edit the .ini file. They are not present in the GUI so that people do not mess up by accident.

RamonUnch commented 1 year ago

So in your case you want to set PiercingClick=1 in the [Adbvanced] section of the ini file. And set Hotclicks=03 so that the Right mouse button is a hotclick.

So in this case you will have Right click that is forwarded whn you release it.

If the cursor change disturbs you you can try to set UseCursor=3 or UseCursor=0

RamonUnch commented 1 year ago

Keep in mind that the mouse click has to be blocked in the case of an acivation, AltSnap then forwards it if no action was done but it cannot know this in advance, so if you set a mouse button as a hotclick you can no longer drag and drop with the said button, So for MMB, MB4/5 it is no trouble but for LMB and even RMB it might be a significant annoyance depending on your workflow, that s why it is disabled by default.

RamonUnch commented 1 year ago

Also do not forget you Also have the DragThreshold Option in the [Advanced] tab section of the ini file.

DragThreshold=1
; Require a small drag before actually starting a movement.
; Set to 0 to disable (like for AtSnap 1.58 and below)
; Set to 1 to have a drag threshold for maximized/snapped windows only (default).
; Set to 2 to always have a drag threshold.
; Set to 3 to have a drag threshold even when resizing the window.

In general I would advice you get a good read through the wiki and through the ini file options. I know the wiki is not up-to-date but everything takes times and I there are other priorities, even though I agree wiki is more important than it looks.

aand18 commented 1 year ago

Thanks for your time and the detailed suggestions!

I'll take a bit to test everything, and then come back with some feedback.

aand18 commented 1 year ago

Hello, I updated the original post with some settings that match what I was looking for. I also updated the title for better "searchability".

Performance is great and I had no issues with default right-click functionality. IMO this app should be part of Windows!

Thanks again!