History

osc.lua: rename buttons

Give buttons nicer names before exposing script-opts for their bindings. In particular, rename cy_audio and cy_sub to audio_track and sub_track because their left click binding no longer cycles.

Guido Cella committed 2 years ago

Commit e6db75b1 parent c24c9021 file · +32 −32Browse files

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

Unified · Split

player/lua/osc.lua+32−32
@@ -1221,12 +1221,12 @@ layouts["box"] = function () · 1220 unmodified lines
1221 lo.style = osc_styles.vidtitle1221 lo.style = osc_styles.vidtitle
1222 lo.button.maxchars = user_opts.boxmaxchars1222 lo.button.maxchars = user_opts.boxmaxchars
1223 1223
1224 lo = add_layout("pl_prev")1224 lo = add_layout("playlist_prev")
1225 lo.geometry =1225 lo.geometry =
1226 {x = (posX - pos_offsetX), y = titlerowY, an = 7, w = 12, h = 12}1226 {x = (posX - pos_offsetX), y = titlerowY, an = 7, w = 12, h = 12}
1227 lo.style = osc_styles.topButtons1227 lo.style = osc_styles.topButtons
1228 1228
1229 lo = add_layout("pl_next")1229 lo = add_layout("playlist_next")
1230 lo.geometry =1230 lo.geometry =
1231 {x = (posX + pos_offsetX), y = titlerowY, an = 9, w = 12, h = 12}1231 {x = (posX + pos_offsetX), y = titlerowY, an = 9, w = 12, h = 12}
1232 lo.style = osc_styles.topButtons1232 lo.style = osc_styles.topButtons
@@ -1238,37 +1238,37 @@ layouts["box"] = function () · 5 unmodified lines
1238 local bigbtnrowY = posY - pos_offsetY + 351238 local bigbtnrowY = posY - pos_offsetY + 35
1239 local bigbtndist = 601239 local bigbtndist = 60
1240 1240
1241 lo = add_layout("playpause")1241 lo = add_layout("play_pause")
1242 lo.geometry =1242 lo.geometry =
1243 {x = posX, y = bigbtnrowY, an = 5, w = 40, h = 40}1243 {x = posX, y = bigbtnrowY, an = 5, w = 40, h = 40}
1244 lo.style = osc_styles.bigButtons1244 lo.style = osc_styles.bigButtons
1245 1245
1246 lo = add_layout("skipback")1246 lo = add_layout("skip_backward")
1247 lo.geometry =1247 lo.geometry =
1248 {x = posX - bigbtndist, y = bigbtnrowY, an = 5, w = 40, h = 40}1248 {x = posX - bigbtndist, y = bigbtnrowY, an = 5, w = 40, h = 40}
1249 lo.style = osc_styles.bigButtons1249 lo.style = osc_styles.bigButtons
1250 1250
1251 lo = add_layout("skipfrwd")1251 lo = add_layout("skip_forward")
1252 lo.geometry =1252 lo.geometry =
1253 {x = posX + bigbtndist, y = bigbtnrowY, an = 5, w = 40, h = 40}1253 {x = posX + bigbtndist, y = bigbtnrowY, an = 5, w = 40, h = 40}
1254 lo.style = osc_styles.bigButtons1254 lo.style = osc_styles.bigButtons
1255 1255
1256 lo = add_layout("ch_prev")1256 lo = add_layout("chapter_prev")
1257 lo.geometry =1257 lo.geometry =
1258 {x = posX - (bigbtndist * 2), y = bigbtnrowY, an = 5, w = 40, h = 40}1258 {x = posX - (bigbtndist * 2), y = bigbtnrowY, an = 5, w = 40, h = 40}
1259 lo.style = osc_styles.bigButtons1259 lo.style = osc_styles.bigButtons
1260 1260
1261 lo = add_layout("ch_next")1261 lo = add_layout("chapter_next")
1262 lo.geometry =1262 lo.geometry =
1263 {x = posX + (bigbtndist * 2), y = bigbtnrowY, an = 5, w = 40, h = 40}1263 {x = posX + (bigbtndist * 2), y = bigbtnrowY, an = 5, w = 40, h = 40}
1264 lo.style = osc_styles.bigButtons1264 lo.style = osc_styles.bigButtons
1265 1265
1266 lo = add_layout("cy_audio")1266 lo = add_layout("audio_track")
1267 lo.geometry =1267 lo.geometry =
1268 {x = posX - pos_offsetX, y = bigbtnrowY, an = 1, w = 70, h = 18}1268 {x = posX - pos_offsetX, y = bigbtnrowY, an = 1, w = 70, h = 18}
1269 lo.style = osc_styles.smallButtonsL1269 lo.style = osc_styles.smallButtonsL
1270 1270
1271 lo = add_layout("cy_sub")1271 lo = add_layout("sub_track")
1272 lo.geometry =1272 lo.geometry =
1273 {x = posX - pos_offsetX, y = bigbtnrowY, an = 7, w = 70, h = 18}1273 {x = posX - pos_offsetX, y = bigbtnrowY, an = 7, w = 70, h = 18}
1274 lo.style = osc_styles.smallButtonsL1274 lo.style = osc_styles.smallButtonsL
@@ -1511,12 +1511,12 @@ local function bar_layout(direction) · 236 unmodified lines
1511 -- Playlist prev/next1511 -- Playlist prev/next
1512 geo = { x = osc_geo.x + padX, y = line1,1512 geo = { x = osc_geo.x + padX, y = line1,
1513 an = 4, w = 18, h = 18 - padY }1513 an = 4, w = 18, h = 18 - padY }
1514 lo = add_layout("pl_prev")1514 lo = add_layout("playlist_prev")
1515 lo.geometry = geo1515 lo.geometry = geo
1516 lo.style = osc_styles.topButtonsBar1516 lo.style = osc_styles.topButtonsBar
1517 1517
1518 geo = { x = geo.x + geo.w + padX, y = geo.y, an = geo.an, w = geo.w, h = geo.h }1518 geo = { x = geo.x + geo.w + padX, y = geo.y, an = geo.an, w = geo.w, h = geo.h }
1519 lo = add_layout("pl_next")1519 lo = add_layout("playlist_next")
1520 lo.geometry = geo1520 lo.geometry = geo
1521 lo.style = osc_styles.topButtonsBar1521 lo.style = osc_styles.topButtonsBar
1522 1522
@@ -1544,17 +1544,17 @@ local function bar_layout(direction) · 21 unmodified lines
1544 -- Playback control buttons1544 -- Playback control buttons
1545 geo = { x = osc_geo.x + padX + padwc_l, y = line2, an = 4,1545 geo = { x = osc_geo.x + padX + padwc_l, y = line2, an = 4,
1546 w = buttonW, h = 36 - padY*2}1546 w = buttonW, h = 36 - padY*2}
1547 lo = add_layout("playpause")1547 lo = add_layout("play_pause")
1548 lo.geometry = geo1548 lo.geometry = geo
1549 lo.style = osc_styles.smallButtonsBar1549 lo.style = osc_styles.smallButtonsBar
1550 1550
1551 geo = { x = geo.x + geo.w + padX, y = geo.y, an = geo.an, w = geo.w, h = geo.h }1551 geo = { x = geo.x + geo.w + padX, y = geo.y, an = geo.an, w = geo.w, h = geo.h }
1552 lo = add_layout("ch_prev")1552 lo = add_layout("chapter_prev")
1553 lo.geometry = geo1553 lo.geometry = geo
1554 lo.style = osc_styles.smallButtonsBar1554 lo.style = osc_styles.smallButtonsBar
1555 1555
1556 geo = { x = geo.x + geo.w + padX, y = geo.y, an = geo.an, w = geo.w, h = geo.h }1556 geo = { x = geo.x + geo.w + padX, y = geo.y, an = geo.an, w = geo.w, h = geo.h }
1557 lo = add_layout("ch_next")1557 lo = add_layout("chapter_next")
1558 lo.geometry = geo1558 lo.geometry = geo
1559 lo.style = osc_styles.smallButtonsBar1559 lo.style = osc_styles.smallButtonsBar
1560 1560
@@ -1582,12 +1582,12 @@ local function bar_layout(direction) · 21 unmodified lines
1582 1582
1583 -- Track selection buttons1583 -- Track selection buttons
1584 geo = { x = geo.x - tsW - padX, y = geo.y, an = geo.an, w = tsW, h = geo.h }1584 geo = { x = geo.x - tsW - padX, y = geo.y, an = geo.an, w = tsW, h = geo.h }
1585 lo = add_layout("cy_sub")1585 lo = add_layout("sub_track")
1586 lo.geometry = geo1586 lo.geometry = geo
1587 lo.style = osc_styles.smallButtonsBar1587 lo.style = osc_styles.smallButtonsBar
1588 1588
1589 geo = { x = geo.x - geo.w - padX, y = geo.y, an = geo.an, w = geo.w, h = geo.h }1589 geo = { x = geo.x - geo.w - padX, y = geo.y, an = geo.an, w = geo.w, h = geo.h }
1590 lo = add_layout("cy_audio")1590 lo = add_layout("audio_track")
1591 lo.geometry = geo1591 lo.geometry = geo
1592 lo.style = osc_styles.smallButtonsBar1592 lo.style = osc_styles.smallButtonsBar
1593 1593
@@ -1715,7 +1715,7 @@ local function osc_init() · 121 unmodified lines
1715 -- playlist buttons1715 -- playlist buttons
1716 1716
1717 -- prev1717 -- prev
1718 ne = new_element("pl_prev", "button")1718 ne = new_element("playlist_prev", "button")
1719 1719
1720 ne.content = "\238\132\144"1720 ne.content = "\238\132\144"
1721 ne.enabled = (pl_pos > 1) or (loop ~= "no")1721 ne.enabled = (pl_pos > 1) or (loop ~= "no")
@@ -1732,7 +1732,7 @@ local function osc_init() · 10 unmodified lines
1732 function () mp.command("show-text ${playlist} 3000") end1732 function () mp.command("show-text ${playlist} 3000") end
1733 1733
1734 --next1734 --next
1735 ne = new_element("pl_next", "button")1735 ne = new_element("playlist_next", "button")
1736 1736
1737 ne.content = "\238\132\129"1737 ne.content = "\238\132\129"
1738 ne.enabled = (have_pl and (pl_pos < pl_count)) or (loop ~= "no")1738 ne.enabled = (have_pl and (pl_pos < pl_count)) or (loop ~= "no")
@@ -1751,8 +1751,8 @@ local function osc_init() · 12 unmodified lines
1751 1751
1752 -- big buttons1752 -- big buttons
1753 1753
1754 --playpause1754 --play_pause
1755 ne = new_element("playpause", "button")1755 ne = new_element("play_pause", "button")
1756 1756
1757 ne.content = function ()1757 ne.content = function ()
1758 if mp.get_property("pause") == "yes" then1758 if mp.get_property("pause") == "yes" then
@@ -1768,8 +1768,8 @@ local function osc_init() · 9 unmodified lines
1768 ne.eventresponder["mbtn_left_up"] =1768 ne.eventresponder["mbtn_left_up"] =
1769 function () mp.commandv("cycle", "pause") end1769 function () mp.commandv("cycle", "pause") end
1770 1770
1771 --skipback1771 --skip_backward
1772 ne = new_element("skipback", "button")1772 ne = new_element("skip_backward", "button")
1773 1773
1774 ne.softrepeat = true1774 ne.softrepeat = true
1775 ne.content = "\238\128\132"1775 ne.content = "\238\128\132"
@@ -1780,8 +1780,8 @@ local function osc_init() · 4 unmodified lines
1780 ne.eventresponder["mbtn_right_down"] =1780 ne.eventresponder["mbtn_right_down"] =
1781 function () mp.commandv("seek", -30) end1781 function () mp.commandv("seek", -30) end
1782 1782
1783 --skipfrwd1783 --skip_forward
1784 ne = new_element("skipfrwd", "button")1784 ne = new_element("skip_forward", "button")
1785 1785
1786 ne.softrepeat = true1786 ne.softrepeat = true
1787 ne.content = "\238\128\133"1787 ne.content = "\238\128\133"
@@ -1792,8 +1792,8 @@ local function osc_init() · 4 unmodified lines
1792 ne.eventresponder["mbtn_right_down"] =1792 ne.eventresponder["mbtn_right_down"] =
1793 function () mp.commandv("seek", 60) end1793 function () mp.commandv("seek", 60) end
1794 1794
1795 --ch_prev1795 --chapter_prev
1796 ne = new_element("ch_prev", "button")1796 ne = new_element("chapter_prev", "button")
1797 1797
1798 ne.enabled = have_ch1798 ne.enabled = have_ch
1799 ne.content = "\238\132\132"1799 ne.content = "\238\132\132"
@@ -1810,8 +1810,8 @@ local function osc_init() · 10 unmodified lines
1810 mp.command("script-binding select/select-chapter; script-message-to osc osc-hide")1810 mp.command("script-binding select/select-chapter; script-message-to osc osc-hide")
1811 end1811 end
1812 1812
1813 --ch_next1813 --chapter_next
1814 ne = new_element("ch_next", "button")1814 ne = new_element("chapter_next", "button")
1815 1815
1816 ne.enabled = have_ch1816 ne.enabled = have_ch
1817 ne.content = "\238\132\133"1817 ne.content = "\238\132\133"
@@ -1831,8 +1831,8 @@ local function osc_init() · 13 unmodified lines
1831 --1831 --
1832 update_tracklist()1832 update_tracklist()
1833 1833
1834 --cy_audio1834 --audio_track
1835 ne = new_element("cy_audio", "button")1835 ne = new_element("audio_track", "button")
1836 1836
1837 ne.enabled = audio_track_count > 01837 ne.enabled = audio_track_count > 0
1838 ne.content = function ()1838 ne.content = function ()
@@ -1854,8 +1854,8 @@ local function osc_init() · 15 unmodified lines
1854 function () mp.command("cycle audio down") end1854 function () mp.command("cycle audio down") end
1855 end1855 end
1856 1856
1857 --cy_sub1857 --sub_track
1858 ne = new_element("cy_sub", "button")1858 ne = new_element("sub_track", "button")
1859 1859
1860 ne.enabled = sub_track_count > 01860 ne.enabled = sub_track_count > 0
1861 ne.content = function ()1861 ne.content = function ()

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