mpv icon indicating copy to clipboard operation
mpv copied to clipboard

"--fs-screen=1" spawns mpv on primary monitor in windowed mode

Open guihkx opened this issue 7 years ago • 25 comments

mpv version and platform

mpv 0.25.0 (C) 2000-2017 mpv/MPlayer/mplayer2 projects
 built on Mon May  8 20:03:32 CEST 2017
ffmpeg library versions:
   libavutil       55.58.100
   libavcodec      57.89.100
   libavformat     57.71.100
   libswscale      4.6.100
   libavfilter     6.82.100
   libswresample   2.7.100
ffmpeg version: 3.3.1
Arch Linux 64-bit
Desktop Environment: XFCE 4.12
Window Manager: Xfwm4 4.12.4
Xorg: 1.19.3
NVIDIA 381.22 (proprietary drivers)
Primary monitor resolution: 1920x1080 (120Hz)
Secondary monitor resolution: 1360x768 (60Hz)
Linux version 4.9.28-1-lts (builduser@andyrtr) (gcc version 6.3.1 20170306 (GCC) ) #1 SMP Sun May 14 18:07:38 CEST 2017

Reproduction steps

Try to launch mpv on secondary monitor by running: mpv --player-operation-mode=pseudo-gui --fs-screen=1

Expected behavior

mpv spawns in full screen mode on secondary monitor.

Actual behavior

mpv spawns in windowed mode on primary monitor. However, if you run: mpv --player-operation-mode=pseudo-gui --screen=1, then mpv will actually spawn on secondary monitor, but in windowed mode. I've tried adding --fs but that makes mpv spawn on primary monitor again. If it's not obvious enough, yes I did try that with an actual video... Oh, I've also tried --fs-screen=2, but nada.

Log file

https://gist.githubusercontent.com/GUiHKX/b0e72186a260e0787e9f2d35f2d3faa3/raw/ded8291d340a9cfa4530b91db74dbfef7dc131f5/mpv.txt

guihkx avatar May 20 '17 22:05 guihkx

you are missing --fs in the command try: mpv --player-operation-mode=pseudo-gui --fs --fs-screen=1

alfrix avatar Jun 21 '17 02:06 alfrix

It didn't work for me as well... mpv gets spawned in full screen mode on primary monitor.

guihkx avatar Jun 21 '17 05:06 guihkx

Is this still a problem in mpv 0.28.0?

Traneptora avatar Jan 13 '18 17:01 Traneptora

Arch Linux is still on 0.27.0 so I haven't been able to test it yet, but as soon as they release a package for version 0.28.0, I'll definitely test it.

guihkx avatar Jan 13 '18 23:01 guihkx

You can also try building mpv from git master if you'd like to test it sooner.

Traneptora avatar Jan 14 '18 01:01 Traneptora

Okay, so I just tried the git version but mpv still spawns in full-screen on first monitor. :cry:

LOG.TXT

My monitor setup is still the same by the way:

screenshot_2018-01-14_00-34-45

The secondary screen is not 72" though, it's actually a 32" TV with a resolution of 1360x768. I also have mpv installed on Windows and doing mpv --player-operation-mode=pseudo-gui --fs --fs-screen=1, works as expected.

guihkx avatar Jan 14 '18 02:01 guihkx

If I try to run in windowed mode, like this: mpv --player-operation-mode=pseudo-gui --screen=1

mpv successfully spawns on the secondary monitor. And double-clicking the mpv window or pressing f makes it go full-screen, and pressing it again makes it go back to windowed mode (as expected). Here's the log file of me doing that:

LOG2.TXT

Let me know if you need anything else.

guihkx avatar Jan 14 '18 02:01 guihkx

I've recently switched from XFCE to KDE Plasma, but unfortunately I'm still getting the same behavior in mpv v0.28.0.

Since I also use mpv on this Windows partition I have in dual boot with Arch, I thought it could be useful to compare the output of both environments. The monitor setup is exactly the same, but on Windows, spawning mpv on secondary monitor in full screen actually works. On a side note, I find it odd that apparently I'm the only one experiencing this issue on Linux... (or am I?)

Here are the log files for $ mpv --no-config --player-operation-mode=pseudo-gui --fs --fs-screen=1:

guihkx avatar Jan 18 '18 14:01 guihkx

Oh my...

So I was trying different combinations of mpv switches on Linux, then I simply added --screen=1 to previous commands and it worked (on both v0.27.0 and v0.28.0, btw):

$ mpv --screen=1 --fs --fs-screen=1 video.mp4

So, apparently, if I only use --fs-screen=1 on Windows, it works since it automatically implies --screen=1 as well. I'm not sure if this is a bug or what, so I'll leave it up to you guys. :laughing:

Feel free to close this since it's been solved now.

guihkx avatar Jan 18 '18 15:01 guihkx

NB: The opener can close issues as well..

Hrxn avatar Jan 18 '18 16:01 Hrxn

I'm aware of that, I'm just not sure if this behavior should be fixed since the same command produces different results on both Windows and Linux.

guihkx avatar Jan 18 '18 16:01 guihkx

