diff --git a/DOCS/man/osc.rst b/DOCS/man/osc.rst index 7f2ff15e81d9e..f4a43bfc39577 100644 --- a/DOCS/man/osc.rst +++ b/DOCS/man/osc.rst @@ -497,6 +497,9 @@ Configurable Options The following options configure what commands are run when the buttons are clicked. ``mbtn_mid`` commands are also triggered with ``shift+mbtn_left``. +When there's only one track of a type, left clicks on track buttons always cycle +it instead of using the configured command. + ``title_mbtn_left_command=script-binding select/select-playlist; script-message-to osc osc-hide`` ``title_mbtn_mid_command=show-text ${filename}`` diff --git a/player/lua/osc.lua b/player/lua/osc.lua index 4a622f91c95c9..63f2e8d464d44 100644 --- a/player/lua/osc.lua +++ b/player/lua/osc.lua @@ -1866,7 +1866,9 @@ local function osc_init() return ("\238\132\134" .. osc_styles.smallButtonsLlabel .. " " .. (mp.get_property_native("aid") or "-") .. "/" .. audio_track_count) end - ne.eventresponder["mbtn_left_up"] = command_callback(user_opts.audio_track_mbtn_left_command) + ne.eventresponder["mbtn_left_up"] = command_callback(audio_track_count == 1 + and "cycle audio" + or user_opts.audio_track_mbtn_left_command) ne.eventresponder["shift+mbtn_left_up"] = command_callback( user_opts.audio_track_mbtn_mid_command) ne.eventresponder["mbtn_right_up"] = command_callback(user_opts.audio_track_mbtn_right_command) @@ -1886,7 +1888,9 @@ local function osc_init() return ("\238\132\135" .. osc_styles.smallButtonsLlabel .. " " .. (mp.get_property_native("sid") or "-") .. "/" .. sub_track_count) end - ne.eventresponder["mbtn_left_up"] = command_callback(user_opts.sub_track_mbtn_left_command) + ne.eventresponder["mbtn_left_up"] = command_callback(sub_track_count == 1 + and "cycle sub" + or user_opts.sub_track_mbtn_left_command) ne.eventresponder["shift+mbtn_left_up"] = command_callback(user_opts.sub_track_mbtn_mid_command) ne.eventresponder["mbtn_right_up"] = command_callback(user_opts.sub_track_mbtn_right_command)