Only show OSC when hovering?
The default behavior is to show it whenever the cursor moves and I'm wondering if there's a way to make it only show when I hover over the OSC elements at the bottom. I apologize if there's an option for that already but I have read through the lua file multiple times but I couldn't anything related.
There's currently no option for this, but it shouldn't be too hard to implement if there is a demand for this feature.
The original OSC Modern does have this feature. Maybe it's something that can be referred to. It does make a difference for multitasking, not having the OSC pops up when the mouse pointer was moved.
The code seems to be present. Will this ever be implemented?
Also very desperate for this!
Add an option in user opts
local user_opts = {
...
bottomhover = true, -- if the osc should only display when hover occurs at video elements on the bottom of the window
...
}
In the process_event subroutine, modify code in the if (user_opts.minmousemove == 0) or ... selection inside the elseif source == 'mouse_move' then line (around line 2400)

if (user_opts.minmousemove == 0) or (not ((state.last_mouseX == nil) or (state.last_mouseY == nil)) and ((math.abs(mouseX - state.last_mouseX) >= user_opts.minmousemove) or (math.abs(mouseY - state.last_mouseY) >= user_opts.minmousemove))) then
if user_opts.bottomhover then -- if enabled, only show osc if mouse is hovering at the bottom of the screen (where the UI elements are)
if (mouseY > osc_param.playresy - 200) then -- account for scaling options
show_osc()
else
hide_osc()
end
else
show_osc()
end
end
Attached is a file, but as it's from my personal fork, some other snippets will be edited- but implementing this feature should work fine. modernx.zip [OUTDATED] - please visit https://github.com/zydezu/modernX/
@zydezu thank you for sharing this, it works well!
@zydezu Thank you for sharing. May I ask how to display OSC when hovering over the top of the screen based on this?
@zydezu Sorry for the mention, but I'm having an issue with your modified script. I reformatted my PC 2 days ago and the script stopped working ever since. I get this in the console when opening a video with mpv: Lua error: ~/.config/mpv/scripts/modernx.lua:2740: attempt to call field 'shared_script_property_set' (a nil value)
This is the line in question from modernx.lua utils.shared_script_property_set("osc-visibility", mode). I redownloaded your zip file just to make sure mine wasn't edited or corrupted, but I still get the same error. I'm at a loss. No idea if it's some missing library or what.
Interestingly, the non modified modernx.lua from this fork works fine.
@zydezu Sorry for the mention, but I'm having an issue with your modified script. I reformatted my PC 2 days ago and the script stopped working ever since. I get this in the console when opening a video with mpv:
Lua error: ~/.config/mpv/scripts/modernx.lua:2740: attempt to call field 'shared_script_property_set' (a nil value)This is the line in question from modernx.lua
utils.shared_script_property_set("osc-visibility", mode). I redownloaded your zip file just to make sure mine wasn't edited or corrupted, but I still get the same error. I'm at a loss. No idea if it's some missing library or what.Interestingly, the non modified modernx.lua from this fork works fine.
What version of mpv are you on ? that could be the issue ...
@zydezu Sorry for the mention, but I'm having an issue with your modified script. I reformatted my PC 2 days ago and the script stopped working ever since. I get this in the console when opening a video with mpv:
Lua error: ~/.config/mpv/scripts/modernx.lua:2740: attempt to call field 'shared_script_property_set' (a nil value)This is the line in question from modernx.lua
utils.shared_script_property_set("osc-visibility", mode). I redownloaded your zip file just to make sure mine wasn't edited or corrupted, but I still get the same error. I'm at a loss. No idea if it's some missing library or what.Interestingly, the non modified modernx.lua from this fork works fine.
The zip file I provided in that message is pretty outdated - I have my own repo for this fork now - https://github.com/zydezu/modernX/ please could you donwload from there instead.
The zip file I provided in that message is pretty outdated - I have my own repo for this fork now - https://github.com/zydezu/modernX/ please could you donwload from there instead.
It works now. I love the new additions as well. Thank you!