This carries on from the discussion in comment https://github.com/mpv-player/mpv/issues/2301#issuecomment-264682262 and downwards.
Currently, mpv doesn't have any runtime property change observers for the geometry and autofit properties. They are read once at startup and applied, and after that they're immutable (changing them doesn't cause the GUI to react).
I would like to propose that the following properties get runtime property change observers in every GUI:
autofit
autofit-larger
autofit-smaller
It would open up some incredible possibilities for mpv.
# Place a small, borderless, floating player in the bottom left of the screen
Alt+s set border no; set ontop yes; set autofit 20%x20%; set geometry +15-15
# Place a small, borderless, floating player in the bottom right of the screen
Alt+d set border no; set ontop yes; set autofit 20%x20%; set geometry -15-15
# Place a small, borderless, floating player in the top left of the screen
Alt+w set border no; set ontop yes; set autofit 20%x20%; set geometry +15+15
# Place a small, borderless, floating player in the top right of the screen
Alt+e set border no; set ontop yes; set autofit 20%x20%; set geometry +15-15
# Place a larger, bordered, non-floating player in the center of the screen
Alt+r set border yes; set ontop no; set autofit 80%x80%; set geometry 50%:50%
Incredibly efficient player management! Imagine opening a video, and deciding "well, I'd like to watch this while working on other things"...
Do you want to re-scale the window to the appropriate final size you want, toggle the always on top mode, press a button to remove the border, and then manually drag it into position?
Or do you want to press a single button to automatically size it and put it into any corner you want?
Property change observers for geometry and autofit would make that possible. Such an ability would definitely put mpv a league above the other players out there!
Edit: Linux has window managers that can sometimes achieve this (not all of them). On macOS there's no window manager (there are some ways to achieve it with Accessibility and AppleScript but it is fragile). On Windows there is no window manager at all. So adding this to mpv core seems like the best and most universal solution.
This sounds like something your window manager should do.
(I'm aware that you have no choice on OSX but there are other possibilities)
@Argon-
This sounds like something your window manager _might be able to_ do.
If you'd said the above, I would agree.
But Windows and OSX users do not have such window management built-in. It requires tricky 3rd party apps.
If mpv would just have property change observers for those properties, it could run its rescale/position code at runtime and would be able to let the player move itself based on user commands. Seriously, don't diss this as "let's force people to use a Linux window manager for that". As a video player, it's extremely useful to be able to quickly rescale and move the player to "preset" locations and modes (on-top, borderless, etc), regardless of OS and without needing any extra apps.
The ability to move and resize the player via Lua and keybindings would be hugely appreciated by all the non-Linux users. ;-)
Came here to ask the same.
@SteveJobzniak I saw your quick-scale script and the other issue. Think maybe this could be accomplished with a script as well? In my case I was trying to get ontop and fullscreen=no, which we can already do, but add geometry="25%+100%+100%" (the same as geometry="100%:100%" and autofit="25%"). Thatâs when I realised it wasnât currently possible.
Since this can only be done before opening the file, maybe we could in the script:
Thatâd be far from ideal, but may work. Not sure it would since weâd have to close the active file.
I do agree that leaving this to the window manager is nonsensical. On anything but Linux, even the most popular and capable window managers lack such fine control (especially for sticking something to bottom right).
Edit: Just a note regarding my quick-scale script a guy mentioned above - it has been moved to https://github.com/SteveJobzniak/mpv-tools
@vitorgalvao Moving the window is sadly impossible after mpv has launched. I think the ability should be added to the LUA functions. It would be incredibly useful for "press a button to make the video ontop in a corner".
Moving the window is sadly impossible after mpv has launched.
I know, thatâs why my suggestion is to call a command that closes mpv and then relaunches it with the arguments we want, moving it on the relaunch.
@vitorgalvao Okay. Or... that time can be spent writing C++ code instead and adding window-move (via geometry property listener) to mpv's Lua engine. ;)
Is this project still alive?I'm using quick-scale and it work's fine.
But if i can use one hotkey to setting up the video window that would be perfect.
ex.Sometimes i will set the video to 480 width,put to rihgt-bottom and ontop
and do other things like watch web or play some games.
Now i do this things with --geometry 480-0-0 --ontop
By the way,i'm using cycle-video-rotate too, how can i disable the osd when i rotate a video?
It seems not work to use like
Alt+left no-osd script-message Cycle_Video_Rotate -90
Anyway thx for your watching.
@kesdoputr Hi. Glad you like the scripts. no-osd is just for built-in mpv commands. If you want to disable the OSD message, just edit the code of cycle-video-rotate.lua to remove the lines that do the OSD output. You can find it if you look inside the code.
And yes, I still agree that mpv would be better with 'geometry' change support at runtime to allow scripting hotkeys to move the player around to do things like you say, "picture in picture on-top in the corner" with a hotkey easily, etc. It would make mpv even more unique as a powerful video player.
Thx for your reply and now i can rotate video without osd.
And wish oneday geometry can be changed when playing a video.
etc.now i use autohotkey to move window if i need to move window when playing.
This really should be something mpv natively supports. The WM should not be fully responsible for this functionality.
@winneon Exactly. And since mpv already supports moving/resizing the window at startup, it already has all code necessary for moving/resizing its own window.
We had a chat on IRC about this ticket. Someone suggested that it may be as simple as calling the geometry commands listed in https://github.com/mpv-player/mpv/blob/master/video/out/win_state.c from the property observers for geometry/autofit.
So it seems like it's possible to do the following:
The only problem regarding the 2nd step is that window backends should ignore repeated requests to move to the exact same position/property value that we're already at (to avoid wasteful OS windowing syscalls). But as that file says on line 75, "all windowing backends" are able to deal with "avoiding resize on reconfig() with no size change", so it seems harmless to repeatedly send the same geometry command value to the windowing backends.
Hi is this being worked on? I'd like to move the mpv window using key bindings instead of using the mouse. It's been so long since this ticket was opened, the author became a ghost.
I did, but nobody cared, so now it isn't.
Closing and locking this since original author is gone (became "ghost").
Most helpful comment
We had a chat on IRC about this ticket. Someone suggested that it may be as simple as calling the geometry commands listed in https://github.com/mpv-player/mpv/blob/master/video/out/win_state.c from the property observers for geometry/autofit.
So it seems like it's possible to do the following:
The only problem regarding the 2nd step is that window backends should ignore repeated requests to move to the exact same position/property value that we're already at (to avoid wasteful OS windowing syscalls). But as that file says on line 75, "all windowing backends" are able to deal with "avoiding resize on reconfig() with no size change", so it seems harmless to repeatedly send the same geometry command value to the windowing backends.