microsoft / PowerToys

Windows system utilities to maximize productivity
MIT License
110.73k stars 6.52k forks source link

Move Hidden Windows to active screen #557

Open MikeWilliams-UK opened 4 years ago

MikeWilliams-UK commented 4 years ago

Move Hidden Windows to active screen

Some applications do not play nicely with multiple monitor scenarios. They mainly the ones which remember their screen position.

Scenario Laptop with additional monitor.

Start an affected application when you have two monitors connected and move it to monitor two, shut PC down.

Disconnect the second monitor, then start up PC and run the affected application.

All you see is a task bar icon becuse the application has blisfully unaware thet the second monitor is not preset jumped to the monitor which does not now exist.

I know there is a documented way to move such windows to an available screen, but it requires quite a bit of faffing arround. I invariably end up googling for the required key chord each time I need it becuase it does not happed that often, but often enough to cause irritation.

A hook that allowed the user to right click the task bar icon and "move to screen n" would be very much appreciated.

Some of the code in https://github.com/MikeWilliams-UK/SSMS-Window-Fixer may be of use in this.

crutkas commented 4 years ago

Hi @MikeWilliams-UK , can you give an (or few) examples of applications with steps to recreate this?

Great idea, just want to be sure we fully understand the scenario.

MikeWilliams-UK commented 4 years ago

Sure will do. I will try to compile a list of apps which do it.

MikeWilliams-UK commented 4 years ago

Would you believe it, I am having trouble finding apps which now do this. The one I remember which gave me most grief was Notepad++, but just done a test and that now handles this properly. WinZip used to suffer too, but that was some time ago so might not be applicable now.

enricogior commented 4 years ago

@MikeWilliams-UK there are other cases/scenarios that trigger this problem, I remember it happened to me without an external monitor, just closing an app when it was half way out of the screen on the left, when I reopened it, its size was smaller and it wasn't visible on the screen. It's also annoying when you have the second monitor connected but turned off, Windows still sees it so if you closed the app then it was on the second monitor it will reopen there and it's annoying to have to turn the monitor on to move the window.

MikeWilliams-UK commented 4 years ago

@enricogior The more scenarios we can suggest the better chance of this being implimented.

crutkas commented 4 years ago

not saying this isn't useful or this scenario doesn't happen. But lets be sure we can test against known scenarios so lets create a few repro steps here so we know what we are targetting and can validate something works

MikeWilliams-UK commented 4 years ago

As a developer I appreciate that a scenario to test is vital.

I will see what I can find ...

MikeWilliams-UK commented 4 years ago

I thought that Notepad++ and Winzip exhibitd this behaviour, but sadly not. I have found the FileZilla 3.45.1 exhibits almost the same, with most of the window off screen. Not 100% off screen which was my original gripe with the 3rd party software, but it shows it as best I can find at the moment.

I will of course update this issue when I find others.

/Mike

crutkas commented 4 years ago

Possible to get a screenshot?

MikeWilliams-UK commented 4 years ago

Just captured a screen shot

  1. Open FileZilla on monitor 2
  2. Shutdown Laptop
  3. Disconnect monitor 2
  4. Start Laptop
  5. Open FileZilla

See screen shot below FileZilla Partially Off Screen

MikeWilliams-UK commented 4 years ago

I have been doing some more testing and I can now confirm that with the auxiliary monitor on the LEFT side of the laptop screen the behaviour is seen with WinZip (20.5)

I suspect that there are more applications which exhibit this behaviour due to the auxiliary screen having NEGATIVE co-ordinates.

  1. Ensure auxiliary monitor is on LEFT of primary monitor
  2. Open WinZip and move to auxiliary monitor, close WinZip
  3. Shutdown Laptop
  4. Disconnect auxiliary monitor
  5. Start Laptop
  6. Open WinZip

Winzip Left Monitor

enricogior commented 4 years ago

I've also noticed that when turning off a monitor connected via DisplayPort, the monitor disappear from the Window Display setting, but if the monitor is connected via HDMI, turning it off doesn't make it disappear, and so applications that open where they were closed, they end up on the turned off monitor.

