-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Property change observers for geometry and autofit #3872
Comments
This sounds like something your window manager should 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 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". |
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. ex.Sometimes i will set the video to 480 width,put to rihgt-bottom and ontop By the way,i'm using cycle-video-rotate too, how can i disable the osd when i rotate a video? Anyway thx for your watching. |
@kesdoputr Hi. Glad you like the scripts. 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. 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. |
This carries on from the discussion in comment #2301 (comment) 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:
It would open up some incredible possibilities for mpv.
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.
The text was updated successfully, but these errors were encountered: