You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried creating a modified font with the tethys play icon. I installed it to the local user using KFontView. Then I placed {\\fn(tethys-osd-symbols)}} in front of the playpause icon contents. It doesn't appear to have worked. Creating a custom font and distributing it is too complicated anyways, but was an annoying setback.
I tried taking the path in the SVG and placing it there. Unfortunately, the SVG path is a little different. I noticed that mpv used the b command which doesn't appear in the mozilla docs.
However even if we assume the b is the same as a bezier curve, the SVG path uses delta c coordinates instead of absolute C coordinates which is what the b seems to be using.
localtethys_icon_play= {
"{\\c&HC0C0C0&\\p1}m 31 21 b 34 23 34 24 31 26 b 21 33 12 39 10 39 b 8 39 8 36 8 23.5 b 8 12 8 9 10 9 b 12 9 21 14 31 21{\\p0}",
}
As a final note, it seems the {\\p1} stands for scale. The mpv/santa hat icons use {\\p6} which I assume stands for 1/6th scale since the coordinates given are huge (401 10 0 410 0 905). I needed to change it to 1/1 scale to even see my 44x44 icon.
Edit: I wrote a python3 script icons/svgtohtmltoluapath.py to convert the svg to a html, then scrape the path and print it to the terminal to copy with Ctrl+Shift+C.
Edit: I just figured out that I can add m 0 0 m 44 44 in front of the path to create a "viewbox" around the icon so that the icon retains the whitespace around it when aligned. This is particularly important when dealing with the volume icons as their width changes. Up till now we couldn't use a center alignment for the volume icon, but instead used center-left to keep the "speaker" from as volume went up/down.
and the following setter to adjust the tooltip based on how close to the window edge it is.
localbuttonTooltipStyle= ("{\\blur0\\bord(1)\\1c&HFFFFFF\\3c&H000000\\fs(%d)}"):format(24)
functionsetButtonTooltip(button_lo, text)
button_lo.button.tooltip=textbutton_lo.button.tooltip_style=buttonTooltipStylelocalhw=button_lo.geometry.w/2localty=osc_geo.y+padY*directionlocalanlocaltxlocaledgeThreshold=60ifbutton_lo.geometry.x-edgeThreshold<osc_geo.x+padXthenan=1-- x,y is bottom-lefttx=math.max(osc_geo.x+padX, button_lo.geometry.x-hw)
elseifosc_geo.x+osc_geo.w-padX<button_lo.geometry.x+edgeThresholdthenan=3-- x,y is bottom-righttx=math.min(button_lo.geometry.x+hw, osc_geo.x+osc_geo.w-padX)
elsean=2-- x,y is bottom-centertx=button_lo.geometry.xendbutton_lo.button.tooltip_an=anbutton_lo.button.tooltip_geo= { x=tx , y=ty }
end
Right now, the tooltips are very basic. I'll need to work improving them to have a rounded bg and support multiple lines of text since MPV has multiple actions like Left navigating 10s and Shift+Left navigating 1s.
Track Selection
It would be cool to create a merged audio/subtitle button with a popup like Netflix. Might be too complicated to have multiple generated lists of buttons though.
Edit: For now, I still use the mpv icons for tracks since the buttons are beside text. They also look good too.
Playlist
Since mpv has seek fwd/back and chapter next/prev buttons, I've moved the playlist next/prev buttons to the right side like Netflix.
Edit: I tried showing next/prev file thumbnails, but I found that it was more spoilerly than when on a website that takes a few seconds to load so you can move your mouse. Also, the thumbnails were generated on the fly in a blocking manner which made any delay before showing the tooltip feel annoying. I might revisit this if I modify the thumbnail server script to support playlist file thumbnails.
Seekbar Thumbnails
Edit: After first trying to simplify mpv_thumbnail_script so that only one lua script was needed, I eventually gave up and just implemented the awesome mpv_thumbnail_script's Thumbnailer. I'm bundling the server.lua in this repo since the upstream repo has a bug in the last release (It's been fixed but there's no new release).
The text was updated successfully, but these errors were encountered:
Initially written up in Zren/mpvz#13
Here's the base
osc.lua
we can copy to~/.config/mpv/scripts/osc.lua
.Then I added this to
~/.config/mpv/mpv.conf
Layout
I created a new layout section based on
bottombar
.I basically ended doing the buttons like so:
an
stands for alignment, which adds{\\an(5)}
to the ass text.1
means the (x,y) is the bottom-left,4
iscenter-left
,7
is top-left.5
is center and9
is top-right.Icons
mpv-osd-symbols
font is bundled, and basically forced for the OSD.{\\fn(tethys-osd-symbols)}}
in front of the playpause icon contents. It doesn't appear to have worked. Creating a custom font and distributing it is too complicated anyways, but was an annoying setback.Eventually I noticed the mpv icon (and santa hat during December) when mpv is launched with no video is drawn using a path!
I tried taking the path in the SVG and placing it there. Unfortunately, the SVG path is a little different. I noticed that mpv used the
b
command which doesn't appear in the mozilla docs.However even if we assume the
b
is the same as a bezier curve, the SVG path uses deltac
coordinates instead of absoluteC
coordinates which is what theb
seems to be using.I ended up needing to export the svg as an
.html
file with Inkscape, then manually convertto the following path:
As a final note, it seems the
{\\p1}
stands for scale. The mpv/santa hat icons use{\\p6}
which I assume stands for 1/6th scale since the coordinates given are huge (401 10 0 410 0 905
). I needed to change it to 1/1 scale to even see my 44x44 icon.Edit: I wrote a python3 script
icons/svgtohtmltoluapath.py
to convert the svg to a html, then scrape the path and print it to the terminal to copy withCtrl+Shift+C
.Edit: I just figured out that I can add
m 0 0 m 44 44
in front of the path to create a "viewbox" around the icon so that the icon retains the whitespace around it when aligned. This is particularly important when dealing with the volume icons as their width changes. Up till now we couldn't use a center alignment for the volume icon, but instead used center-left to keep the "speaker" from as volume went up/down.More can be found out in the master...iconrefactor branch.
Hover Effect
mpv doesn't have any hover animations, the only hover effect is for the seekbar timestamp.
I Managed to create a hover effect by adding the following to the bottom of
render_elements()
under thebutton
section.{{\\blur0}}
formatting accepts a value between0
and20
.Tooltips
I added rough tooltips by adding this to
render_elements()
under thebutton
section.and the following setter to adjust the tooltip based on how close to the window edge it is.
Right now, the tooltips are very basic. I'll need to work improving them to have a rounded bg and support multiple lines of text since MPV has multiple actions like
Left
navigating 10s andShift+Left
navigating 1s.Track Selection
It would be cool to create a merged audio/subtitle button with a popup like Netflix. Might be too complicated to have multiple generated lists of buttons though.
Edit: For now, I still use the mpv icons for tracks since the buttons are beside text. They also look good too.
Playlist
Since mpv has seek fwd/back and chapter next/prev buttons, I've moved the playlist next/prev buttons to the right side like Netflix.
Edit: I tried showing next/prev file thumbnails, but I found that it was more spoilerly than when on a website that takes a few seconds to load so you can move your mouse. Also, the thumbnails were generated on the fly in a blocking manner which made any delay before showing the tooltip feel annoying. I might revisit this if I modify the thumbnail server script to support playlist file thumbnails.
Seekbar Thumbnails
Edit: After first trying to simplify mpv_thumbnail_script so that only one lua script was needed, I eventually gave up and just implemented the awesome mpv_thumbnail_script's Thumbnailer. I'm bundling the
server.lua
in this repo since the upstream repo has a bug in the last release (It's been fixed but there's no new release).The text was updated successfully, but these errors were encountered: