Opening a full screen application on a specific window

Running 19.04, with a triple monitor setup. I open games full screen on my centre monitor with Wine, simply by running wine game.exe. However, Wine recently updated, and now it's opening on my left-most monitor. How can I get it back to opening on my centre monitor?

I've tried using the --geometry option at the end of my Wine command, but it doesn't seem to make a difference. The software still opens in the same spot.

The centre monitor is also confirmed as the primary monitor.

Using Nvidia driver 430.26.


If I recall, X does not create separate screens for each monitor. Rather, it combines the monitors into one logical screen. Looking at nvidia-settings, I see X Screen 0 shown as 5040x1086. My three monitors are set to 1680x1050, 1920x1080, and 1440x900, from left to right.

I don't know if this is how X Server has always done it, but perhaps my issue could be solved if each monitor was its own separate screen. Is there a way to do that? Or is there a better/simpler solution to this problem?

I had asked a similar question almost a year ago, regarding how to open a terminal on a specific monitor. Unfortunately, the same method does not seem to apply to the situation here.


EDIT:

Information as shown by nvidia-settings indicates that X Screen 0, which contains my three monitors, has a display name of hiigaran:0.0.

As per earthmeLon's suggestion, I attempted to prepend SDL_VIDEO_FULLSCREEN_HEAD to the command I wished to use to start the application in question. The following three commands were used to test which monitor the application would open on:

SDL_VIDEO_FULLSCREEN_HEAD=0 wine game.exe
SDL_VIDEO_FULLSCREEN_HEAD=1 wine game.exe
SDL_VIDEO_FULLSCREEN_HEAD=2 wine game.exe

No difference was observed between using any of these commands, and using wine game.exe on its own. The application still opened full screen on the left-most monitor.

2 Answers

Typically, you use a single Screen, and all of your monitors belong to that one Screen, as you're seeing. By using multiple Screens, you can more accurately define where applications load, but you cannot move applications between different Screens.

If you were using multiple Screens, you would determine which Screen via the DISPLAY variable:

DISPLAY=:1 wine

To set which monitor is used for full screen applications, as well as to ensure that all monitors aren't used altogether for full screen applications, I've had the most luck setting the SDL_VIDEO_FULLSCREEN_HEAD environment variable so that this is available within the window manager. You set it to the number of your monitor, starting with zero:

export SDL_VIDEO_FULLSCREEN_HEAD=0

With three monitors, you can choose between 0, 1 and 2. You can set this in ~/.xinitrc / ~/.xsessionrc. Where you place this export is highly dependent on how your window manager starts up, using GDM, LightDM, or startx, etc.

You can test if this may work for you, or which monitor is which, by setting the variable at runtime:

$ SDL_VIDEO_FULLSCREEN_HEAD=1 wine

Note: OP mentions this testing does not work.


It may make sense to also set this as your default monitor, or ensure it is not your default monitor. The default monitor can be set with xrandr:

$ xrandr primary NAME_OF_DEVICE

Wine Virtual Desktop

If all of this fails, you have the final option of configuring Wine to use a virtual desktop. This will cause Wine to create a Windows window, and you are able to specify the resolution of this window (to match your monitor's resolution). Full screen Windows applications run via Wine will then fill that window only. You can use your Window Manager to move this to the correct desktop/monitor.

This can be done opening Wine Configuration (winecfg) and opening the Graphics tab, or by using the /desktop=name,1024x768 flag when running wine:

wine /desktop=name,1024x768 game.exe
5

So, it seems running Wine in a virtual desktop is the way to go. I had been avoiding doing this, because if I were to set the desktop to the resolution of the monitor I'd want to use it on, the virtual desktop's title bar, combined with Ubuntu's top/activity bar would cause a decent portion of the virtual desktop to be cut off at the bottom. Plus the dock would make things worse.

After fiddling around for a bit, the best solution I have come up with is as follows:

  1. Ensure hotkeys are set in gnome-control-center at Settings > Devices > Keyboard, for moving windows to a different monitor, and for entering full screen
  2. Start your desired program with Wine as per normal
  3. When the virtual desktop appears and takes focus, use your hotkeys to move the window to the desired monitor.
  4. Use your full screen hotkey to get the virtual desktop to use the entire monitor area

While it would have been ideal for software to open already full screen on the correct monitor, this has been a suitable solution for me, though technically, it's more of a workaround, than an actual solution.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like