maoiscat / mpv-dark-box

This is a mpv osc script
46 stars 5 forks source link

Volume indicator/mute button #4

Open Mayurifag opened 2 years ago

Mayurifag commented 2 years ago

@maoiscat hi! Thanks to your mpv extension, its so much better than default osc, I liked it very much! ❤️

However, I'm missing volume button: that was very handy to have ability to mute sound fast (via left-clicking on volume button) and change volume (via scrolling on icon up and down). Still, I see the code about volume in .lua file. Is there any way I can get volume button back? Isn't it just forgotten to be shown on interface? I can't see in Windows nor Linux environments.

Thanks in advance! 👍🏻

Mayurifag commented 2 years ago

I see its already coded, but seems to be not used?

    -- volume
    ne = new_element("volume", "button")

    ne.content = function()
        local volume = mp.get_property_number("volume", 0)
        local mute = mp.get_property_native("mute")
        local volicon = {"\238\132\139", "\238\132\140",
                         "\238\132\141", "\238\132\142"}
        if volume == 0 or mute then
            return "\238\132\138"
        else
            return volicon[math.min(4,math.ceil(volume / (100/3)))]
        end
    end
    ne.eventresponder["mbtn_left_up"] =
        function () mp.commandv("cycle", "mute") end

    ne.eventresponder["wheel_up_press"] =
        function () mp.commandv("osd-auto", "add", "volume", 5) end
    ne.eventresponder["wheel_down_press"] =
        function () mp.commandv("osd-auto", "add", "volume", -5) end
Mayurifag commented 2 years ago

Okay, I've actually opened a pull request with the naive implementation. https://github.com/maoiscat/mpv-dark-box/pull/5

mpv

Its not that fancy as mpv-dark-box's interface, but more looks like the stock mpv interface one. Still I'd rather have volume button to be presented in the interface even if its ugly, then not to have it.

Link to .lua file, if you want to use this interface with volume https://raw.githubusercontent.com/Mayurifag/mpv-dark-box/add-volume-button/dark-box.lua

maoiscat commented 2 years ago

Thank you for your work. however the hidden volume icon is a feature rather than a bug, so i suggest you keep it in your own fork. anyway, i will decline your pull request.

Mayurifag commented 2 years ago

Thanks! Lets have open this issue to let users know? Or, maybe, we may have option, that is disabled by default.