MikeWilliams-UK commented 4 years ago

@enricogior I have seen that too as I have my laptop set up in my office connected to second monitor via HDMI. If I forget (or don't bother) to turn it on it does indead become a ghost monitor. In my case as I have windows task bar set up to "show taskbar buttons on" to "Taskbar where the window is open" I have to either turn the monitor on or unplug the cable. In this case my suggested tool would not help as there is no icon to right click on.

image

crutkas commented 4 years ago

hmmm, since this is on app launch after the state change, this would make us have to monitor all windows. Detect launch and do the resize. Part of me wonders however how to deal with apps w/ splash screens.

just detecting "useable" screen state isn't a good state by itself since i know i've hidden windows like that on purpose.

MikeWilliams-UK commented 4 years ago

I was thinking of it NOT being automatic for just such reasons. In Chem4Word we deliberately send windows off-screen(s) while they are composing.

I was thinking of it hooking into the right click action of a taskbar icon.

enricogior commented 4 years ago

I agree, this should not be automatic.

MikeWilliams-UK commented 4 years ago

IMHO Not being automatic should simplify the code.

enricogior commented 3 years ago

Manual workaround from Raymond Chen https://devblogs.microsoft.com/oldnewthing/20090511-00/?p=18303

MikeWilliams-UK commented 3 years ago

Sadly this does not work all of the time.

Jay-o-Way commented 2 years ago

Is this issue still relevant? Anything PowerToys can do about?

crutkas commented 2 years ago

I think this is a great issue but need clear repro steps. Win11 I know for some scenarios made things better in terms of dock / undock

SamHasler commented 2 years ago

A couple of apps that might help people out:

And to reiterate the workaround from Raymond Chen linked to above:

  1. Switch to the application by using Alt+Tab / Win+Tab or the taskbar
  2. Press Ctrl+Space to activate the window menu. (The one in the top left with Maximize/Restore, Move, Resize etc.) You should be able to see the menu in the top left of your screen at this point
  3. Press M to activate the _M_ove entry in the menu, (or whatever letter is underlined in your language) you should be able to see the menu but you can Google for images of it in your language.) Alternatively press Down Arrow, Down Arrow to navidage to the move option in the menu and Enter to activate it.
  4. Press any of the Arrow keys: Left Arrow / Right Arrow / Up Arrow / Down Arrow This step is important, it puts the window into a moving mode and allows the next step to work.
  5. Move the mouse and the window should automatically snap to the mouse position.
MikeWilliams-UK commented 2 years ago

@SamHasler I know that the workaround exists, but I personally don't use it enough for it to be in my "muscle memory" of actions that I always end up googling for it each time :-)

Of the two apps the CLI tools looks most powerfull but requires too much detail for the average user The GUI tool by NirSoft seems to lack the ability to position a window to a specific position on a screen which would be most usefull.

MikeWilliams-UK commented 2 years ago

I think this is a great issue but need clear repro steps. Win11 I know for some scenarios made things better in terms of dock / undock

What was wrong with my steps outlined in https://github.com/microsoft/PowerToys/issues/557#issuecomment-552097202?

SamHasler commented 2 years ago

@MikeWilliams-UK

NirSoft have another tool that can move (center) windows on a single monitor.

  1. Download the WinLister application here.
  2. Run WinLister as Administrator and select the window you wish to move back on Screen. Not running as administrator will not give the application the ability to move the windows for you.
  3. Right click and select “Center Selected Windows” and you’re done!

(credit to this superuser.com answer)

MikeWilliams-UK commented 2 years ago

@MikeWilliams-UK

NirSoft have another tool that can move (center) windows on a single monitor.

