Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alt+Drag or Windows+Drag to move windows #269

Open
mattroyal opened this issue Sep 6, 2019 · 95 comments
Open

Alt+Drag or Windows+Drag to move windows #269

mattroyal opened this issue Sep 6, 2019 · 95 comments
Labels
Help Wanted We encourage anyone to jump in on these and submit a PR. Idea-New PowerToy Suggestion for a PowerToy Product-Window Manager Refers to the idea of a Window Manager PowerToy
Milestone

Comments

@mattroyal
Copy link

Summary of the new feature/enhancement

Moving windows using the mouse relies on hitting a small target, especially on high-resolution screens. Add an option to move entire windows by alt-dragging or windows-dragging them, anywhere on the window except perhaps the resize area.

Proposed technical implementation details

Stefan Sundin has done great work on AltDrag: https://stefansundin.github.io/altdrag/ . With permission, I'd use this as an initial reference.

Alt+Drag or Windows+Drag could be implemented as part of FancyZones, activated with a toggle.

@enricogior enricogior added the Idea-New PowerToy Suggestion for a PowerToy label Sep 6, 2019
@loligans
Copy link

loligans commented Sep 9, 2019

Alt+Drag would be nice, but also Alt+Resize would be just as helpful. Especially if the window snaps to borders.

@dnunes
Copy link

dnunes commented Sep 9, 2019

Alt+Drag and Alt+Resize with snapping is my dream for windows management on Windows system.
Unfortunetely AltDrag (app) doesn't play along with my current AutoHotKey "Keyboard Second Layer" (uses LAlt), as it eventually start acting up and I have to close and reopen it. Having this funcionality in PowerToys would be wonderful.

@stefansundin
Copy link

Thanks for suggesting this @mattroyal. I am ok with AltDrag being used as a reference.

Maybe when it is done and AltDrag becomes somewhat obsolete, then maybe Microsoft can send me a donation. Or at least buy me lunch (I live in Seattle now). 😉

@enricogior
Copy link
Contributor

@stefansundin
if you are interested, you may consider adding your awesome tool as a PowerToys module.

@enricogior
Copy link
Contributor

@stefansundin
also, consider that it will be possible to put a link to your web page in the powertoys settings with a text like "Donate to author", so users that want to donate for your work will know how to do it.

@loligans
Copy link

I’ve decided to take a stab at this PowerToy.

@enricogior
Copy link
Contributor

Hi @loligans
great to hear!
It would be nice to make the 'Alt' key configurable since in some apps 'Alt drag' is actually used for other purposes. You can take a look at the FancyZones code for an example of how to make a key configurable through the settings.
If you have any question don't hesitate to ask.

@loligans
Copy link

Yeah I've been utilizing the fancyzones project as a frame of reference. They share very similar functionality, so it's made it easier to get started. It's open for discussion, but for an initial version here are the settings that can be modified.

enum class Action
{
    /* No action will be performed. */
    Nothing,
    /* Move a window. */
    Move,
    /* Resizes a window. */
    Resize,
    /* Minimize a window. */
    Minimize,
    /* Lower the window. */
    Lower,
    /* Make a window topmost. */
    AlwaysOnTop,
    /* Center a window on the screen. */
    Center,
    /* Close a window. */
    Close
};

/*Whether the window should be focused while dragging*/
bool focusWindowWhenDragging = false;
/*Middle clicking the title bar sends it to the back*/
bool lowerWindowByMiddleClickingTitleBar = false;
/*Snap to monitor borders*/
bool snapToScreenBorders = false;
/*Snap to borders of other windows*/
bool snapToOutsideOtherWindows = false;
/*Left mouse button action*/
Action leftMouseButton = Action::Nothing;
/*Middle mouse button action*/
Action middleMouseButton = Action::Nothing;
/*Right mouse button action*/
Action rightMouseButton = Action::Nothing;

/*Hotkey to activate the module. Defaults to ALT*/
PowerToysSettings::HotkeyObject activationHotkey = PowerToysSettings::HotkeyObject::from_settings(false, false, true, false, VK_MENU, L"");

@enricogior
Copy link
Contributor

Hi @loligans
I should let you know that we have already plans for a "Always on top" module with a specific UI in mind.
My suggestion is that you start with implementing just the Alt-drag functionality and then we can chat about adding more functionalities.
Sounds like a plan?
Thanks you.

