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

Unified · Split

2 files
  1. DOCS/man/osc.rst +12 −9
  2. player/lua/osc.lua +26 −17
DOCS/man/osc.rst+12−9
@@ -31,15 +31,17 @@ The Interface · 30 unmodified lines
3131 pl prev
3232 ============= ================================================
3333 left-click play previous file in playlist
34− right-click show playlist
35− shift+L-click show playlist
34+ right-click open the playlist selector
35+ shift+L-click show the playlist
36+ middle-click show the playlist
3637 ============= ================================================
3738
3839 pl next
3940 ============= ================================================
4041 left-click play next file in playlist
41− right-click show playlist
42− shift+L-click show playlist
42+ right-click open the playlist selector
43+ shift+L-click show the playlist
44+ middle-click show the playlist
4345 ============= ================================================
4446
4547 title
@@ -47,9 +49,8 @@ title · 1 unmodified line
4749 title, or the target chapter name while hovering the seekbar.
4850
4951 ============= ================================================
50− left-click show file and track info
51− middle-click show filename
52− shift+L-click show filename
52+ left-click open the playlist selector
53+ middle-click show the filename
5354 right-click show file and track info
5455 ============= ================================================
5556
@@ -102,15 +103,17 @@ audio and sub · 46 unmodified lines
102103 | Displays selected track and amount of available tracks
103104
104105 ============= ================================================
105− left-click cycle audio/sub tracks forward
106− right-click cycle audio/sub tracks backwards
106+ left-click open the audio/sub track selector
107107 shift+L-click show available audio/sub tracks
108+ middle-click show available audio/sub tracks
109+ right-click show available audio/sub tracks
108110 mouse wheel cycle audio/sub tracks forward/backwards
109111 ============= ================================================
110112
111113 vol
112114 ============= ================================================
113115 left-click toggle mute
116+ right-click open the audio device selector
114117 mouse wheel volume up/down
115118 ============= ================================================
116119
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