stefansundin / altdrag

:file_folder: Easily drag windows when pressing the alt key. (Windows)
https://stefansundin.github.io/altdrag/
GNU General Public License v3.0
1.41k stars 94 forks source link

alt-drag stops working when displays change (Windows 10) #76

Open daveola opened 7 years ago

daveola commented 7 years ago

On Windows 10 if I plug in or remove displays, alt-drag no longer functions.

The tray icon becomes black (both the cursor and the arrows) and will not respond to right clicks.

Using taskmgr to kill the process and restart it is the only workaround I have found.

daveola commented 7 years ago

Version 1.1

heathkit commented 7 years ago

Also seeing this

sparebytes commented 7 years ago

This also happens if I change the DPI scaling on any of my monitors.

theperm commented 7 years ago

I think this is related, but when i resume my windows 10 laptop from sleep the same issue happens. Probably because screens begin to be re-initalised due to using a docking station or a deeper sleep mode.

Brog33 commented 7 years ago

Just to add: After I installed the Windows 10 Creator Update AltDrag keeps stopping after the PC has been idle for some hours. I suspect maybe some power managment stuff kicking in that affects it.

sethbc commented 7 years ago

duplicate of #34

tihz commented 6 years ago

As workaround I create a .cmd script to relaunch altdrag and modified startmenu shortcut to point it

Here you are the script :

taskkill /f /im AltDrag.exe
start "" C:\Users\Anthony\AppData\Roaming\AltDrag\AltDrag.exe
sparebytes commented 6 years ago

@Tihz, I did the same thing. I even used Windows Task Scheduler to run it every time I unlock my computer because I usually run into issues after waking my laptop up from sleep.

tihz commented 6 years ago

@sparebytes Very good idea ! Thanks for the tip :)

anodynos commented 6 years ago

@sparebytes I am trying to create a Task Scheduler on Windows 10, it gives me headaches.

It runs only the first part, killing the existing one, but it never starts the new one?

Any tips?

patricknelson commented 6 years ago

Yeah, I had a similar solution to this back in 2016 https://github.com/stefansundin/altdrag/issues/34#issuecomment-264279114. Seems @stefansundin hasn't touched this now in well over a year (soon to be 2 years). Even checking "Override high DPI scaling behavior" under compatibility tab (in the properties screen for Windows 10) doesn't have any effect.

An alternative fix would be to find a way to prevent Windows from unhelpfully temporarily scaling then un-scaling when you switch displays, open the laptop, wake from sleep (etc) simply because you prefer not to run at the native 4k resolution (e.g. I run my laptop screen at 1080p due to general scaling issues, but it can't help but scale itself to 4k, even temporarily, whenever you attach a new monitor)

Finomosec commented 5 years ago

On Windows 10 if I plug in or remove displays, alt-drag no longer functions. The tray icon becomes black (both the cursor and the arrows) and will not respond to right clicks. Using taskmgr to kill the process and restart it is the only workaround I have found.

Same thing here. Running on Windows 10 Pro (64bit). Version 1.1

@stefansundin are you still working on AltDrag? If you fix this i will donate something :-) I really like AltDrag <3

patricknelson commented 5 years ago

I'll chip in $20 (already donated one before but I can do it again). This is basically essential software for me these days.

ahernsean commented 5 years ago

I think many people run into the same limitation. I have a bat script that automates the kill and restart, using the taskkill and start commands.

-Sean

-- Sean Ahern Lead Software Developer / Nexus Product Manager CEI, Inc., an affiliate of ANSYS, Inc. sean.ahern@ansys.com +1-919-719-6568

On Wed, Dec 26, 2018 at 7:58 AM Finomosec notifications@github.com wrote:

On Windows 10 if I plug in or remove displays, alt-drag no longer functions. The tray icon becomes black (both the cursor and the arrows) and will not respond to right clicks. Using taskmgr to kill the process and restart it is the only workaround I have found.

Same thing here. Running on Windows 10 Pro (64bit). Version 1.1

@stefansundin https://github.com/stefansundin are you still working on AltDrag? If you fix this i will donate something :-) I really like AltDrag <3

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/stefansundin/altdrag/issues/76#issuecomment-449963336, or mute the thread https://github.com/notifications/unsubscribe-auth/ABkqlGY53_xLlvcZYyLdlWbWK-4kbi_Mks5u83KJgaJpZM4MLh7D .

daveola commented 5 years ago

I can't just do a simple bat script because I have to run altdrag with elevated permissions, so I'd need some sort of elevated kill/restart as well. I'd happily chip in $20 to get this fixed as well.

sparebytes commented 5 years ago

I found another solution. Now I just use a modified AutoHotKey script. It doesn't do everything AltDrag does and I have to start it myself every time I reboot but I haven't had any issues.

