microsoft / PowerToys

Windows system utilities to maximize productivity
MIT License
111.81k stars 6.58k forks source link

[FancyZones] Right mouse click and drag to select multiple zones #7925

Closed rmacnguyen closed 1 year ago

rmacnguyen commented 4 years ago

It would be nice if there were an option that allowed you to span a window across multiple zones using only the mouse. Right now, the closest you can get is:

  1. Left click and drag the window's title bar
  2. Right click to toggle zone activation
  3. Hold CTRL and drag to select multiple zones

The proposed option would make the following changes:

  1. While in zone activation mode, use left mouse up rather than right mouse down to exit zone activation mode
  2. Use right mouse down to begin zone selection
  3. Allow dragging of the window while both left and right mouse are held down to select multiple zones
  4. Use right mouse up to confirm zone selection

With the above proposal, the user would be committed to dropping the window they were dragging if they entered zone activation mode. Alternatively, one proposal to preserve the use of the right mouse button to exit zone activation would be:

  1. While in zone activation mode, allow right mouse down and drag to select multiple zones
  2. On right mouse up, preserve the highlighted zones
  3. Allow the user to repeat 1 and 2 while left mouse is still held down
  4. On left mouse up, fit the window to the highlighted zones (or whichever zone the cursor is currently in if it's not in the selection defined by step 2)
  5. If at any point, the user right mouse clicks (ie, mouse up after mouse down for less than some fraction of a second), exit zone activation mode

If you'd like to see this feature implemented, add a 👍 reaction to this post.

enricogior commented 3 years ago

Adding reference to https://github.com/microsoft/PowerToys/issues/6973

alphanimal commented 3 years ago

I would love this feature too!

It could be implemented by simply distinguishing between clicking and dragging when using the right mouse button. Right click to activate/deactivate zone mode, right click and drag to select multiple zones. Alternatively you could make the CTRL key to enable multiple zones rebindable to another mouse button, for example the wheel or back/forward buttons.

Having to use the Control key is inconvenient. Bein able to do this with only mouse buttons would be great!

will-hut commented 3 years ago

Would definitely like to see this implemented. Right now I have it set up so the shift key activates zones, and then during normal use I just push Ctrl+Shift at the same time and drag my window across the zones i want selected. Being able to bind the Ctrl+Shift behavior to the right mouse button would be very convenient.

mazamorac commented 3 years ago

Yes! I came to the repo to request exactly this.

Secondary button mouse dragging through multiple zones would allow pure-mouse use of FancyZones.

For example, my setup: on my ultrawide monitor, I defined a grid layout that's 12wide * 6high zones.

This allows me to put a window into any conceivable layout I might want it on, without reaching for the keyboard: Left half of the screen? Just drag from top left to middle bottom. Want 3 windows stacked vertically? Drag, done. Want a 2 stack? Drag, done. Want symmetrical or asymmetrical? done.

RhinoAus commented 3 years ago

Super plus one to this. Didn't even realize this was a feature until I read this thread.

203Null commented 2 years ago

Bump this again, mouse only fancy zone will be great

grandpixel commented 2 years ago

Bump. Are there plans to implement this?

mayureshs commented 2 years ago

Bump. Any updates on this ?

mazamorac commented 2 years ago

Bump again after 20 months (is it allowed or considered spam?). I'm reminded of this enhancement request every time I use the mouse to move windows in FancyZones.

Frosthaven commented 1 year ago

Just wanted to chime in with the value this would bring. Recently implemented a crude workaround via autohotkey and it's been a great boon after a long day of work.

; The right mouse button will act as
; Control when the left mouse button is
; held. This allows one-handed use of
; fancyzones for snapping a single
; window to multiple zones. Releasing
; either button will snap the window
; 
: @todo
; ensure this only runs on
; window drag or bug powertoys
; team for native support
#If GetKeyState("LButton", "P")
RButton::
   Send, {Blind}{Control Down}
   KeyWait, RButton
   Send, {Blind}{LButton Up}
   Send, {Blind}{Control Up}
   Return
grandpixel commented 1 year ago

Just wanted to chime in with the value this would bring. Recently implemented a crude workaround via autohotkey and it's been a great boon after a long day of work.

; The right mouse button will act as
; Control when the left mouse button is
; held. This allows one-handed use of
; fancyzones for snapping a single
; window to multiple zones. Releasing
; either button will snap the window
; 
: @todo
; ensure this only runs on
; window drag or bug powertoys
; team for native support
#If GetKeyState("LButton", "P")
RButton::
   Send, {Blind}{Control Down}
   KeyWait, RButton
   Send, {Blind}{LButton Up}
   Send, {Blind}{Control Up}
   Return

How can this work on second right-click, because the first right-click initiates the fancyzones layout. Like I left-click on a window title and drag, and then right click brings up the zones, and THEN I hold CTRL to span across zones. Can it be written so that the first right click brings up the zones, and the second right click is held to span zones?

Frosthaven commented 1 year ago

How can this work on second right-click, because the first right-click initiates the fancyzones layout. Like I left-click on a window title and drag, and then right click brings up the zones, and THEN I hold CTRL to span across zones. Can it be written so that the first right click brings up the zones, and the second right click is held to span zones?

For my setup I configured fancyzones to trigger the overlay if I press a mouse button while dragging, so my process is generally:

  1. using left mouse, i grab a window and drag it to the "starting" area (without a visible overlay yet). I keep holding left mouse.
  2. i now hold right mouse, which triggers the overlay and also counts as holding control, so with both buttons held I drag my window over all the zones i want the window to be contained in.
  3. i release either mouse button and move on with life

It could certainly be rewritten to do it your way - can't promise anything (time is sparse) but I'll try to spin up a change for you tomorrow.

grandpixel commented 1 year ago

Gr

How can this work on second right-click, because the first right-click initiates the fancyzones layout. Like I left-click on a window title and drag, and then right click brings up the zones, and THEN I hold CTRL to span across zones. Can it be written so that the first right click brings up the zones, and the second right click is held to span zones?

For my setup I configured fancyzones to trigger the overlay if I press a mouse button while dragging, so my process is generally:

  1. using left mouse, i grab a window and drag it to the "starting" area (without a visible overlay yet). I keep holding left mouse.
  2. i now hold right mouse, which triggers the overlay and also counts as holding control, so with both buttons held I drag my window over all the zones i want the window to be contained in.
  3. i release either mouse button and move on with life

It could certainly be rewritten to do it your way - can't promise anything (time is sparse) but I'll try to spin up a change for you tomorrow.

Great, thanks! Actually I wonder if it would work well to be able to left click drag windows like normal, just to move them around. Then right click once to bring up the zone overlay. Then move mouse to starting point. Then right click again to toggle ctrl down. Then drag to span zones. Then either release left mouse to confirm selection, or right click again to release ctrl and try again. Does that make sense? I’ll play with it a bit myself as well. Thanks.

BasitAli commented 1 year ago

Gr

How can this work on second right-click, because the first right-click initiates the fancyzones layout. Like I left-click on a window title and drag, and then right click brings up the zones, and THEN I hold CTRL to span across zones. Can it be written so that the first right click brings up the zones, and the second right click is held to span zones?

For my setup I configured fancyzones to trigger the overlay if I press a mouse button while dragging, so my process is generally:

  1. using left mouse, i grab a window and drag it to the "starting" area (without a visible overlay yet). I keep holding left mouse.
  2. i now hold right mouse, which triggers the overlay and also counts as holding control, so with both buttons held I drag my window over all the zones i want the window to be contained in.
  3. i release either mouse button and move on with life

It could certainly be rewritten to do it your way - can't promise anything (time is sparse) but I'll try to spin up a change for you tomorrow.

Great, thanks! Actually I wonder if it would work well to be able to left click drag windows like normal, just to move them around. Then right click once to bring up the zone overlay. Then move mouse to starting point. Then right click again to toggle ctrl down. Then drag to span zones. Then either release left mouse to confirm selection, or right click again to release ctrl and try again. Does that make sense? I’ll play with it a bit myself as well. Thanks.

While this may introduce an additional right click for people not interested in spanning to multiple zones, I believe this is the simplest solution in terms of usage. Just got a wide screen monitor and have a pretty complicated Canvas setup with around 15 zones (this was before I figured out we could span multiple zones). While it works reasonably fine with often searching for the accurate activation zone for each overlapping region, a mouse only solution for spanning multiple zones would make our lives much easier.

BasitAli commented 1 year ago

Was playing around with the autohotkey script from @Frosthaven and though of utilizing the middleclick as an alternate to right click, but turns out PowerToys treats middle-click and right-click the same for the fancy zones use case.

Jay-o-Way commented 1 year ago

PowerToys treats middle-click and right-click the same for the fancy zones use case

Yes, all of those are non-primairy mouse buttons

BasitAli commented 1 year ago

I have a draft PR up with an interim / lazy attempt to separate middle and the rest of the non-primary buttons so that the middle button could be used as a toggle for spanning multiple zones. Working well so far for me.

crutkas commented 1 year ago

Fixed in 0.71 release of PowerToys. aka.ms/installpowertoys

mayureshs commented 1 year ago

Clint, can you please explain the steps involved to span a window across multiple fancy zones? I am not able to make it work with the middle click.Sent from my iPhoneOn Jul 14, 2023, at 12:48 PM, Clint Rutkas @.***> wrote: Fixed in 0.71 release of PowerToys. aka.ms/installpowertoys

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>

smikwily commented 1 year ago

At least for me, this is what I was able to do. Still playing with it. Hopefully I'm explaining it properly:

Whichever zone you are in when you middle click becomes the first selected zone.

mayureshs commented 1 year ago

Thanks for replying. I am not able to get the middle click to work with these settings for FancyZones. Let me know if anything needs to be changed.

[image: image.png]

Thank you Mayuresh

On Sat, Jul 15, 2023 at 7:55 AM smikwily @.***> wrote:

At least for me, this is what I was able to do. Still playing with it. Hopefully I'm explaining it properly:

  • In settings, under Zones, enable "Use a non-primary mouse button to toggle zone activation"
  • Left click on a window bar to grab it (per usual)
  • Right click to bring up zones
  • Middle click once to enable drag to span, middle click again to disable.

Whichever zone you are in when you middle click becomes the first selected zone.

— Reply to this email directly, view it on GitHub https://github.com/microsoft/PowerToys/issues/7925#issuecomment-1636758161, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHXXLRF4QYAW7XDOWX7LRDXQKHKNANCNFSM4TODN6EA . You are receiving this because you commented.Message ID: @.***>

smikwily commented 1 year ago

To verify - middle click itself doesn't do anything visibly. It just turns on the feature on or off. Make sure you've enabled the setting, left click and hold on a windows bar to select/hold it, right click to bring up the zones, then try to drag. It should only select a single zone or if you are between two zones, allow you to select both of them.

If you middle click once (to toggle the feature on or off) while still holding the left mouse button, now when you drag it should mark any zone you were in or cross over as selected. If it doesn't work, try middle clicking again to make sure it is toggled to on.

If it still isn't working and you have the setting enabled, I'm not sure what to tell you. Possibly try another mouse? Or check your mouse settings themselves outside of PowerToys?

alphanimal commented 1 year ago

It works! I'm happy that we finally have a solution to span multiple zones with just the mouse. However, I would like some more cusomization options. Some ideas:

For me personally, I have a 32:9 monitor and set FancyZones to use 10 columns. My windows will always span at least two of those zones. For example, I usually have 3 windows spanning 2+4+4, 3+4+3, 3+5+2 etc. So multi-zone mode by default would be the most useful for me.

mayureshs commented 1 year ago

onitor and set FancyZones to use 10

Can you please share your fancy zones settings. I am unable to get it to work with 3 zones across a 32:9 monitor.

zeel01 commented 1 year ago

It seems like this issue probably shouldn't be closed yet, as the existing solution doesn't fully address the initial request or, it would seem, the experience that many users were hoping for. (@crutkas?).

I too would love to see this functionality associated with a click+drag action holding the secondary mouse button. This is a very natural gesture, and I think it's the ideal way to utilize the zone spanning feature.

At the moment, one can either use both hands (to hold Ctr) or one can awkwardly click and hold the primary button to drag the window, followed by a single click of the secondary button, followed by a very awkward click of the middle button which is for most mice the scroll wheel. This is a pretty unnatural feeling set of motions. Also I suspect that few people use three finger on the mouse, so it also involves moving a finger between two button presses.

The ideal setup as described in the title of this issue allows for three very simple window movement gestures:

There's really only one additional ability needed beyond that to make single-hand mouse-only window positioning perfect:

Another option worth consideration:

Flip the script a bit, and rather than left click+drag first, then left click, why not just right click and drag from the start? In this case, the left (primary) mouse button would be used to engage zone spanning. Yes, this would mean that you couldn't cancel FancyZones, but I rarely have the need to do that. Something like hitting Esc while zone activation is up should be sufficient I think.

grandpixel commented 1 year ago

I'm really glad they implemented mouse-only zone spanning. Typically, when one has to operate the middle mouse button, it is with the same finger used on the left mouse button, but one cannot do that while holding down the LMB, so it's a bit awkard having to use your middle finger. It would be great if I could:

This would mean you cannot cancel FancyZones operation with right mouse button, because it would now toggle zone spanning. However, in the rare case that one needs to cancel, just hit the escape key.

If for whatever reason the decision is made not to implement this, at least consider making it a configuration option. Thanks so much!

alphanimal commented 1 year ago

I agree: It's great that mouse only multi-zone spanning is implemented now, but I think it needs some more customizatino options.

Right now you have to:

I think there are many ways to make this simpler.

In any case making this possible with just left+right click would be easier. Clicking the middle mouse button while holding another mouse button just feels awkward

Thanks!

bpsjsz commented 1 year ago

I think this feature needs to allow option to preview resizing of the window.

A great example of a program that already does this - and perhaps in a much simpler and more straightforward fashion - is WindowGrid. I had it configured for an 8x6 grid layout, and all I had to do to activate resizing a window (inherently including snap/resize to grid bit) was middle click and hold middle click to dragging, release middle click to apply. (Note: reason not using WindowGrid is because my organization's software governance committee has not approved WindowGrid but has approved and advises users to use PowerToys instead.)

EDIT: Disregard. Figured out the "preview" can be "enabled" by setting an opacity greater than 0%. However, it'd be nice if both activation of zone grid + spanning could be done with a single button rather than having to press two buttons.