History

osc.lua: open select.lua by clicking buttons

8bf5548 added mouse support to the console's select menu, so open it from OSC buttons. Left click on the title opens the playlist selector and showing the stats is moved to right click. Right click on chapter buttons opens the chapter selector. Left click on track buttons opens the track selectors because seeing which track you're selecting beforehand is useful. Fixes #10621.

Guido Cella committed 2 years ago

Commit cd2acb41 parent 68e2b512 files · +38 −26Browse files

Showing the changes to player/lua/osc.lua (1 of 2 files). Show all

Unified · Split

player/lua/osc.lua+26−17
@@ -1703,7 +1703,7 @@ local function osc_init() · 1702 unmodified lines
17031703 end
17041704
17051705 ne.eventresponder["mbtn_left_up"] = function ()
1706− mp.command("script-binding stats/display-page-5")
1706+ mp.command("script-binding select/select-playlist; script-message-to osc osc-hide")
17071707 end
17081708 ne.eventresponder["shift+mbtn_left_up"] = function ()
17091709 mp.command("show-text ${filename}")
@@ -1728,8 +1728,9 @@ local function osc_init() · 18 unmodified lines
17281728 end
17291729 ne.eventresponder["shift+mbtn_left_up"] =
17301730 function () mp.command("show-text ${playlist} 3000") end
1731− ne.eventresponder["mbtn_right_up"] =
1732− function () mp.command("show-text ${playlist} 3000") end
1731+ ne.eventresponder["mbtn_right_up"] = function ()
1732+ mp.command("show-text ${playlist} 3000")
1733+ end
17331734
17341735 --next
17351736 ne = new_element("pl_next", "button")
@@ -1745,8 +1746,9 @@ local function osc_init() · 9 unmodified lines
17451746 end
17461747 ne.eventresponder["shift+mbtn_left_up"] =
17471748 function () mp.command("show-text ${playlist} 3000") end
1748− ne.eventresponder["mbtn_right_up"] =
1749− function () mp.command("show-text ${playlist} 3000") end
1749+ ne.eventresponder["mbtn_right_up"] = function ()
1750+ mp.command("show-text ${playlist} 3000")
1751+ end
17501752
17511753
17521754 -- big buttons
@@ -1806,8 +1808,9 @@ local function osc_init() · 53 unmodified lines
18061808 end
18071809 ne.eventresponder["shift+mbtn_left_up"] =
18081810 function () mp.command("show-text ${chapter-list} 3000") end
1809− ne.eventresponder["mbtn_right_up"] =
1810− function () mp.command("show-text ${chapter-list} 3000") end
1811+ ne.eventresponder["mbtn_right_up"] = function ()
1812+ mp.command("script-binding select/select-chapter; script-message-to osc osc-hide")
1813+ end
18111814
18121815 --ch_next
18131816 ne = new_element("ch_next", "button")
@@ -1823,8 +1826,9 @@ local function osc_init() · 9 unmodified lines
18231826 end
18241827 ne.eventresponder["shift+mbtn_left_up"] =
18251828 function () mp.command("show-text ${chapter-list} 3000") end
1826− ne.eventresponder["mbtn_right_up"] =
1827− function () mp.command("show-text ${chapter-list} 3000") end
1829+ ne.eventresponder["mbtn_right_up"] = function ()
1830+ mp.command("script-binding select/select-chapter; script-message-to osc osc-hide")
1831+ end
18281832
18291833 --
18301834 update_tracklist()
@@ -1837,12 +1841,13 @@ local function osc_init() · 6 unmodified lines
18371841 return ("\238\132\134" .. osc_styles.smallButtonsLlabel .. " " ..
18381842 (mp.get_property_native("aid") or "-") .. "/" .. audio_track_count)
18391843 end
1840− ne.eventresponder["mbtn_left_up"] =
1841− function () mp.command("cycle audio") end
1842− ne.eventresponder["mbtn_right_up"] =
1843− function () mp.command("cycle audio down") end
1844+ ne.eventresponder["mbtn_left_up"] = function ()
1845+ mp.command("script-binding select/select-aid; script-message-to osc osc-hide")
1846+ end
18441847 ne.eventresponder["shift+mbtn_left_down"] =
18451848 function () mp.command("show-text ${track-list/audio} 2000") end
1849+ ne.eventresponder["shift+mbtn_right_up"] =
1850+ function () mp.command("show-text ${track-list/sub} 2000") end
18461851
18471852 if user_opts.scrollcontrols then
18481853 ne.eventresponder["wheel_down_press"] =
@@ -1859,12 +1864,13 @@ local function osc_init() · 10 unmodified lines
18591864 return ("\238\132\135" .. osc_styles.smallButtonsLlabel .. " " ..
18601865 (mp.get_property_native("sid") or "-") .. "/" .. sub_track_count)
18611866 end
1862− ne.eventresponder["mbtn_left_up"] =
1863− function () mp.command("cycle sub") end
1864− ne.eventresponder["mbtn_right_up"] =
1865− function () mp.command("cycle sub down") end
1867+ ne.eventresponder["mbtn_left_up"] = function ()
1868+ mp.command("script-binding select/select-sid; script-message-to osc osc-hide")
1869+ end
18661870 ne.eventresponder["shift+mbtn_left_down"] =
18671871 function () mp.command("show-text ${track-list/sub} 2000") end
1872+ ne.eventresponder["shift+mbtn_right_up"] =
1873+ function () mp.command("show-text ${track-list/sub} 2000") end
18681874
18691875 if user_opts.scrollcontrols then
18701876 ne.eventresponder["wheel_down_press"] =
@@ -2074,6 +2080,9 @@ local function osc_init() · 203 unmodified lines
20742080 end
20752081 ne.eventresponder["mbtn_left_up"] =
20762082 function () mp.commandv("cycle", "mute") end
2083+ ne.eventresponder["mbtn_right_up"] = function ()
2084+ mp.command("script-binding select/select-audio-device; script-message-to osc osc-hide")
2085+ end
20772086
20782087 if user_opts.scrollcontrols then
20792088 ne.eventresponder["wheel_up_press"] =

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t