Skip to content
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

When osc visibility is set to always, apply margins to show select menus above it #302

Closed
Samillion opened this issue Jan 10, 2025 · 47 comments · Fixed by #303
Closed

When osc visibility is set to always, apply margins to show select menus above it #302

Samillion opened this issue Jan 10, 2025 · 47 comments · Fixed by #303
Labels
feature request New feature or request

Comments

@Samillion
Copy link
Owner

Expected behavior of the wanted feature

At the moment, all the interactive menus console/select force the OSC to hide.

It was implemented like that so that console or select don't overlap with the OSC itself. It works, but it's not the best solution.

A better implementation is to introduce osc margins, so that it draws console/select above the OSC if it's visible, and once OSC hides, it moves down.

This follows mpv's stock OSC implementation, and we wouldn't need to assign a z depth of -1 to draw the osc behind everything.

Which should also follow the pending PR at mpv to improve console/select: mpv-player/mpv#15676

image

image

@Samillion Samillion added the feature request New feature or request label Jan 10, 2025
@Samillion
Copy link
Owner Author

Samillion commented Jan 11, 2025

Test script: osc_margins/modernz.lua
Commit: b934b13

Changes:

  • Don't force OSC to hide with interactive menus
  • Use osc margins to show interactive menus above osc, when it's visible
  • Change z depth of OSC to 1000 instead of -1

CC: @Keith94 since you asked for this a while ago in #265

@Samillion Samillion changed the title Improve interactive menus by drawing it above osc if osc is visibile Improve interactive menus by showing them above osc, if osc is visibile Jan 11, 2025
@Samillion

This comment was marked as resolved.

@Samillion
Copy link
Owner Author

Updated: osc_margins/modernz.lua
Commit: 9b3c1d0

Changes:

  • When osc is visible, don't spam margins (verbose)

@Samillion

This comment was marked as resolved.

@Keith94

This comment was marked as resolved.

@Samillion

This comment was marked as resolved.

@Keith94

This comment was marked as resolved.

@Samillion
Copy link
Owner Author

Indeed.

Updated: osc_margins/modernz.lua
Commit: cbc4c8b

Changes:

  • Hide osc when showing interactive menus

@Samillion

This comment was marked as resolved.

@Samillion
Copy link
Owner Author

Updated: osc_margins/modernz.lua
Commit: fe3272a

Changes:

  • Don't force hide osc with menus if osc visibility is set to always (ie: only with auto)

@Samillion
Copy link
Owner Author

I'll wait a day or so before merging, just to make sure everything is working well.

@Keith94

This comment was marked as resolved.

@Samillion

This comment was marked as outdated.

@Keith94

This comment was marked as resolved.

@Samillion

This comment was marked as resolved.

@Keith94

This comment was marked as resolved.

@Samillion

This comment was marked as resolved.

@Samillion

This comment was marked as resolved.

@Samillion
Copy link
Owner Author

Updated: osc_margins/modernz.lua
Commit: 552e7ca

Changes:

  • Remove unnecessary request_init() calls within osc_init()
  • Apply osc margins within osc_init()
  • Add cache_enabled() helper

@Samillion

This comment was marked as resolved.

@Keith94

This comment was marked as resolved.

@Samillion

This comment was marked as resolved.

@Keith94

This comment was marked as resolved.

@guidocella
Copy link

osc.lua also sets margins only with visibility=always to not shift console up and down with visibility=auto (mpv-player/mpv@4787eb594a).

Not hiding the OSC with visibility=always is also good because otherwise after you select something it doesn't reappear again until you move the mouse when it's supposed to be always visibile.

@Samillion
Copy link
Owner Author

Updated: osc_margins/modernz.lua
Commit: 32c4696

Changes:

  • Don't use margins if osc is visible only temporarily

@Samillion
Copy link
Owner Author

Updated: osc_margins/modernz.lua
Commit: 39732b5

Changes:

  • Update chapter title to the current playing chapter
    • Since request_init() was used to update it (not sure why), it stopped working after its removal. Simply letting the content function handle it resolves the issue.

@Samillion Samillion changed the title Improve interactive menus by showing them above osc, if osc is visibile When osc visibility is set to always, apply margins to show select menus above it Jan 11, 2025
@Keith94
Copy link
Contributor

Keith94 commented Jan 11, 2025

Flawless 🙌🏻

@Samillion
Copy link
Owner Author

Updated: osc_margins/modernz.lua
Commit: 1361b64

Changes:

  • Show cache_info tooltip on hover using the new cache helper function

@Fabioah
Copy link

Fabioah commented Jan 13, 2025

Is it possible to have something like this even with visibility set to auto? Right now they overlap pretty badly
Screencast_20250113_153241.webm

@Samillion
Copy link
Owner Author

Samillion commented Jan 13, 2025

That shouldn't be happening. If I had to guess, you just need to update mpv and/or console.lua and select.lua

The behavior is that when you click to show a select menu, it hides the osc until the menu is closed, as shown here:
https://github.com/Samillion/ModernZ/blob/main/docs/INTERACTIVE_MENUS.md

@Fabioah
Copy link

Fabioah commented Jan 13, 2025

It may have something to do with the flatpak version of mpv. Thank you I will look into that

@Samillion
Copy link
Owner Author

Before you find an alternative method to update mpv, try updating select.lua and console.lua manually.