The original script is here and uses the left alt key: https://autohotkey.com/docs/scripts/EasyWindowDrag_(KDE).htm

My script is attached and uses the windows key. WindowDragging.ahk

edit: PS. I'm thankful to @stefansundin for making this and donated a long time ago even knowing the issues. It's probably not worth his time to work on this. Maybe we should buy him a 4k monitor to give him good reason to fix it 😆

edit 2: Fix dyslexia

daveola commented 5 years ago

@sparebytes Thank you, thank you, thank you.

It hadn't occurred to me to use AHK. Very nice.

MattSturgeon commented 4 years ago

It doesn't do everything AltDrag does and I have to start it myself every time I reboot but I haven't had any issues.

If you compile the script to a standalone exe it should be possible to copy it to your autostart folder here %appdata%\Microsoft\Windows\Start Menu\Programs\Startup

krizajb commented 4 years ago

Yes, I've tried many AHK scripts, none of them work as needed. Some don't even support dragging to another screen and bump into screen "border". Same goes for the one you posted, it resizes the window when switching the screen. Main screen (250%):

image

Dragging to extended screen (175%):

image

Chematronix commented 4 years ago

Alt-drag stops working sometimes for me, or worse, it leaves the modifier key pressed, wrecking chaos on my desktop (possible conflict with AHK?). Sparebytes' suggested script works a treat though, even dragging through extended desktops; even though it's 14 years old! BTW, you can place the .ahk in your Startup folder, or even better, a shortcut. No need to compile into an .exe.

jdnixx commented 4 years ago

Same problem here. I've had it for a long time actually. Black tray icon when I disconnect from my eGPU, and display scaling switches from 100% (on the external monitor) to 125% (on my laptop display).

I've used a .bat as others have suggested for a while now, but even that doesn't work to kill the dead altdrag process sometimes. The script is:

@echo off
start /b /wait taskkill /F /T /IM AltDrag.exe /FI "status eq running"
start "" "%appdata%\AltDrag\AltDrag.exe"

Maintaining altdrag & its quirks has taken up so much of my time & energy lately (& for quite a while honestly) that I've wondered if there's an AHK script that can really replace its functionality completely, as I've been tweaking the crap out of my PC setup with ahk to the point where it's more essential than even altdrag for me nowadays (although altdrag is still the very important yang to ahk's yin). I might try the one posted here but I wonder if there are better ones that aren't 14 years old.

EDIT: oh and as far as elevating the "restart_altdrag.bat" script with admin privileges, the solution for me was to make a shortcut to the .bat on my desktop, right click and Properties..., and in Advanced (I think under the Compatibility tab) check "always run as administrator". That way, running it from that shortcut instead of the actual .bat will always elevate it, and I also then bound the shortcut to Win+Z using AHK. So pretty much anywhere anytime I can "reset" altdrag completely by quickly mashing Win+Z, ALTHOUGH like I said sometimes it still fails to kill the dead process anyway, and in an unrelated error to altdrag itself, it seems DPI changes sometimes kill the AHK process as well, rendering my handy keyboard shortcut useless, until I manually reload my main system-wide AHK script 😡 No idea how Microsoft botched up things so badly with something as weird and innocuous as unplugging a display with higher dpi. But ugh what a mess.

Chematronix commented 4 years ago

I might try the one posted here but I wonder if there are better ones that aren't 14 years old.

Why not, you know, Just Do It©? Would take less time than typing that post!

My only grievance with EasyDrag is that it doesn't work reliably with the Windows key, but that's Windows (key, system and philosophy) for you. It works a treat with Alt though.

jdnixx commented 4 years ago

Why not, you know, Just Do It©? Would take less time than typing that post!

Lol i'm not nearly experienced enough at AHK scripting to undertake something like that. Much better at writing long diatribes than grokking all of AHK's crazy functions and syntax differences between versions

Chematronix commented 4 years ago

I meant why not try the script that has been working (mostly) flawlessly for 14 years:

  1. Download and install https://www.autohotkey.com/
  2. Download (save or rename to .ahk instead of .txt) and execute
    1. EasyDrag (Alt key): https://www.autohotkey.com/docs/scripts/EasyWindowDrag_(KDE).ahk (prevents using the mouse while doing Alt-Tab)
    2. EasyDrag (Win key): https://github.com/stefansundin/altdrag/files/2968332/WindowDragging.ahk (sometimes opens the Start Menu instead, at least on my system).
  3. Profit!
  4. If you like it and want it to start automatically, create a shortcut in your Start Menu\Programs\Startup folder (%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup)

That's it, no AHK hacking required. :)

Edit: Email replies break horribly here, fixing... and another minor gripe: you can't Alt-drag a maximised window. But you can double-Alt-RMB to restore, and immediately drag with LMB! (double-Alt-LMB minimises, double-Alt-MMB closes!)

patricknelson commented 4 years ago

Those scripts are pretty good; they do miss some features that AltDrag has, but the scripts provide a really great starting point. Would be great to see (from my perspective/usage), otherwise AltDrag is still more "profitable" (so to speak)

  1. Drag when full screen (e.g. "restore" window and, if moved to top slowly or if moved quickly, remaximizes)
  2. Double click to maximize
  3. Cursor changing to provide feedback that dragging/resizing has begun
  4. Drag to edge to fill half screen (emulating aero snap)
jdnixx commented 4 years ago

@Chematronix , you sparked my interest, on some quick googling I found the second script in this post (second to last reply) works extremely smoothly, way better than the KDE-style one you suggested; maybe by combining the two we could get a really workable script.

Still no snapping, which is a must for me at least... and stuff like mouse4 and mouse5 but I'm sure those could be added in pretty easily. Like @patricknelson said it's a good starting point

EDIT: also didn't realize stefan has a list of similar programs including like 5 AHK scripts right on his site: https://stefansundin.github.io/altdrag/doc/other-programs

Chematronix commented 4 years ago

maybe by combining the two we could get a really workable script.

Someone beat you to it: http://corz.org/windows/software/accessories/KDE-resizing-moving-for-Windows.php

jdnixx commented 4 years ago

maybe by combining the two we could get a really workable script. Someone beat you to it: http://corz.org/windows/software/accessories/KDE-resizing-moving-for-Windows.php

Oh interesting. Have you tried it, does it work the best out of all of them?

Chematronix commented 4 years ago

Oh interesting. Have you tried it, does it work the best out of all of them?

Yup. This one you can easily configure on its Systray menu, or its extensive ini file. Since keys are not hard-coded, it's the easiest to hack too. Comes with desktop edge snapping, double-modkey+click min-maximise, blacklist (only for exe name, so Alt+Tab still won't click --Win+Tab works fine though, since you can release the keys), and grid and colour sampler addons (disabled in ini by default). It's a keeper.

