MordenX icon indicating copy to clipboard operation
MordenX copied to clipboard

Only show OSC when hovering?

Open Yasand123 opened this issue 3 years ago • 11 comments

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.

Yasand123 avatar Jul 31 '22 00:07 Yasand123

There's currently no option for this, but it shouldn't be too hard to implement if there is a demand for this feature.

cyl0 avatar Oct 02 '22 08:10 cyl0

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.

ongxc avatar Jan 28 '23 15:01 ongxc

The code seems to be present. Will this ever be implemented?

akippnn avatar Jan 29 '23 16:01 akippnn

Also very desperate for this!

AnimeAjay avatar Apr 11 '23 03:04 AnimeAjay

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)

image

        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 avatar Apr 15 '23 11:04 zydezu

@zydezu thank you for sharing this, it works well!

Yasand123 avatar Apr 25 '23 00:04 Yasand123

@zydezu Thank you for sharing. May I ask how to display OSC when hovering over the top of the screen based on this?

miao02038 avatar Aug 22 '23 17:08 miao02038

@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.

Yasand123 avatar Apr 24 '24 21:04 Yasand123

@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 avatar Apr 24 '24 23:04 zydezu

@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.

zydezu avatar Apr 24 '24 23:04 zydezu

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!

Yasand123 avatar Apr 25 '24 00:04 Yasand123