Simply place them in your scripts folder: (from mpv's repo)
https://github.com/mpv-player/mpv/blob/master/player/lua/console.lua
https://github.com/mpv-player/mpv/blob/master/player/lua/select.lua

@guidocella
Copy link

That video is from before I added mouse support to console.

@Samillion
Copy link
Owner Author

Samillion commented Jan 13, 2025

It may have something to do with the flatpak version of mpv. Thank you I will look into that

As far as I know, that's not officially maintained by mpv team and is far behind the current mpv master release.

I discussed mpv updates over flatpaks on irc. It was a casual discussion, but maybe in the future mpv will introduce more binaries (deb, rpm...etc) or flatpak or even a -u option to update it like yt-dlp.

Most of the Linux users I've seen tend to use mpv-build to get the latest mpv master.

@Fabioah
Copy link

Fabioah commented Jan 13, 2025

Before you find an alternative method to update mpv, try updating select.lua and console.lua manually.

Simply place them in your scripts folder: (from mpv's repo) https://github.com/mpv-player/mpv/blob/master/player/lua/console.lua https://github.com/mpv-player/mpv/blob/master/player/lua/select.lua

I tried but it doesn't work :(

@Fabioah
Copy link

Fabioah commented Jan 13, 2025

That video is from before I added mouse support to console.

I don't have mouse support neither so I guess it's really because I have those 2 files outdated

@Fabioah
Copy link

Fabioah commented Jan 13, 2025

It may have something to do with the flatpak version of mpv. Thank you I will look into that

As far as I know, that's not officially maintained by mpv team and is far behind the current mpv master release.

I discussed mpv updates over flatpaks on irc. It was a casual discussion, but maybe in the future mpv will introduce more binaries (deb, rpm...etc) or flatpak or even a -u option to update it like yt-dlp.

Most of the Linux users I've seen tend to use mpv-build to get the latest mpv master.

I tried quickly but I got some compilation errors, I will try again when I have more time. Thank you for your help anyway.

@guidocella
Copy link

You need to set --load-osd-console=no to disable the builtin one when you drop a newer console.lua in ~~scripts.

@Fabioah
Copy link

Fabioah commented Jan 13, 2025

You need to set --load-osd-console=no to disable the builtin one when you drop a newer console.lua in ~~scripts.

Now it doesn't work at all and shows these errors

[console] 
[console] stack traceback:
[console]       /home/fa/.var/app/io.mpv.Mpv/config/mpv/scripts/console.lua:311: in function 'get_selected_ass'
[console]       /home/fa/.var/app/io.mpv.Mpv/config/mpv/scripts/console.lua:465: in function 
'populate_log_with_matches'
[console]       /home/fa/.var/app/io.mpv.Mpv/config/mpv/scripts/console.lua:600: in function 'update'
[console]       /home/fa/.var/app/io.mpv.Mpv/config/mpv/scripts/console.lua:1781: in function 'set_active'
[console]       /home/fa/.var/app/io.mpv.Mpv/config/mpv/scripts/console.lua:1855: in function 'handler'
[console]       mp.defaults:385: in function 'handler'
[console]       mp.defaults:515: in function 'call_event_handlers'
[console]       mp.defaults:557: in function 'dispatch_events'
[console]       mp.defaults:508: in function <mp.defaults:507>
[console]       [C]: at 0x60608a476550
[console]       [C]: at 0x60608a477280
[console] Lua error: /home/fa/.var/app/io.mpv.Mpv/config/mpv/scripts/console.lua:306: attempt to index local 'color' (a nil value)

Anyway don't worry i rarely change subs or language so it doesn't affect me much.

@Samillion
Copy link
Owner Author

If you want, until you update mpv, put this in your modernz.conf

title_mbtn_left_command=show-text ${filename}
playlist_mbtn_left_command=show-text ${playlist} 3000
audio_track_mbtn_left_command=cycle audio
sub_track_mbtn_left_command=cycle sub
chapter_title_mbtn_left_command=show-text ${chapter-list} 3000

At least it'll give you some functionality (like changing sub/audio) instead of a buggy behavior.

@guidocella
Copy link

Yeah console depends on --osd-selected-color which I added after the release.

@Samillion
Copy link
Owner Author

[console] /home/fa/.var/app/io.mpv.Mpv/config/mpv/scripts/console.lua:311: in function 'get_selected_ass'

Tehehe. get_selected_ass

@Fabioah
Copy link

Fabioah commented Jan 13, 2025

If you want, until you update mpv, put this in your modernz.conf

title_mbtn_left_command=show-text ${filename}
playlist_mbtn_left_command=show-text ${playlist} 3000
audio_track_mbtn_left_command=cycle audio
sub_track_mbtn_left_command=cycle sub
chapter_title_mbtn_left_command=show-text ${chapter-list} 3000

At least it'll give you some functionality (like changing sub/audio) instead of a buggy behavior.

Thank you very much!

@Samillion
Copy link
Owner Author

I added notes about it, for future reference if it's ever needed
https://github.com/Samillion/ModernZ/blob/main/docs/INTERACTIVE_MENUS.md#notes

@Fabioah
Copy link

Fabioah commented Jan 16, 2025

Just a little follow up. I switched to Arch Linux and tried with the official package but i was still getting the same problems (I assumed the Arch package was updated and it looks so) so I tried mpv-build as you suggested and now it works perfectly. In conclusion I think having mpv 0.39 is not enough and probably not even 0.39.4 since it's the one in Arch repository.

@guidocella
Copy link

On arch you can just install mpv-git from the AUR.

@Fabioah
Copy link

Fabioah commented Jan 16, 2025

On arch you can just install mpv-git from the AUR.

I tried mpv-build-git but it gave me more errors than just building it by myself, now I will try mpv-git
Edit: okay it works with mpv-git too. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request
Projects
None yet
4 participants