@@ -134,8 +134,9 @@ local user_opts = {
134
134
135
135
-- Mouse commands
136
136
-- customize the button function based on mouse action
137
- -- same as you would in input.conf
138
- -- details: https://mpv.io/manual/master/#list-of-input-commands
137
+
138
+ -- seekbar mouse wheel mode. accepts: "speed" or "seek". speed adjusts playback speed.
139
+ seekbar_track_wheel_mode = " seek" ,
139
140
140
141
-- title above seekbar mouse actions
141
142
title_mbtn_left_command = " show-text ${media-title}" ,
@@ -145,8 +146,8 @@ local user_opts = {
145
146
playlist_mbtn_left_command = " script-binding select/select-playlist; script-message-to modernz osc-hide" ,
146
147
playlist_mbtn_right_command = " show-text ${playlist} 3000" ,
147
148
148
- -- volume control icon mouse actions
149
- volumectrl_mbtn_right_command = " script-binding select/select-audio-device; script-message-to modernz osc-hide" ,
149
+ -- volume mouse actions
150
+ vol_ctrl_mbtn_right_command = " script-binding select/select-audio-device; script-message-to modernz osc-hide" ,
150
151
151
152
-- audio button mouse actions
152
153
audio_track_mbtn_left_command = " script-binding select/select-aid; script-message-to modernz osc-hide" ,
@@ -161,11 +162,15 @@ local user_opts = {
161
162
sub_track_wheel_up_command = " osd-msg cycle sub down" ,
162
163
163
164
-- chapter skip buttons mouse actions
164
- ch_prev_mbtn_left_command = " osd-msg add chapter -1" ,
165
- ch_prev_mbtn_right_command = " script-binding select/select-chapter; script-message-to modernz osc-hide" ,
165
+ chapter_prev_mbtn_left_command = " osd-msg add chapter -1" ,
166
+ chapter_prev_mbtn_right_command = " script-binding select/select-chapter; script-message-to modernz osc-hide" ,
167
+
168
+ chapter_next_mbtn_left_command = " osd-msg add chapter 1" ,
169
+ chapter_next_mbtn_right_command = " script-binding select/select-chapter; script-message-to modernz osc-hide" ,
166
170
167
- ch_next_mbtn_left_command = " osd-msg add chapter 1" ,
168
- ch_next_mbtn_right_command = " script-binding select/select-chapter; script-message-to modernz osc-hide" ,
171
+ -- chapter title (below seekbar) mouse actions
172
+ chapter_title_mbtn_left_command = " script-binding select/select-chapter; script-message-to modernz osc-hide" ,
173
+ chapter_title_mbtn_right_command = " show-text ${chapter-list} 3000" ,
169
174
}
170
175
171
176
local osc_param = { -- calculated by osc_init()
@@ -1854,8 +1859,8 @@ local function osc_init()
1854
1859
ne .softrepeat = user_opts .chapter_softrepeat == true
1855
1860
ne .content = icons .rewind
1856
1861
ne .enabled = (have_ch ) -- disables button when no chapters available.
1857
- ne .eventresponder [" mbtn_left_down" ] = command_callback (user_opts .ch_prev_mbtn_left_command )
1858
- ne .eventresponder [" mbtn_right_down" ] = command_callback (user_opts .ch_prev_mbtn_right_command )
1862
+ ne .eventresponder [" mbtn_left_down" ] = command_callback (user_opts .chapter_prev_mbtn_left_command )
1863
+ ne .eventresponder [" mbtn_right_down" ] = command_callback (user_opts .chapter_prev_mbtn_right_command )
1859
1864
ne .eventresponder [" shift+mbtn_left_down" ] = function () mp .commandv (" seek" , - 60 , jumpmode ) end
1860
1865
ne .eventresponder [" shift+mbtn_right_down" ] = function () mp .command (" show-text ${chapter-list} 3000" ) end
1861
1866
@@ -1865,8 +1870,8 @@ local function osc_init()
1865
1870
ne .softrepeat = user_opts .chapter_softrepeat == true
1866
1871
ne .content = icons .forward
1867
1872
ne .enabled = (have_ch ) -- disables button when no chapters available.
1868
- ne .eventresponder [" mbtn_left_down" ] = command_callback (user_opts .ch_next_mbtn_left_command )
1869
- ne .eventresponder [" mbtn_right_down" ] = command_callback (user_opts .ch_next_mbtn_right_command )
1873
+ ne .eventresponder [" mbtn_left_down" ] = command_callback (user_opts .chapter_next_mbtn_left_command )
1874
+ ne .eventresponder [" mbtn_right_down" ] = command_callback (user_opts .chapter_next_mbtn_right_command )
1870
1875
ne .eventresponder [" shift+mbtn_left_down" ] = function () mp .commandv (" seek" , 60 , jumpmode ) end
1871
1876
ne .eventresponder [" shift+mbtn_right_down" ] = function () mp .command (" show-text ${chapter-list} 3000" ) end
1872
1877
@@ -1939,7 +1944,7 @@ local function osc_init()
1939
1944
end
1940
1945
end
1941
1946
ne .eventresponder [" mbtn_left_up" ] = function () mp .commandv (" cycle" , " mute" ) end
1942
- ne .eventresponder [" mbtn_right_up" ] = command_callback (user_opts .volumectrl_mbtn_right_command )
1947
+ ne .eventresponder [" mbtn_right_up" ] = command_callback (user_opts .vol_ctrl_mbtn_right_command )
1943
1948
ne .eventresponder [" wheel_up_press" ] = function ()
1944
1949
if state .mute then mp .commandv (" cycle" , " mute" ) end
1945
1950
mp .commandv (" add" , " volume" , 5 )
@@ -2206,8 +2211,22 @@ local function osc_init()
2206
2211
state .playingWhilstSeeking = false
2207
2212
end
2208
2213
end
2209
- ne .eventresponder [" wheel_up_press" ] = function () mp .commandv (" seek" , 10 ) end
2210
- ne .eventresponder [" wheel_down_press" ] = function () mp .commandv (" seek" , - 10 ) end
2214
+ ne .eventresponder [" wheel_up_press" ] = function ()
2215
+ if user_opts .seekbar_track_wheel_mode == " speed" then
2216
+ local current_speed = mp .get_property_number (" speed" )
2217
+ mp .commandv (" osd-msg" , " set" , " speed" , math.min (100 , current_speed + 0.1 ))
2218
+ else
2219
+ mp .commandv (" seek" , 10 )
2220
+ end
2221
+ end
2222
+ ne .eventresponder [" wheel_down_press" ] = function ()
2223
+ if user_opts .seekbar_track_wheel_mode == " speed" then
2224
+ local current_speed = mp .get_property_number (" speed" )
2225
+ mp .commandv (" osd-msg" , " set" , " speed" , math.max (0.1 , current_speed - 0.1 ))
2226
+ else
2227
+ mp .commandv (" seek" , - 10 )
2228
+ end
2229
+ end
2211
2230
2212
2231
-- persistent seekbar
2213
2232
ne = new_element (" persistentseekbar" , " slider" )
@@ -2303,8 +2322,8 @@ local function osc_init()
2303
2322
end
2304
2323
return " " -- fallback
2305
2324
end
2306
- ne .eventresponder [" mbtn_left_down" ] = function () mp . command ( " script-binding select/select-chapter; script-message-to modernz osc-hide " ) end
2307
- ne .eventresponder [" mbtn_right_down" ] = function () mp . command ( " show-text ${chapter-list} 3000 " ) end
2325
+ ne .eventresponder [" mbtn_left_down" ] = command_callback ( user_opts . chapter_title_mbtn_left_command )
2326
+ ne .eventresponder [" mbtn_right_down" ] = command_callback ( user_opts . chapter_title_mbtn_right_command )
2308
2327
2309
2328
-- Total/remaining time display
2310
2329
ne = new_element (" tc_right" , " button" )
0 commit comments