Simplify command names

This commit is contained in:
Tomas Sardyha
2020-04-29 18:20:12 +02:00
parent f3930ce864
commit 676dcd672b
2 changed files with 39 additions and 39 deletions

View File

@@ -210,33 +210,33 @@ Expands the bottom timeline until pressed again, or next mouse move. Useful to c
Toggles the always visible portion of the timeline. You can look at it as switching `timeline_size_min` option between it's configured value and 0.
#### `context-menu`
#### `menu`
Toggles context menu. Context menu is empty by default and won't show up when this is pressed. Read [Context menu](#context-menu-1) section below to find out how to fill it up with items you want there.
Toggles menu. Menu is empty by default and won't show up when this is pressed. Read [Menu](#menu-1) section below to find out how to fill it up with items you want there.
#### `load-subtitles`
Displays a file explorer with directory navigation to load external subtitles. Explorer only displays file types defined in `subtitle_types` option.
#### `select-subtitles`
#### `subtitles`
Menu to select a subtitle track.
#### `select-audio`
#### `audio`
Menu to select an audio track.
#### `select-video`
#### `video`
Menu to select a video track.
#### `navigate-playlist`
#### `playlist`
Menu to select an item from playlist.
Playlist navigation.
#### `navigate-chapters`
#### `chapters`
Menu to seek to start of a specific chapter.
Chapter navigation.
#### `open-file`
@@ -276,15 +276,15 @@ Show current file in your operating systems' file explorer.
Open directory with `mpv.conf` in file explorer.
## Context menu
## Menu
**uosc** provides a way to build, display, and use your own context menu. Limitation is that the UI rendering API provided by mpv can only render stuff within window borders, so the menu can't float above it but needs to fit inside. This might be annoying for tiny videos but otherwise it accomplishes the same thing.
**uosc** provides a way to build, display, and use your own menu. Limitation is that the UI rendering API provided by mpv can only render stuff within window borders, so the menu can't float above it but needs to fit inside. This might be annoying for tiny videos but otherwise it accomplishes the same thing.
To display the menu, add **uosc**'s `context-menu` command to a key of your choice. Example to bind it to **right click** and **menu** buttons:
To display the menu, add **uosc**'s `menu` command to a key of your choice. Example to bind it to **right click** and **menu** buttons:
```
mbtn_right script-binding uosc/context-menu
menu script-binding uosc/context-menu
mbtn_right script-binding uosc/menu
menu script-binding uosc/menu
```
***menu** button is the key between **win** and **right_ctrl** buttons that none uses (might not be on your keyboard).*
@@ -333,15 +333,15 @@ q quit #!
Suggested minimal context menu setup to start with:
```
menu script-binding uosc/context-menu
mbtn_right script-binding uosc/context-menu
menu script-binding uosc/menu
mbtn_right script-binding uosc/menu
o script-binding uosc/open-file #! Open file
alt+s script-binding uosc/load-subtitles #! Load subtitles
S script-binding uosc/select-subtitles #! Select subtitles
A script-binding uosc/select-audio #! Select audio
S script-binding uosc/subtitles #! Select subtitles
A script-binding uosc/audio #! Select audio
ctrl+s async screenshot #! Utils > Screenshot
P script-binding uosc/navigate-playlist #! Utils > Navigate playlist
C script-binding uosc/navigate-chapters #! Utils > Navigate chapters
P script-binding uosc/playlist #! Utils > Playlist
C script-binding uosc/chapters #! Utils > Chapters
# script-binding uosc/open-config-directory #! Utils > Open config directory
# set video-aspect-override "-1" #! Aspect ratio > Default
# set video-aspect-override "16:9" #! Aspect ratio > 16:9

View File

@@ -148,13 +148,13 @@ Available keybindings (place into `input.conf`):
```
Key script-binding uosc/peek-timeline
Key script-binding uosc/toggle-progress
Key script-binding uosc/context-menu
Key script-binding uosc/menu
Key script-binding uosc/load-subtitles
Key script-binding uosc/select-subtitles
Key script-binding uosc/select-audio
Key script-binding uosc/select-video
Key script-binding uosc/navigate-playlist
Key script-binding uosc/navigate-chapters
Key script-binding uosc/subtitles
Key script-binding uosc/audio
Key script-binding uosc/video
Key script-binding uosc/playlist
Key script-binding uosc/chapters
Key script-binding uosc/open-file
Key script-binding uosc/next-file
Key script-binding uosc/prev-file
@@ -789,7 +789,7 @@ function Menu:open(items, open_item, opts)
elements:add('menu', Element.new({
captures = {mouse_buttons = true},
type = nil, -- menu type such as `context-menu`, `navigate-chapters`, ...
type = nil, -- menu type such as `menu`, `chapters`, ...
title = nil,
width = nil,
height = nil,
@@ -2967,13 +2967,13 @@ mp.add_key_binding(nil, 'toggle-progress', function()
timeline:tween_property('size_min_override', timeline.size_min, 0)
end
end)
mp.add_key_binding(nil, 'context-menu', function()
if menu:is_open('context-menu') then
mp.add_key_binding(nil, 'menu', function()
if menu:is_open('menu') then
menu:close()
elseif state.context_menu_items then
menu:open(state.context_menu_items, function(command)
mp.command(command)
end, {type = 'context-menu'})
end, {type = 'menu'})
end
end)
mp.add_key_binding(nil, 'load-subtitles', function()
@@ -2989,10 +2989,10 @@ mp.add_key_binding(nil, 'load-subtitles', function()
)
end
end)
mp.add_key_binding(nil, 'select-subtitles', create_select_tracklist_type_menu_opener('Subtitles', 'sub', 'sid'))
mp.add_key_binding(nil, 'select-audio', create_select_tracklist_type_menu_opener('Audio', 'audio', 'aid'))
mp.add_key_binding(nil, 'select-video', create_select_tracklist_type_menu_opener('Video', 'video', 'vid'))
mp.add_key_binding(nil, 'navigate-playlist', function()
mp.add_key_binding(nil, 'subtitles', create_select_tracklist_type_menu_opener('Subtitles', 'sub', 'sid'))
mp.add_key_binding(nil, 'audio', create_select_tracklist_type_menu_opener('Audio', 'audio', 'aid'))
mp.add_key_binding(nil, 'video', create_select_tracklist_type_menu_opener('Video', 'video', 'vid'))
mp.add_key_binding(nil, 'playlist', function()
function serialize_playlist()
local pos = mp.get_property_number('playlist-pos-1', 0)
local items = {}
@@ -3012,7 +3012,7 @@ mp.add_key_binding(nil, 'navigate-playlist', function()
-- Update active index and playlist content on playlist changes
function handle_playlist_change()
if menu:is_open('navigate-playlist') then
if menu:is_open('playlist') then
local items, active_item = serialize_playlist()
elements.menu:set_items(items, {
active_item = active_item,
@@ -3026,7 +3026,7 @@ mp.add_key_binding(nil, 'navigate-playlist', function()
menu:open(items, function(index)
mp.commandv('set', 'playlist-pos-1', tostring(index))
end, {
type = 'navigate-playlist',
type = 'playlist',
title = 'Playlist',
active_item = active_item,
on_open = function()
@@ -3038,7 +3038,7 @@ mp.add_key_binding(nil, 'navigate-playlist', function()
end,
})
end)
mp.add_key_binding(nil, 'navigate-chapters', function()
mp.add_key_binding(nil, 'chapters', function()
local items = {}
local chapters = get_normalized_chapters()
@@ -3062,7 +3062,7 @@ mp.add_key_binding(nil, 'navigate-chapters', function()
-- Update selected chapter in chapter navigation menu
function seek_handler()
if menu:is_open('navigate-chapters') then
if menu:is_open('chapters') then
elements.menu:activate_index(get_selected_chapter_index())
end
end
@@ -3070,7 +3070,7 @@ mp.add_key_binding(nil, 'navigate-chapters', function()
menu:open(items, function(time)
mp.commandv('seek', tostring(time), 'absolute')
end, {
type = 'navigate-chapters',
type = 'chapters',
title = 'Chapters',
active_item = get_selected_chapter_index(),
on_open = function() mp.register_event('seek', seek_handler) end,