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

Only show OSC when hovering? #24

Open
Yasand123 opened this issue Jul 31, 2022 · 11 comments
Open

Only show OSC when hovering? #24

Yasand123 opened this issue Jul 31, 2022 · 11 comments

Comments

@Yasand123
Copy link

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.

@cyl0
Copy link
Owner

cyl0 commented Oct 2, 2022

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

@ongxc
Copy link

ongxc commented Jan 28, 2023

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.

@akippnn
Copy link

akippnn commented Jan 29, 2023

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

@AnimeAjay
Copy link

Also very desperate for this!

@zydezu
Copy link

zydezu commented Apr 15, 2023

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/

@Yasand123
Copy link
Author

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

@miao02038
Copy link

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

@Yasand123
Copy link
Author

@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
Copy link

zydezu commented Apr 24, 2024

@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
Copy link

zydezu commented Apr 24, 2024

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

@Yasand123
Copy link
Author

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants