diff --git a/README.md b/README.md index 39934aa..862262d 100644 --- a/README.md +++ b/README.md @@ -272,6 +272,10 @@ Delete currently playing file and quit mpv. Show current file in your operating systems' file explorer. +#### `open-config-directory` + +Open directory with `mpv.conf` in file explorer. + ## Context 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. diff --git a/uosc.lua b/uosc.lua index 4003dc3..98c7f92 100644 --- a/uosc.lua +++ b/uosc.lua @@ -163,6 +163,7 @@ Key script-binding uosc/last-file Key script-binding uosc/delete-file-next Key script-binding uosc/delete-file-quit Key script-binding uosc/show-in-directory +Key script-binding uosc/open-config-directory ``` ]] @@ -3157,3 +3158,17 @@ mp.add_key_binding(nil, 'delete-file-quit', function() os.remove(normalize_path(path)) mp.command('quit') end) +mp.add_key_binding(nil, 'open-config-directory', function() + local config = serialize_path(mp.command_native({'expand-path', '~~/mpv.conf'})) + local args + + if state.os == 'windows' then + args = {'explorer', '/select,', config.path} + elseif state.os == 'macos' then + args = {'open', '-R', config.path} + elseif state.os == 'linux' then + args = {'xdg-open', config.dirname} + end + + utils.subprocess_detached({args = args, cancellable = false}) +end)