@loligans
Copy link

Yeah that's fine. @enricogior

Is there a way I can reference the branch I'm working on in this github issue? That way I can get feedback from the other engineers on this feature.

@enricogior
Copy link
Contributor

Hi @loligans
fork this repo, create a working branch on the forked repo and post here the link to that branch.

@loligans
Copy link

Here is the working branch from the forked repo: https://github.com/loligans/PowerToys/tree/dev/loligans/altdrag

@loligans
Copy link

Just wanted to document this here:

I added a low level mouse hook since I'll need to process mouse position while the module activationHotkey is pressed. According to the LowLevelMouseProc documentation if the hook procedure takes longer than the LowLevelHooksTimeout timespan defined in HKEY_CURRENT_USER\Control Panel\Desktop the hook procedure will timeout and be silently removed without being called.

The implementation is nearly identical to the keyboard hook we have set up already.

Because the mouse will be sending in a flood of events compared to the keyboard, we'll likely want to minimize the amount of processing done on the hook. For now I'm gonna do everything on the hook and measure if we are well below the LowLevelHooksTimeout threshold.

If we're reaching close to the LowLevelHooksTimeout threshold then we may want to only process as much as necessary on the hook and then before returning trigger an event on a worker thread.

Thoughts? @enricogior

@enricogior
Copy link
Contributor

enricogior commented Nov 1, 2019

Hi @loligans
excellent point. We also need the low level mouse hook for other PowerToys, so I opened a dedicated issue to track the technical details of its implementation #638
Feel free to add your considerations there.
For now I suggest you continue on the assumption that there will be a mouse hook that will guarantee to not exceed LowLevelHooksTimeout.

@crutkas crutkas changed the title Suggested PowerToy: Alt+Drag or Windows+Drag to move windows Alt+Drag or Windows+Drag to move windows Dec 19, 2019
@crutkas
Copy link
Member

crutkas commented Dec 19, 2019

while this could be associated with FancyZones, i think they are distinct different asks. I think we should track work that spans both and understand it may be the same/shared engine under the hood but i don't think we should merge the two as a holistic entity.

@theS1LV3R
Copy link

Status on this?

@crutkas crutkas added the Help Wanted We encourage anyone to jump in on these and submit a PR. label Feb 6, 2020
@crutkas
Copy link
Member

crutkas commented Feb 6, 2020

This is not something we are currently planning for a v1. Great idea and if a community member wants to partner with us, happy to merge it in sooner. It is a great idea

@loligans
Copy link

@ent3r This issue is currently blocked on #638.

@dragove
Copy link

dragove commented Jan 10, 2024

For anyone interested there is also an AutoHotkey script called 'Easy Window Dragging (KDE style)' for this.

https://www.autohotkey.com/docs/v2/scripts/index.htm#EasyWindowDrag_(KDE)

I've tested this script, if anyone has mutiple monitors with different resolution/scale configuration, it's buggy.

Although altsnap has some bugs. But it performance much better than ahk on my machine. I recommend just using altsnap.

@verbal007
Copy link

Curious how these compare to KDE Mover-Sizer
https://corz.org/windows/software/accessories/KDE-resizing-moving-for-Windows.php

Been using it for over a year now and feels like the behavior I'm getting on Linux, and is important that it allows me to use the Windows key instead of Alt (which would kill me due to use in 3D applications)

@dragove
Copy link

dragove commented Jan 12, 2024

Curious how these compare to KDE Mover-Sizer https://corz.org/windows/software/accessories/KDE-resizing-moving-for-Windows.php

Been using it for over a year now and feels like the behavior I'm getting on Linux, and is important that it allows me to use the Windows key instead of Alt (which would kill me due to use in 3D applications)

