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

Assign several actions for a OSC button #588

Open
pokemaster974 opened this issue Jul 23, 2023 · 3 comments
Open

Assign several actions for a OSC button #588

pokemaster974 opened this issue Jul 23, 2023 · 3 comments

Comments

@pokemaster974
Copy link

pokemaster974 commented Jul 23, 2023

Hi, is it possible to assign several actions for a OSC button ?
For example, into the default osc, we can apply 3 different actions when we click on the subtitles button :

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

    ne.enabled = (#tracks_osc.audio > 0)
    ne.content = function ()
        local aid = "–"
        if not (get_track("audio") == 0) then
            aid = get_track("audio")
        end
        return ("\238\132\134" .. osc_styles.smallButtonsLlabel
            .. " " .. aid .. "/" .. #tracks_osc.audio)
    end
    ne.eventresponder["mbtn_left_up"] =
        function () set_track("audio", 1) end
    ne.eventresponder["mbtn_right_up"] =
        function () set_track("audio", -1) end
    ne.eventresponder["shift+mbtn_left_down"] =
        function () show_message(get_tracklist("audio"), 2) end

On uosc.lua, I found this :

bind_command('audio', create_select_tracklist_type_menu_opener(
	'Audio', 'audio', 'aid', 'script-binding uosc/load-audio'
))

My goal is to have at least 2 actions :
-left click -> toggle to next audio
-right click -> open the audio menu

But I don't know how to do this, and if I success to do it, it will break the compatibility with you version.
Maybe I can do something with overwrite-binding <name> <command> or maybe into uosc.conf but I'm not sure.

Thanks for your help !

@christoph-heinrich
Copy link
Contributor

Quote

increasing the complexity of already pretty complex command config syntax to allow different behavior depending on a button pressing it is definitely not gonna happen

Seems like a useful thing to have though.

@hooke007
Copy link
Contributor

I also dislike the idea that one button share different actions.
And I haven't met other media players using the similar logic.

IMO, the reason why default osc allow it is that they don't want to design a more complex UI to increase the burden of maintenance. A button with many actions seems to be the compromise solution.
While uosc already had the friendly track-list menu.

@tomasklaen
Copy link
Owner

I'll leave the issue open, but no promises.

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

4 participants