How do you control what monitor your application opens on?
Asked Answered
I

5

25

As a two-monitor user at work, I've noticed that applications behave differently with regards to what monitor they open on (primary or secondary monitor, the last monitor the application opened on, and so on). To be honest, some applications annoy me because I want them to open on my primary monitor and I'll move them to my secondary if I want them there. However, these applications are done and out of my control, so I want to ask about my own applications that might be run by people using two monitors.

What kinds of controls are available to either allow people to specify which monitor your application opens on, allow an application to "remember" the monitor it was on when it was closed and reopen there, and to force the application to start on a specific monitor?

I'm looking for solutions across all operating systems and programming languages, although I'm guessing that different OSes and languages will have different controls.

Related Questions

  • What determines the monitor my app runs on? This question discusses existing applications and how they decide what monitor to run on. The currently accepted answer provides Windows functions that can be used to control the positioning of an app on start-up.
  • Start program on second monitor? provides some Delphi solutions for forcing an application to start on a particular monitor.
Ilke answered 16/10, 2008 at 12:5 Comment(1)
I identified two similar questions that are Windows oriented. However, I'm interested in general usability concepts as to how to determine where to start the application and cross-platform (or any non-Windows) solutions to the problem.Ilke
E
10

As a windows programmer I control the starting monitor of windows created by my apps by a. storing my apps last position in the registry and restoring that, and b. lacking stored info, setting the starting position to magic flag values that windows uses to position the app using its default logic. The default logic changes from OS to OS as MS improve the user experience, but tend to ensure that the app will open on whatever monitor the user is most likely to be looking at.

As a user with a multi-monitor Windows XP / Vista system I'd use the nVidia desktop manager that has the ability to set starting positions for applications otherwise don't have appropriate behaviour.

Ernaernald answered 16/10, 2008 at 12:25 Comment(3)
I saw comments in the other questions about the registry. It appears that is a common place, but I'm not sure if the registry is appropriate for that. But it does seem to be common practice, so it is something to consider.Ilke
The registry, or a .ini or .config type file.Ernaernald
I was having a similar issue with RSA SecureID on Windows 7. When I changed my monitor configuration, the app would open on a non-existent monitor until I cleared the xpos and ypos settings in hkcu\software\rsa\software token\desktop. Thanks for the tip.Tedie
T
2

From traditional Unix and Linux window manager perspective, you don't control. The window manager handles the positioning of the window.

You may be able to give hints to the window manager, but it should be possible to configure window manager to ignore such things. Moving or placing the window from the program can easily cause pain when a big virtual desktop is in use.

See: http://standards.freedesktop.org/wm-spec/wm-spec-latest.html

Tereasaterebene answered 24/10, 2008 at 16:10 Comment(1)
There's no way to tell or suggest to the window manager where or how to open your application? I've never done GUI programming on Unix or Linux before.Ilke
S
2

One thing to consider is that the monitor configuration might have changed inbetween invocations of the application (e.g., running on a laptop that at times might be docked and uses an external monitor). Make sure that your application is placed in the visible range.

As for APIs, there is the System.Windows.Forms.Screen class that gives you some of that information.

Suberin answered 3/11, 2008 at 15:1 Comment(0)
H
0

In KDE 4.13.3 (mayby in some olders and newers you can do this (translation may be inacurrate - I use polish version):

  1. run the desired program
  2. right-click on its title bar
  3. choose "more actions"->"additional window settings..." (even more options are under "additional program settings...")
  4. go to tab "size&layout"
  5. Mark checkbox "Screen" and choose "Force" and choose the screen number. Window of this program will be opened always on that screen.
Hysterogenic answered 2/6, 2015 at 17:14 Comment(0)
R
-1

Had a similar problem. Found the following:

Right Klick on the window titlebar and select "More Actions"->"Window Manager Settings". There choose "Focus" in the column to the left. Toggle option "Active screen follows mouse".

If no other defaults are specified, windows appear on the currently active screen. With the procedure described above, mouse position defines this active screen.

Hope that helps,

Best, Bb

Riposte answered 25/4, 2014 at 16:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.