options.lua (8500B)
1 local utils = require 'mp.utils' 2 local opt = require 'mp.options' 3 4 ---@class options 5 local o = { 6 --root directories 7 root = "~/", 8 9 --automatically detect windows drives and adds them to the root. 10 auto_detect_windows_drives = true, 11 12 --characters to use as separators 13 root_separators = ",", 14 15 --number of entries to show on the screen at once 16 num_entries = 20, 17 18 --number of directories to keep in the history 19 history_size = 100, 20 21 --wrap the cursor around the top and bottom of the list 22 wrap = false, 23 24 --only show files compatible with mpv 25 filter_files = true, 26 27 --recurses directories concurrently when appending items to the playlist 28 concurrent_recursion = true, 29 30 --maximum number of recursions that can run concurrently 31 max_concurrency = 16, 32 33 --enable custom keybinds 34 custom_keybinds = true, 35 custom_keybinds_file = "~~/script-opts/file-browser-keybinds.json", 36 37 --blacklist compatible files, it's recommended to use this rather than to edit the 38 --compatible list directly. A comma separated list of extensions without spaces 39 extension_blacklist = "", 40 41 --add extra file extensions 42 extension_whitelist = "", 43 44 --files with these extensions will be added as additional audio tracks for the current file instead of appended to the playlist 45 audio_extensions = "mka,dts,dtshd,dts-hd,truehd,true-hd", 46 47 --files with these extensions will be added as additional subtitle tracks instead of appended to the playlist 48 subtitle_extensions = "etf,etf8,utf-8,idx,sub,srt,rt,ssa,ass,mks,vtt,sup,scc,smi,lrc,pgs", 49 50 --filter dot directories like .config 51 --most useful on linux systems 52 ---@type 'auto'|'yes'|'no' 53 filter_dot_dirs = 'auto', 54 ---@type 'auto'|'yes'|'no' 55 filter_dot_files = 'auto', 56 57 --substitute forward slashes for backslashes when appending a local file to the playlist 58 --potentially useful on windows systems 59 substitute_backslash = false, 60 61 --interpret backslashes `\` in paths as forward slashes `/` 62 --this is useful on Windows, which natively uses backslashes. 63 --As backslashes are valid filename characters in Unix systems this could 64 --cause mangled paths, though such filenames are rare. 65 --Use `yes` and `no` to enable/disable. `auto` tries to use the mpv `platform` 66 --property (mpv v0.36+) to decide. If the property is unavailable it defaults to `yes`. 67 ---@type 'auto'|'yes'|'no' 68 normalise_backslash = 'auto', 69 70 --a directory cache to improve directory reading time, 71 --enable if it takes a long time to load directories. 72 --may cause 'ghost' files to be shown that no-longer exist or 73 --fail to show files that have recently been created. 74 cache = false, 75 76 --this option reverses the behaviour of the alt+ENTER keybind 77 --when disabled the keybind is required to enable autoload for the file 78 --when enabled the keybind disables autoload for the file 79 autoload = false, 80 81 --if autoload is triggered by selecting the currently playing file, then 82 --the current file will have it's watch-later config saved before being closed 83 --essentially the current file will not be restarted 84 autoload_save_current = true, 85 86 --when opening the browser in idle mode prefer the current working directory over the root 87 --note that the working directory is set as the 'current' directory regardless, so `home` will 88 --move the browser there even if this option is set to false 89 default_to_working_directory = false, 90 91 --When opening the browser prefer the directory last opened by a previous mpv instance of file-browser. 92 --Overrides the `default_to_working_directory` option. 93 --Requires `save_last_opened_directory` to be true. 94 --Uses the internal `last-opened-directory` addon. 95 default_to_last_opened_directory = false, 96 97 --Whether to save the last opened directory and the file to save this value in. 98 save_last_opened_directory = false, 99 last_opened_directory_file = '~~state/file_browser-last_opened_directory', 100 101 --when moving up a directory do not stop on empty protocol schemes like `ftp://` 102 --e.g. moving up from `ftp://localhost/` will move straight to the root instead of `ftp://` 103 skip_protocol_schemes = true, 104 105 --move the cursor to the currently playing item (if available) when the playing file changes 106 cursor_follows_playing_item = false, 107 108 --Replace the user's home directory with `~/` in the header. 109 --Uses the internal home-label addon. 110 home_label = true, 111 112 --map optical device paths to their respective file paths, 113 --e.g. mapping bd:// to the value of the bluray-device property 114 map_bd_device = true, 115 map_dvd_device = true, 116 map_cdda_device = true, 117 118 --allows custom icons be set for the folder and cursor 119 --the `\h` character is a hard space to add padding between the symbol and the text 120 folder_icon = [[{\p1}m 6.52 0 l 1.63 0 b 0.73 0 0.01 0.73 0.01 1.63 l 0 11.41 b 0 12.32 0.73 13.05 1.63 13.05 l 14.68 13.05 b 15.58 13.05 16.31 12.32 16.31 11.41 l 16.31 3.26 b 16.31 2.36 15.58 1.63 14.68 1.63 l 8.15 1.63{\p0}\h]], 121 cursor_icon = [[{\p1}m 14.11 6.86 l 0.34 0.02 b 0.25 -0.02 0.13 -0 0.06 0.08 b -0.01 0.16 -0.02 0.28 0.04 0.36 l 3.38 5.55 l 3.38 5.55 3.67 6.15 3.81 6.79 3.79 7.45 3.61 8.08 3.39 8.5l 0.04 13.77 b -0.02 13.86 -0.01 13.98 0.06 14.06 b 0.11 14.11 0.17 14.13 0.24 14.13 b 0.27 14.13 0.31 14.13 0.34 14.11 l 14.11 7.28 b 14.2 7.24 14.25 7.16 14.25 7.07 b 14.25 6.98 14.2 6.9 14.11 6.86{\p0}\h]], 122 cursor_icon_flipped = [[{\p1}m 0.13 6.86 l 13.9 0.02 b 14 -0.02 14.11 -0 14.19 0.08 b 14.26 0.16 14.27 0.28 14.21 0.36 l 10.87 5.55 l 10.87 5.55 10.44 6.79 10.64 8.08 10.86 8.5l 14.21 13.77 b 14.27 13.86 14.26 13.98 14.19 14.06 b 14.14 14.11 14.07 14.13 14.01 14.13 b 13.97 14.13 13.94 14.13 13.9 14.11 l 0.13 7.28 b 0.05 7.24 0 7.16 0 7.07 b 0 6.98 0.05 6.9 0.13 6.86{\p0}\h]], 123 124 --enable addons 125 addons = true, 126 addon_directory = "~~/script-modules/file-browser-addons", 127 128 --Enables the internal `ls` addon that parses directories using the `ls` commandline tool. 129 --Allows directory parsing to run concurrently, which prevents the browser from locking up. 130 --Automatically disables itself on Windows systems. 131 ls_parser = true, 132 133 --Enables the internal `windir` addon that parses directories using the `dir` command in cmd.exe. 134 --Allows directory parsing to run concurrently, which prevents the browser from locking up. 135 --Automatically disables itself on non-Windows systems. 136 windir_parser = true, 137 138 --directory to load external modules - currently just user-input-module 139 module_directory = "~~/script-modules", 140 141 --turn the OSC idle screen off and on when opening and closing the browser 142 toggle_idlescreen = false, 143 144 --Set the current open status of the browser in the `file_browser/open` field of the `user-data` property. 145 --This property is only available in mpv v0.36+. 146 set_user_data = true, 147 148 --Set the current open status of the browser in the `file_browser-open` field of the `shared-script-properties` property. 149 --This property is deprecated. When it is removed in mpv v0.37 file-browser will automatically ignore this option. 150 set_shared_script_properties = false, 151 152 ---@type 'auto'|'left'|'center'|'right' 153 align_x = 'left', 154 ---@type 'auto'|'top'|'center'|'bottom' 155 align_y = 'top', 156 157 --style settings 158 format_string_header = [[{\fnMonospace}[%i/%x]%^ %q\N------------------------------------------------------------------]], 159 format_string_topwrapper = '...', 160 format_string_bottomwrapper = '...', 161 162 font_bold_header = true, 163 font_opacity_selection_marker = "99", 164 165 scaling_factor_base = 1, 166 scaling_factor_header = 1.4, 167 scaling_factor_wrappers = 1, 168 169 font_name_header = "", 170 font_name_body = "", 171 font_name_wrappers = "", 172 font_name_folder = "", 173 font_name_cursor = "", 174 175 font_colour_header = "00ccff", 176 font_colour_body = "ffffff", 177 font_colour_wrappers = "00ccff", 178 font_colour_cursor = "00ccff", 179 font_colour_escape_chars = "413eff", 180 181 font_colour_multiselect = "fcad88", 182 font_colour_selected = "fce788", 183 font_colour_playing = "33ff66", 184 font_colour_playing_multiselected = "22b547" 185 186 } 187 188 opt.read_options(o, 'file_browser') 189 190 ---@diagnostic disable-next-line deprecated 191 o.set_shared_script_properties = o.set_shared_script_properties and utils.shared_script_property_set 192 193 return o