chrisdtaylor commented 4 years ago

I had been using a .bat script to restart alt-drag after resolution changes would cause it to stop functioning. This other script (corz.org) doesn't suffer from that issue and provides all the goodness I got out of alt-drag.

Thanks for finding and sharing that!

lpers commented 4 years ago

maybe by combining the two we could get a really workable script. Someone beat you to it: http://corz.org/windows/software/accessories/KDE-resizing-moving-for-Windows.php

The link seems to be dead unfortunately at the time of writing this comment, anyone able to upload this anywhere else?

EduardoSantanaSeverino commented 3 years ago

I personally only use the alt drag, I am not using any more features aside from alt drag.

So for me, the script illustrated by Chematronix worked like a charm.

I meant why not try the script that has been working (mostly) flawlessly for 14 years: 1. Download and install https://www.autohotkey.com/ 2. Download (save or rename to .ahk instead of .txt) and execute 1. EasyDrag (Alt key): https://www.autohotkey.com/docs/scripts/EasyWindowDrag_(KDE).ahk (prevents using the mouse while doing Alt-Tab) 2. EasyDrag (Win key): https://github.com/stefansundin/altdrag/files/2968332/WindowDragging.ahk (sometimes opens the Start Menu instead, at least on my system). 3. Profit! 4. If you like it and want it to start automatically, create a shortcut in your Start Menu\Programs\Startup folder (%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup) That's it, no AHK hacking required. :) Edit: Email replies break horribly here, fixing... and another minor gripe: you can't Alt-drag a maximised window. But you can double-Alt-RMB to restore, and immediately drag with LMB! (double-Alt-LMB minimises, double-Alt-MMB closes!)

RamonUnch commented 3 years ago

@EduardoSantanaSeverino I fixed this problem on my fork in v1.34. https://github.com/RamonUnch/AltDrag The problem was related to bad tray icon handeling, and this issue is the is the same than #107 and #34.

chrisdtaylor commented 3 years ago

@EduardoSantanaSeverino I fixed this problem on my fork in v1.34. https://github.com/RamonUnch/AltDrag The problem was related to bad tray icon handeling, and this issue is the is the same than #107 and #34.

@RamonUnch, can you provide instructions on how to build your fork?

chrisdtaylor commented 3 years ago

maybe by combining the two we could get a really workable script. Someone beat you to it: http://corz.org/windows/software/accessories/KDE-resizing-moving-for-Windows.php

The link seems to be dead unfortunately at the time of writing this comment, anyone able to upload this anywhere else?

The link is working great for me at this moment.

RamonUnch commented 3 years ago

@chrisdtaylor

can you provide instructions on how to build your fork?

I make the releases builds using mingw64-32b. Just install it and run mk.bat Builds are available at https://github.com/RamonUnch/AltDrag/releases Please sibmit any issue over there... at https://github.com/RamonUnch/AltDrag/issues