1. Download the WinLister application [here](http://www.nirsoft.net/utils/winlister.html).

2. Run WinLister as Administrator and select the window you wish to move back on Screen. Not running as administrator will not give the application the ability to move the windows for you.

3. Right click and select “Center Selected Windows” and you’re done!

(credit to this superuser.com answer)

Interesting utility, thanks for pointing it out. Shame it only centres on primary screen ... Not sure why it would need admin rights for processes that are not elevated? Just tested it non elevated to try to move it's own window and it crashed !

SamHasler commented 2 years ago

One of the comments on the answer points out that there's also WinExplorer which doesn't need admin rights. There's also GUIPropView

Jay-o-Way commented 2 years ago

@MikeWilliams-UK what's the status for your issue?

MikeWilliams-UK commented 2 years ago

This is a nice to have.

soerennielsen commented 1 year ago

This is still a problem and has been ever since we started to use multiple monitors and laptops.

The https://github.com/microsoft/PowerToys/issues/557#issuecomment-552097202 is very much on point. Sleep / Hibernate while on multiscreen and open in another config you often have the problem.

The WinExplorer, GUIPropView does not solve it at all. WinLister does solve it but it cumbersome.

On windows pre-11, you can alt+space, select move, press an arrow key and then position the window visible by mouse. On Windows 11, alt+space is now a global search, so instead you have to (one option) to shift+right click a window at the task bar , to get to the window menu, and then again -> move, arrow, mouse will do the trick.

The thing is that it is not impossible to do but feels decidedly dirty to do, and 90% of users out there has no clue.

I really feel that this issue should be fixed by the windows manager team (whatever they are called) at microsoft. They haven't fixed the issue in about 2 decades, so they are likely not about to. For me the great fix would be:

For power tools: 1) Would it be possible to hook into window activation? If not, 2) add a windows menu to restore on visible screen? Or 3) a global hotkey to place all windows on visible screen (filtering only the windows/programs on the start bar as there can be other hidden windows meant to be hidden), or 4) whenever windows config change, reposition those hidden windows on main screen?

mlamoore commented 11 months ago

I also have this problem on a regular basis.

I have a laptop with three external monitors connected through a Thunderbolt/USB-C dock. On a semi-regular basis, I either lock the computer or put it to sleep or close the screen then unplug it from the dock and take it to a different room.

When this issue happens, when I wake up/log in to the laptop without external screens connected, many/most of my applications still have their windows offscreen. Although it's possible to move the windows onscreen one at a time, it's very frustrating while multitasking.

I would not want any automatic functionality here; I just want a program/shortcut that I can run to move any offscreen windows onscreen. (I found this issue while searching for a program with that functionality.)

The most recent time it happened, I documented it:

Laptop was back and forth between asleep and awake, docked and not docked Put laptop to sleep while docked and windows open on docked screens Unplugged cables, brought laptop to lab, woke up and logged in Of the first several programs I tried, only Firefox opened onscreen, all others had to be manually moved through shift-right click menu plus additional steps; later I tried every program and had mixed results Was it caused by first going to sleep, then unplugging dock, then waking up?

Applications that were still located offscreen and difficult to access: Notepad++ (especially annoying if search window is open) Microsoft Word GNU Octave Windows Explorer Zoom Cisco Jabber Media Player (built in Windows 11 one) SourceGear Vault Microsoft Paint

Applications that correctly located themselves (were they already on the laptop screen?): HCL Notes (definitely on laptop screen already) Mozilla Firefox (this definitely had at least one window through the dock) Microsoft Excel Sourcetree STM32CubeIDE LTSpice

accLarson commented 9 months ago

Would love a simple "Center on screen" in the right click menu of each program open on the taskbar.

aschendel commented 1 week ago

My irritation is with multiple multi-monitor setups and a fairly modern laptop (USB-C for power + display(s)), Win 11. I've searched a little but to no avail... and eventually ended up here.

  1. My in-office desk has 3 external monitors arranged in Settings w/ Primary as desired.
  2. Home setup has a single wide-screen external monitor arranged in Settings w/ Primary as desired.
  3. I almost always unplug the USB-C before shutting the lid, so everything probably moves to laptop screen, which is only Primary in this undocked use-case.

When I move between these desks I often have to move many open windows from a non-primary screen to the now-primary screen.

I would LOVE a simple key command or menu-driven option to move all windows to the primary monitor. I'm not too worried about minimized or not, which ones are in which locations or on which of the various non-primary monitors.