Skip to content

Commit

Permalink
osc.lua: add an icon for the miscellaneous menu
Browse files Browse the repository at this point in the history
Add the generic menu to bar layouts to provide discoverability for the
select menus to users who don't realize you can right click OSC buttons.

There's no space to add it in box layout.
  • Loading branch information
guidocella committed Jan 8, 2025
1 parent 842bb48 commit 73d6385
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 6 deletions.
13 changes: 12 additions & 1 deletion DOCS/man/osc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ The Interface
::

+---------+----------+------------------------------------------+----------+
| pl prev | pl next | title | cache |
| pl prev | menu | pl next | title cache |
+------+--+---+------+---------+-----------+------+-------+-----+-----+----+
| play | skip | skip | time | seekbar | time | audio | sub | vol | fs |
| | back | frwd | elapsed | | left | | | | |
Expand All @@ -36,6 +36,11 @@ pl prev
right-click open the playlist selector
============= ================================================

menu
============= ================================================
left-click open the menu
============= ================================================

pl next
============= ================================================
left-click play next file in playlist
Expand Down Expand Up @@ -514,6 +519,12 @@ clicked. ``mbtn_mid`` commands are also triggered with ``shift+mbtn_left``.

``playlist_prev_mbtn_right_command=script-binding select/select-playlist; script-message-to osc osc-hide``

``menu_mbtn_left_command=script-binding select/menu; script-message-to osc osc-hide``

``menu_mbtn_mid_command=``

``menu_mbtn_right_command=``

``playlist_next_mbtn_left_command=playlist-next; show-text ${playlist} 3000``

``playlist_next_mbtn_mid_command=show-text ${playlist} 3000``
Expand Down
25 changes: 20 additions & 5 deletions player/lua/osc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ local user_opts = {
playlist_prev_mbtn_mid_command = "show-text ${playlist} 3000",
playlist_prev_mbtn_right_command = "script-binding select/select-playlist; script-message-to osc osc-hide",

menu_mbtn_left_command = "script-binding select/menu; script-message-to osc osc-hide",
menu_mbtn_mid_command = "",
menu_mbtn_right_command = "",

playlist_next_mbtn_left_command = "playlist-next",
playlist_next_mbtn_mid_command = "show-text ${playlist} 3000",
playlist_next_mbtn_right_command = "script-binding select/select-playlist; script-message-to osc osc-hide",
Expand Down Expand Up @@ -135,6 +139,7 @@ local icon_font = "mpv-osd-symbols"
-- print(output)
local icons = {
prev = "\238\132\144", -- E110
menu = "\238\132\130", -- E102
next = "\238\132\129", -- E101
pause = "\238\128\130", -- E002
play = "\238\132\129", -- E101
Expand Down Expand Up @@ -1603,13 +1608,20 @@ local function bar_layout(direction, slim)
lo.alpha[1] = user_opts.boxalpha


-- Playlist prev/next
-- Playlist prev
geo = { x = osc_geo.x + padX, y = line1,
an = 4, w = 18, h = 18 - padY }
lo = add_layout("playlist_prev")
lo.geometry = geo
lo.style = osc_styles.topButtonsBar

-- Menu
geo = { x = geo.x + geo.w + padX, y = geo.y, an = geo.an, w = geo.w, h = geo.h }
lo = add_layout("menu")
lo.geometry = geo
lo.style = osc_styles.topButtonsBar

-- Playlist next
geo = { x = geo.x + geo.w + padX, y = geo.y, an = geo.an, w = geo.w, h = geo.h }
lo = add_layout("playlist_next")
lo.geometry = geo
Expand Down Expand Up @@ -1848,16 +1860,19 @@ local function osc_init()
end
bind_mouse_buttons("title")

-- playlist buttons

-- prev
-- playlist prev
ne = new_element("playlist_prev", "button")

ne.content = icons.prev
ne.enabled = (pl_pos > 1) or (loop ~= "no")
bind_mouse_buttons("playlist_prev")

--next
-- menu
ne = new_element("menu", "button")
ne.content = icons.menu
bind_mouse_buttons("menu")

-- playlist next
ne = new_element("playlist_next", "button")

ne.content = icons.next
Expand Down

0 comments on commit 73d6385

Please sign in to comment.