So, in summary: mpv --fs --fs-screen=1 spawns mpv in fullscreen on monitor 0. mpv --screen=1 --fs --fs-screen=1 spawns mpv in fullscreen on monitor 1. The above only occurs on your Arch Linux boot. On your Windows boot, --fs-screen=1 seems to imply --screen=1.

If what you're reporting is true, this is a bug. I have a second monitor that I can unearth to do some testing, seeing as I also have a dual boot Arch Linux / Windows computer.

Traneptora avatar Jan 18 '18 19:01 Traneptora

Does the WM support _NET_WM_FULLSCREEN_MONITORS? That's what mpv uses to set fs-screen. There are a ton of nasty details though. For example, mpv assumes the screen number goes by the Xinerama API, and nothing specifies what the _NET_WM hint uses. (At least from my hazy memory, didn't check again.)

ghost avatar Jan 18 '18 19:01 ghost

@thebombzen Yes, that's exactly it. I've just re-installed XFCE to try this again; and mpv behaves like it does on KDE, only spawning in full screen on secondary monitor when I use these three switches together: --screen=1 --fs --fs-screen=1.

@wm4 I just did a quick search on their code, so I'm pretty sure both xfwm4 (XFCE's wm) and KWin (KDE's wm) do support _NET_WM_FULLSCREEN_MONITORS. But I guess the issue right now is to find out why Windows only needs --fs --fs-screen=1 to spawn on secondary monitor, whilst Linux needs those two plus --screen=1.

guihkx avatar Jan 18 '18 20:01 guihkx

I can confirm direct to full screen on secondary display requires --screen=1 in addition to --fs-screen=1 on openbox.

kevmitch avatar Jan 19 '18 06:01 kevmitch

I'm not much of a C programmer myself but this fixed it for me:

diff --git a/video/out/x11_common.c b/video/out/x11_common.c
index 5f2c658a9c..498c2d95e8 100644
--- a/video/out/x11_common.c
+++ b/video/out/x11_common.c
@@ -1211,6 +1211,7 @@ static void vo_x11_sizehint(struct vo *vo, struct mp_rect rc, bool override_pos)
     bool force_pos = opts->geometry.xy_valid ||     // explicitly forced by user
                      opts->force_window_position || // resize -> reset position
                      opts->screen_id >= 0 ||        // force onto screen area
+                     opts->fsscreen_id >= 0 ||      // same as above 
                      x11->parent ||                 // force to fill parent
                      override_pos;                  // for fullscreen and such

guihkx avatar Jan 19 '18 08:01 guihkx

In theory that shouldn't be needed. It forces the position even in windowed mode, which might be rather unexpected.

ghost avatar Jan 19 '18 08:01 ghost

Care to give an example? Here are my tests:

  • mpv --player-operation-mode=pseudo-gui (spawns in windowed mode on screen 0)
  • mpv --player-operation-mode=pseudo-gui --screen=0 (spawns in windowed mode on screen 0)
  • mpv --player-operation-mode=pseudo-gui --screen=1 (spawns in windowed mode on screen 1)
  • mpv --player-operation-mode=pseudo-gui --fs --fs-screen=0 (spawns in full screen mode on screen 0)
  • mpv --player-operation-mode=pseudo-gui --fs --fs-screen=1 (spawns in full screen mode on screen 1)

Now I have the same behavior I get on Windows...

guihkx avatar Jan 19 '18 08:01 guihkx

I'm using GNOME 3.36.4 instead of XFCE now, and mpv --player-operation-mode=pseudo-gui --fs --fs-screen=1 actually places the mpv window on my secondary screen, which is great!

However, doing the same on KDE Plasma 5.19.2 didn't work.

guihkx avatar Jul 10 '20 10:07 guihkx

FYI, since you're using wayland using --screen will not work because the protocol doesn't support clients picking an output in a non-fullscreened state (that's why --fs-screen works). I did ask a while ago to add this to xdg-shell but none of the core wayland devs were particularly receptive so probably just don't expect that to happen.

If it doesn't work in Plasma's wayland session, it would be a compositor limitation. I would expect it to work in Xorg of course, but I've never actually tested it.

Dudemanguy avatar Jul 10 '20 13:07 Dudemanguy

Oops, I should've mentioned that I was on a Xorg session in both GNOME and Plasma... I'm using NVIDIA's proprietary driver, which was supposed to work on Wayland (in theory), but right now is behaving pretty badly.

guihkx avatar Jul 10 '20 19:07 guihkx

Huh well I guess Plasma xorg is worse than I thought.

Dudemanguy avatar Jul 10 '20 20:07 Dudemanguy

So this still a problem on windows then?

benyaminl avatar Dec 05 '21 09:12 benyaminl

mpv . --screen=0 --fs works for me

sohanglal avatar May 24 '22 05:05 sohanglal

mpv . --screen=0 --fs works for me

Seems I get it now, so when you are using laptop, whether you change your primary window, the first screen still will be the laptop, and it will still shown on screen 0, as mpv start from zero. Hmm... sad. but thanks

benyaminl avatar Sep 03 '22 09:09 benyaminl

mpv --fs --fs-screen=1 should work on X11 as of f7151932df4b239a8ee724117103cc15635987c5.

Dudemanguy avatar Oct 22 '23 15:10 Dudemanguy