RamonUnch / AltSnap

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

Option to trigger FancyZones layouts while dragging? #464

Closed Kev1000000 closed 7 months ago

Kev1000000 commented 1 year ago

One if the biggest issues with FancyZones is that you cannot trigger the zone layouts by moving the window anywhere. You are required to use the title bar and another button to move them.

I have AltSnap set up to move windows on middle click, and would love the option to initiate the FanzyZones layouts automatically by middle-clicking and dragging with AltSnap.

Is this possible?

RamonUnch commented 1 year ago

AltSnap cannot interact much with FancyZones, because FancyZones is not designed for it. However it handles its own zone system, you can check the wiki for more details. You can perfectly setup AltSnap to drag to zones that you can define yourself with Test windows, you can even have several snap layouts and switch between them using the tray icon. If you disable the Toggle Maximize state with Right click while moving, the Snapping state will be toggeled instead. To finely configure you will need to have a look intto the [Zones] section of the .ini file (Midle click the tray icon or select the Open .ini file in the tray menu).

I think FancyZones is redundant and can be disabled if you use AltSnap's zones.

Kev1000000 commented 1 year ago

Thanks! The big benefit of FancyZones is the nice overlay UI, and in general feels more polished when moving windows to different zones. But their activation method is severely lacking in comparison to AltSnap.

RamonUnch commented 1 year ago

So in case it is non trivial for you (or someone else reading), for your use case, I would suggest to: 1) Check the Snap to layout with Shift (configure with tray menu) option in the General tab. 2) Go to Advanced tab and disable the Toggle Maximize state with resize button while moving 3) Configure your snap layout, for this open a test window from the tray menu, then open as many test windows as you need with Ctrl+N from a test window, set them as you please and then hit the Save Test windows as snap layout option. You can setup like this up to 10 snap layouts (4 by default, must edit ini file for more).

One everything is setup, you can Move with middle click and then hit the right click while moving to toggle zone snapping mode. Also Shift will enable snapping mode so it is initially designed for Alt+Shift+drag.

Bonus: You can set UseZones=9 to have snapping to zones be the default when moving with AltSnap, you can always toggle with right-click or use Shift to temporarly disable zones snapping.

Thanks! The big benefit of FancyZones is the nice overlay UI, and in general feels more polished when moving windows to different zones. But their activation method is severely lacking in comparison to AltSnap.

I do agree that I will have to work on a snapping visualization at some point, snapping preview has been in my todo list for a while, but I end up always end up working on other things eventually.

Kev1000000 commented 1 year ago

Thank you so much for the detailed info, this is super helpful!

redactedscribe commented 1 year ago

I was about to open a new issue regarding exactly this feature.

AltSnap cannot interact much with FancyZones, because FancyZones is not designed for it.

Is it not possible for AltSnap to trick Windows into thinking a window is being dragged by the title bar when it is in fact being dragged by AltSnap?

I would prefer to use FancyZones for window layouts. Shift would also need to be passed through / not handled by AltSnap when Shiftkeys is set to nothing, and it might be good if Windows is only tricked into thinking a window is being dragged by its title bar whilst Shift is being held (to minimise unforeseen bugs).

My goal is this:

Aero=0
Shiftkeys=

Then hold WinKey and click and drag a window (from any position on its interface), hold Shift which would activate FancyZone's 'aero' grid, and then release the click to snap to it.

Is this possible @RamonUnch? It wouldn't need any direct interaction with FancyZones.

Thanks.

shodanx2 commented 9 months ago

I have a suggestion to trigger the fancyzone overlay.

While Alt-moving a window, user press a defined trigger in AltSnap. (in my case, that would be click mouse 4 while alt-leftclickdragging)

Make cursor invisible

Optional, display zone overlay

Move cursor to title bar area 

Display and move fake cursor, where the cursor used to be

Send FancyZone zone trigger, this can be holding down the shift key (default trigger), or pressing a non-primary mouse button (fancyzone non-default option)

When user release Alt-Snap defined trigger, release fancyzone trigger (release left mouse button then release shift)

Move real cursor to previous window-relative position

Make cursor visible again
RamonUnch commented 9 months ago

I thought aboout generating click events, but AltSnap is already generating enough junk key events that aready create a huge mess that is barely workable, adding even more would make it a lot more suceptible to bugs. Plus a lot of programs do not have workable titlebars outside of supetr thiny regions which would make it an option with a huge blacklist.

I will eventually display a snap layout preview like FancyZones does, and make FancyZone irrelevant to an AltSnap user (which it is already for me). There are no reasons to have two windows managers just for some minor extra features and it is much simpler to improve AltSnap to make FancyZone obsolete rather than to try crazy hacks to make them work together slightly better.

shodanx2 commented 9 months ago

I rather use AltSnap than FancyZone.

The MS powertoys are great but I rather have something without microsoft's name on it. Also I don't like that all these utilities are bundled together, it feels like a setup for a "take it or leave it" deal.

We know what kind of company microsoft is !

Here is a a template of what the overlay does, it's pretty simple.

image

Draw translucent bordered rectangles on each zone, zone identifier making in the middle, highlight the currently selected zone with a different colour.

FancyZones is leaving many features on the table too. Their github issues is a great source of suggestions too.

Putting apps back into their zone but with a blacklist (so that pulling tabs out of firefox at least open on the right monitor when you drop them)

Dynamic / procedurally generated zones on the fly

Save and restore app position this is also covered by winredock

More customizable zone activation logic (currently it's just shift or optionally any primary mouse button)

RamonUnch commented 9 months ago

See #511, Also it is better to create new Issues if you want have a specific feature. re-using this issue thread is not ideal for organisation.

redactedscribe commented 7 months ago

@RamonUnch Is it now possible to trigger FancyZones layouts while dragging in v1.63? Marking the issue as Completed rather than Not Planned seems to suggest this. I have not yet downloaded it.

RamonUnch commented 7 months ago

it is not planned indeed because you can enable the snap layout preview for AltSnap, so I do not intend to further investigate interacting with FancyZones.

shodanx2 commented 7 months ago

Once the user figures how the "test window" can be used to create the layouts. It's a simple matter of just spawn enough windows, snap them all into the existing fancyzone layouts and then save as an altsnap layout.