feat: implement controls bar

Also includes a lot of refactoring around codebase to make it work as needed.

Notable addition: new `items` command that displays playlist if any, or open-file otherwise.

ref #167, closes #71
This commit is contained in:
tomasklaen
2022-09-06 19:35:59 +02:00
parent 468fadff0f
commit fa1b2112ec
3 changed files with 798 additions and 436 deletions

View File

@@ -182,6 +182,10 @@ Switch stream quality. This is just a basic re-assignment of `ytdl-format` mpv p
Open file menu. Browsing starts in current file directory, or user directory when file not available. Open file menu. Browsing starts in current file directory, or user directory when file not available.
#### `items`
Opens `playlist` menu when playlist exists, or `open-file` menu otherwise.
#### `next` #### `next`
Open next item in playlist, or file in current directory when there is no playlist. Open next item in playlist, or file in current directory when there is no playlist.

View File

@@ -14,7 +14,7 @@ timeline_size_min_fullscreen=0
timeline_size_max_fullscreen=60 timeline_size_max_fullscreen=60
# same thing as calling toggle-progress command once on startup # same thing as calling toggle-progress command once on startup
timeline_start_hidden=no timeline_start_hidden=no
# comma separated states when timeline should always be visible. available: paused, audio # comma separated states when timeline should always be visible. available: paused, audio, image, video
timeline_persistency= timeline_persistency=
# timeline opacity # timeline opacity
timeline_opacity=0.9 timeline_opacity=0.9
@@ -32,6 +32,52 @@ timeline_chapters=dots
timeline_chapters_opacity=0.2 timeline_chapters_opacity=0.2
timeline_chapters_width=6 timeline_chapters_width=6
# A comma delimited list of elements to construct the controls bar above the timeline. Set to `never` to disable.
# Parameter spec: enclosed in `{}` means value, enclosed in `[]` means optional
# Common properties:
# `{icon}` - parameter used to specify an icon name (example: `face`)
# - you can pick one here: https://fonts.google.com/icons?selected=Material+Icons
# Available elements and their parameters:
# `{usoc_command}` - preconfigured shorthands for uosc commands that make sense to have as buttons:
# - `menu`, `subtitles`, `audio`, `video`, `playlist`, `chapters`, `stream-quality`,
# `open-file`, `items`, `next`, `prev`, `first`, `last`, `audio-device`
# `fullscreen` - toggle fullscreen
# `loop-playlist` - button to toggle playlist looping
# `loop-file` - button to toggle current file looping
# `speed[:{scale}]` - display speed slider, [{scale}] - factor of controls_size, default: 1.3
# `command:{icon}:{command}` - button that executes a {command} when pressed
# `toggle:{icon}:{prop}` - button that toggles mpv property
# `cycle:{default_icon}:{prop}:{value1}[={icon1}][!]/{valueN}[={iconN}][!]`
# - button that cycles mpv property between values, each optionally having different icon and active flag
# - presence of `!` at the end will style the button as active
# `gap[:{scale}]` - display an empty gap, {scale} - factor of controls_size, default: 0.3
# `space` - fills all available space between previous and next item, useful to align items to the right
# - multiple spaces divide the available space among themselves, which can be used for centering
# Example implementations of some of the shorthands:
# - menu: `command:menu:script-binding uosc/menu`
# - fullscreen: `cycle:fullscreen:fullscreen:no/yes=fullscreen_exit!`
# - loop-playlist: `cycle:repeat:loop-playlist:no/inf!`
# - `toggle:{icon}:{prop}`: `cycle:{icon}:{prop}:no/yes!`
# Element visibility control:
# `<[!]{disposition1}[,[!]{dispositionN}]>` - optional prefix to control element's visibility
# - `{disposition}` can be one of:
# - `image` - true if current file is a single image
# - `audio` - true for audio only files
# - `video` - true for files with a video track
# - `has_audio` - true for files with an audio track
# - `stream` - true if current file is read from a stream
# - `has_playlist` - true if current playlist has 2 or more items in it
# - prefix with `!` to negate the required disposition
# Examples:
# - `<stream>stream-quality` - show stream quality button only for streams
# - `<has_audio,!audio>audio` - show audio tracks button for all files that have
# an audio track, but are not exclusively audio only files
controls=menu,gap,subtitles,<has_audio,!audio>audio,<stream>stream-quality,gap,loop-playlist,loop-file,space,speed,space,prev,items,next,shuffle,gap:1,fullscreen
controls_size=32
controls_size_fullscreen=40
controls_margin=8
controls_spacing=2
# where to display volume controls: none, left, right # where to display volume controls: none, left, right
volume=right volume=right
volume_size=40 volume_size=40
@@ -63,15 +109,6 @@ menu_opacity=0.8
menu_parent_opacity=0.4 menu_parent_opacity=0.4
menu_font_scale=1 menu_font_scale=1
# menu button widget
# can be: never, bottom-bar, center
menu_button=never
menu_button_size=26
menu_button_size_fullscreen=30
menu_button_persistency=
menu_button_opacity=1
menu_button_border=1
# top bar with window controls and media title # top bar with window controls and media title
# can be: never, no-border, always # can be: never, no-border, always
top_bar=no-border top_bar=no-border

File diff suppressed because it is too large Load Diff