Wow, this one is great, it has less bug than altsnap. (For me, there is a bug when using windows key on Emacs. When Emacs is focused, I can't move Emacs window with windows key. This bug also arises on altsnap)

altsnap has a bug when I move window from one monitor to another. Some window will be extremely large when crossing monitors (compared to drag title bar)

KDE Mover-Sizer lacks some functionally that altsnap provided e.g. double click to maximize window, drag to top to maximize (Aero snap)

Also, altsnap support left windows key to drag/resize.

@verbal007
Copy link

KDE Mover-Sizer lacks some functionally that altsnap provided e.g. double click to maximize window, drag to top to maximize (Aero snap)

Also, altsnap support left windows key to drag/resize.

The drag to top to maximize would be nice, but it does have the ability to maximize / restore via hotkey + MMB.

Good to know that altsnap has the ability to use the Windows key instead of Alt. Will keep it on the list, in case KDE Mover-Sizer starts acting funny.

@HeiniK
Copy link

HeiniK commented Jan 14, 2024

Is someone here among the developers who can push this topic at Microsoft? To me it seems even better if this functionality would be implemented directly into the OS. After all, the OS is called 'Windows'. So managing windows efficiently should be a core functionality.

@alvesvaren
Copy link

I didn't find anything I liked, so me and a friend created an AHK Script that does this. It also changes the cursor to make it easier to understand what's happening (like in kde).

It is by far the least janky one I've found, and it supports multiple monitors, resizing, moving, maximizing/restoring, minimizing, transparency (like in kde with scroll wheel), fullscreen applications (not all though). I also had issues with some scripts due to me having hover-focus enabled in windows, but this script works fine with that too.

You can check it out here if you want: https://github.com/IsacEkeroth/ahk-resize-windows

@zoo-3d
Copy link

zoo-3d commented Feb 21, 2024

I created a wpf application that can move window in window anywhere by alt + left mouse drag and resize window in window by alt + right mouse drag

You can check it out here if you want: https://github.com/zoo-3d/D-R/blob/main/README.en.md

@KoleckOLP
Copy link

Oh wow so you put a close source app on github...
People in this thread are not looking for an app that can do Alt/Win Drag, (people would just use AltSnap on Windows, not your close source nonsense)
What we want here is for this to be a part of powertoys.

@txj-xyz
Copy link

txj-xyz commented Feb 22, 2024 via email

@0xSegmented
Copy link

Really hoping this is coming soon!

@6a6f6a6f
Copy link

👀 we are still here. I'm using https://github.com/stefansundin/altdrag since I started using Windows, but I really miss a similar feature in PowerToys.

@geoffm
Copy link

geoffm commented Jun 28, 2024

+1
I'm glad I learned about AltSnap here, been using AltDrag but it WAS so buggy!!
And win-x-move fails when moving windows between monitors

It would totally make sense to have this feature supplied by PowerToys though!

@0xSegmented
Copy link

Altsnap is flagged byAV tho

@jagonbar
Copy link

jagonbar commented Jul 9, 2024

would be great if powertoys implement this altdrag functions:
volume control with win key + mouse wheel
why? is faster than go to volume tray icon or press some volume key in custom keyboard. The wheel is more intuitive for volume control

send back window to back
why? is faster than go to taskbar and search the window that I want. Simply I press Win Key + mouse clic to lower a window and find the one I want.

@luisfos
Copy link

luisfos commented Jul 29, 2024

this is the feature I'm missing the most from PowerToys.

  • WinKey + LMB for moving windows
  • WinKey + MMB for resizing windows (from nearest corner)

exactly as possible in most linux desktop environments

is status on this still help wanted ?

@buadamlaz
Copy link

It's been a long time since this topic was opened. Many users want this feature. Why doesn't anyone hear our voice?

@lordgreg
Copy link

I would love to see this feature.

@bonstio
Copy link

bonstio commented Nov 4, 2024

I need this in my life.

@alvesvaren
Copy link

I didn't find anything I liked, so me and a friend created an AHK Script that does this. It also changes the cursor to make it easier to understand what's happening (like in kde).

It is by far the least janky one I've found, and it supports multiple monitors, resizing, moving, maximizing/restoring, minimizing, transparency (like in kde with scroll wheel), fullscreen applications (not all though). I also had issues with some scripts due to me having hover-focus enabled in windows, but this script works fine with that too.

You can check it out here if you want: https://github.com/IsacEkeroth/ahk-resize-windows

I had some issues with AHK being blocked in some game anti cheats and felt that it was a bit slow, so I rewrote it in C++ and made it a bit easier to get it up and running: https://github.com/alvesvaren/resizer2, just if anyone still wants a workaround. It's a bit less customizable right now though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Help Wanted We encourage anyone to jump in on these and submit a PR. Idea-New PowerToy Suggestion for a PowerToy Product-Window Manager Refers to the idea of a Window Manager PowerToy
Projects
Status: ⚠️Needs Walkthrough
Development

No branches or pull requests