-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
{select,osc}.lua: add a miscellaneous menu #15499
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,16 @@ | ||||||
Steps to add new icons: | ||||||
|
||||||
- Install `fontforge` | ||||||
- Install the last freely licensed version of symbola (`ttf-symbola-free` in the | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would remove this step from readme, source font for symbols can be different. You can mention in separate paragraph, that some glyphs in are extracted from symbola font. |
||||||
AUR) | ||||||
- `fontforge /usr/share/fonts/TTF/Symbola.ttf TOOLS/mpv-osd-symbols.sfdir` | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Load a font and the project directory, for example: |
||||||
- Check the Unicode hex value of the desired character (`g-a` in vim) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Aren't there symbol table in FontForge? I think I've seen it. |
||||||
- Scroll until that value in the Symbola window and click it | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
- Press Ctrl+c | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Describe the action, for example. Not only "press".
|
||||||
- Focus the window with TOOLS/mpv-osd-symbols.sfdir | ||||||
- Click an unused character slot | ||||||
- Press Ctrl+v | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
- Press Ctrl+s | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Save |
||||||
- Close fontforge | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This step is probably not really needed to explain |
||||||
- Figure out the Lua sequence of the new character by copying that of the | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instruction unclear. Either don't say anything and expect it is clear, or make it explicit. I think what you are saying here, is to convert Unicode code point to utf-8 chars. |
||||||
previous character and incrementing the last 3 digits | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You could also mention |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
StartChar: uniE102 | ||
Encoding: 57602 57602 35 | ||
Width: 2048 | ||
VWidth: 2048 | ||
Flags: HW | ||
LayerCount: 2 | ||
Fore | ||
SplineSet | ||
1724 1060 m 1 | ||
324 1060 l 1 | ||
324 1252 l 1 | ||
1724 1252 l 1 | ||
1724 1060 l 1 | ||
1724 636 m 1 | ||
324 636 l 1 | ||
324 828 l 1 | ||
1724 828 l 1 | ||
1724 636 l 1 | ||
1724 212 m 1 | ||
324 212 l 1 | ||
324 404 l 1 | ||
1724 404 l 1 | ||
1724 212 l 1 | ||
EndSplineSet | ||
EndChar |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -427,3 +427,58 @@ mp.add_key_binding(nil, "show-properties", function () | |
end, | ||
}) | ||
end) | ||
|
||
mp.add_key_binding(nil, "menu", function () | ||
local sub_track_count = 0 | ||
local audio_track_count = 0 | ||
local video_track_count = 0 | ||
local text_sub_selected = false | ||
|
||
local image_sub_codecs = {["dvd_subtitle"] = true, ["hdmv_pgs_subtitle"] = true} | ||
|
||
for _, track in pairs(mp.get_property_native("track-list")) do | ||
if track.type == "sub" then | ||
sub_track_count = sub_track_count + 1 | ||
if track["main-selection"] == 0 and not image_sub_codecs[track.codec] then | ||
text_sub_selected = true | ||
end | ||
elseif track.type == "audio" then | ||
audio_track_count = audio_track_count + 1 | ||
elseif track.type == "video" then | ||
video_track_count = video_track_count + 1 | ||
end | ||
end | ||
|
||
local menu = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't this list all select? Especially why vid select is hidden? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because I saw uosc doesn't have it so I didn't if it's worth adding. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Of course they has it. In UOSC each button is dynamic and show only when needed. See https://github.com/tomasklaen/uosc/blob/6a1c0e9c6e7e9e43cda1c1ea3e44a911fae45927/src/uosc.conf#L83C1-L83C211 specifically, This menu could do this too, to not show items that goes nowhere. |
||
{"Subtitles", "script-binding select/select-sid", sub_track_count > 0}, | ||
{"Secondary subtitles", "script-binding select/select-secondary-sid", sub_track_count > 1}, | ||
{"Subtitle lines", "script-binding select/select-subtitle-line", text_sub_selected}, | ||
{"Audio tracks", "script-binding select/select-aid", audio_track_count > 1}, | ||
{"Video tracks", "script-binding select/select-vid", video_track_count > 1}, | ||
{"Playlist", "script-binding select/select-playlist", | ||
mp.get_property_native("playlist-count") > 1}, | ||
{"Chapters", "script-binding select/select-chapter", mp.get_property("chapter")}, | ||
{"Editions/Titles", "script-binding select/select-edition", | ||
mp.get_property_native("edition-list/count", 0) > 1}, | ||
{"Audio devices", "script-binding select/select-audio-device", audio_track_count > 0}, | ||
{"Key bindings", "script-binding select/select-binding", true}, | ||
} | ||
|
||
local labels = {} | ||
local commands = {} | ||
|
||
for _, entry in ipairs(menu) do | ||
if entry[3] then | ||
labels[#labels + 1] = entry[1] | ||
commands[#commands + 1] = entry[2] | ||
end | ||
end | ||
|
||
input.select({ | ||
prompt = "", | ||
items = labels, | ||
submit = function (i) | ||
mp.command(commands[i]) | ||
end, | ||
}) | ||
end) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.