command palette support

This commit is contained in:
stax76
2024-10-13 14:18:04 +02:00
parent 59a556794f
commit a0d2fb6a4e
4 changed files with 290 additions and 207 deletions

View File

@@ -3,6 +3,10 @@
- Support for autocreate-playlist, video-exts, audio-exts, image-exts.
Windows 7 support should still work, but needs auto-load-folder to be enabled.
- The command palette user script is installable from the context menu under
`Settings > Setup > Install Command Palette`. The command palette features
are shown in the menu under 'View > Command Palette'.
# v7.1.1.2 Beta (2024-10-10)

View File

@@ -14,6 +14,7 @@ using MpvNet.Windows.WPF;
using MpvNet.Windows.WPF.MsgBox;
using MpvNet.Windows.Help;
using MpvNet.Help;
using System.Windows.Documents;
namespace MpvNet;
@@ -56,6 +57,8 @@ public class GuiCommand
["show-properties"] = args => Player.Command("script-binding select/show-properties"),
["show-protocols"] = args => ShowProtocols(),
["window-scale"] = args => WindowScaleNet?.Invoke(float.Parse(args[0], CultureInfo.InvariantCulture)),
["install-command-palette"] = args => InstallCommandPalette(),
["show-recent-in-command-palette"] = args => ShowRecentFilesInCommandPalette(),
// deprecated
@@ -267,6 +270,56 @@ public class GuiCommand
catch { }
}
void InstallCommandPalette()
{
if (Msg.ShowQuestion("Install command palette?") != MessageBoxResult.OK)
return;
try
{
Environment.SetEnvironmentVariable("MPVNET_HOME", Player.ConfigFolder);
using Process proc = new Process();
proc.StartInfo.FileName = "powershell";
proc.StartInfo.Arguments = "-executionpolicy bypass -nologo -noexit -noprofile -command \"irm https://raw.githubusercontent.com/stax76/mpv-scripts/refs/heads/main/powershell/command_palette_installer.ps1 | iex\"";
proc.Start();
}
catch
{
}
}
void ShowRecentFilesInCommandPalette()
{
Obj o = new();
o.title = "Recent Files";
o.selected_index = 0;
var items = new List<Item>();
foreach (string file in App.Settings.RecentFiles)
items.Add(new Item() { title = Path.GetFileName(file),
value = new string []{ "loadfile", file },
hint = file});
o.items = items.ToArray();
string json = JsonSerializer.Serialize(o);
Player.CommandV("script-message", "show-command-palette-json", json);
}
public class Obj
{
public string title { get; set; } = "";
public int selected_index { get; set; } = 0;
public Item[] items { get; set; } = Array.Empty<Item>();
}
public class Item
{
public string[] value { get; set; } = Array.Empty<string>();
public string title { get; set; } = "";
public string hint { get; set; } = "";
}
void ShowMediaInfo(IList<string> args)
{
if (Player.PlaylistPos == -1)

View File

@@ -25,7 +25,7 @@ name = image-exts
file = mpv
directory = General
width = 500
help = Image file extentions to try to match when using --cover-art-auto, --autocreate-playlist or --directory-filter-types. By mpv.net used to create file associations and used by the auto-load-folder feature.
help = Image file extentions to try to match when using --cover-art-auto, --autocreate-playlist or --directory-filter-types. By mpv.net used to create file associations and used by the auto-load-folder feature. Default: avif,bmp,gif,j2k,jp2,jpeg,jpg,jxl,png,svg,tga,tif,tiff,webp
name = menu-syntax
file = mpvnet
@@ -782,7 +782,7 @@ name = video-exts
file = mpv
directory = Video
width = 500
help = Video file extentions to try to match when using --autocreate-playlist or --directory-filter-types. By mpv.net used to create file associations and used by the auto-load-folder feature.
help = Video file extentions to try to match when using --autocreate-playlist or --directory-filter-types. By mpv.net used to create file associations and used by the auto-load-folder feature. Default: 3g2,3gp,avi,flv,m2ts,m4v,mj2,mkv,mov,mp4,mpeg,mpg,ogv,rmvb,ts,webm,wmv,y4m
name = volume
file = mpv
@@ -831,7 +831,7 @@ name = audio-exts
file = mpv
directory = Audio
width = 500
help = Audio file extentions to try to match when using --audio-file-auto, --autocreate-playlist or --directory-filter-types. By mpv.net used to create file associations and used by the auto-load-folder feature.
help = Audio file extentions to try to match when using --audio-file-auto, --autocreate-playlist or --directory-filter-types. By mpv.net used to create file associations and used by the auto-load-folder feature. Default: aac,ac3,aiff,ape,au,dts,eac3,flac,m4a,mka,mp3,oga,ogg,ogm,opus,thd,wav,wav,wma,wv
name = slang
file = mpv

View File

@@ -7,228 +7,254 @@ public static class InputHelp
{
public static List<Binding> GetDefaults()
{
List<Binding> bindings = new List<Binding>()
{
new (_("File"), _("Open Files..."), "script-message-to mpvnet open-files", "o"),
new (_("File"), _("Open URL or file from clipboard"), "script-message-to mpvnet open-clipboard", "Ctrl+v"),
new (_("File"), _("Open DVD/Blu-ray Drive/Folder..."), "script-message-to mpvnet open-optical-media"),
new (_("File"), "-"),
new (_("File"), _("Add external audio files..."), "script-message-to mpvnet load-audio", "Alt+a"),
new (_("File"), _("Add external subtitle files..."), "script-message-to mpvnet load-sub", "Alt+s"),
new (_("File"), "-"),
new (_("File"), _("Add files to playlist..."), "script-message-to mpvnet open-files append"),
new (_("File"), _("Add files/URLs to playlist from clipboard"), "script-message-to mpvnet open-clipboard append", "Ctrl+Shift+v"),
new (_("File"), "-"),
new (_("File"), _("Recent Files")),
new (_("File"), _("Exit"), "quit", "Esc"),
List<Binding> b = new();
new (_("Playback"), _("Play/Pause"), "script-message-to mpvnet play-pause", "Space"),
new (_("Playback"), _("Stop"), "stop", "Ctrl+s"),
Add(b, new (_("File"), _("Open Files..."), "script-message-to mpvnet open-files", "o"));
Add(b, new (_("File"), _("Open URL or file from clipboard"), "script-message-to mpvnet open-clipboard", "Ctrl+v"));
Add(b, new (_("File"), _("Open DVD/Blu-ray Drive/Folder..."), "script-message-to mpvnet open-optical-media"));
Add(b, new (_("File"), "-"));
Add(b, new (_("File"), _("Add external audio files..."), "script-message-to mpvnet load-audio", "Alt+a"));
Add(b, new (_("File"), _("Add external subtitle files..."), "script-message-to mpvnet load-sub", "Alt+s"));
Add(b, new (_("File"), "-"));
Add(b, new (_("File"), _("Add files to playlist..."), "script-message-to mpvnet open-files append"));
Add(b, new (_("File"), _("Add files/URLs to playlist from clipboard"), "script-message-to mpvnet open-clipboard append", "Ctrl+Shift+v"));
Add(b, new (_("File"), "-"));
Add(b, new (_("File"), _("Recent Files")));
Add(b, new (_("File"), _("Exit"), "quit", "Esc"));
new (_("Navigate"), _("Previous File"), "playlist-prev", "F11"),
new (_("Navigate"), _("Next File"), "playlist-next", "F12"),
new (_("Navigate"), "-"),
new (_("Navigate"), _("First File"), "script-message-to mpvnet playlist-first", "Home"),
new (_("Navigate"), _("Last File"), "script-message-to mpvnet playlist-last", "End"),
Add(b, new (_("Playback"), _("Play/Pause"), "script-message-to mpvnet play-pause", "Space"));
Add(b, new (_("Playback"), _("Stop"), "stop", "Ctrl+s"));
new (_("Navigate"), "-"),
new (_("Navigate"), _("Next Chapter"), "add chapter 1", "PGUP"),
new (_("Navigate"), _("Previous Chapter"), "add chapter -1", "PGDWN"),
new (_("Navigate"), "-"),
new (_("Navigate"), _("Jump To Next Frame"), "frame-step", "."),
new (_("Navigate"), _("Jump To Previous Frame"), "frame-back-step", ","),
new (_("Navigate"), "-"),
new (_("Navigate"), _("Jump 5 sec forward"), "seek 5", "Right"),
new (_("Navigate"), _("Jump 5 sec backward"), "seek -5", "Left"),
new (_("Navigate"), "-"),
new (_("Navigate"), _("Jump 30 sec forward"), "seek 30", "Up"),
new (_("Navigate"), _("Jump 30 sec backward"), "seek -30", "Down"),
new (_("Navigate"), "-"),
new (_("Navigate"), _("Jump 5 min forward"), "seek 300", "Ctrl+Right"),
new (_("Navigate"), _("Jump 5 min backward"), "seek -300", "Ctrl+Left"),
new (_("Navigate"), "-"),
new (_("Navigate"), _("Title")),
new (_("Navigate"), _("Chapter")),
Add(b, new (_("Navigate"), _("Previous File"), "playlist-prev", "F11"));
Add(b, new (_("Navigate"), _("Next File"), "playlist-next", "F12"));
Add(b, new (_("Navigate"), "-"));
Add(b, new (_("Navigate"), _("First File"), "script-message-to mpvnet playlist-first", "Home"));
Add(b, new (_("Navigate"), _("Last File"), "script-message-to mpvnet playlist-last", "End"));
new (_("Pan & Scan"), _("Decrease Size"), "add video-zoom -0.1", "Ctrl+-"),
new (_("Pan & Scan"), _("Increase Size"), "add video-zoom 0.1", "Ctrl++"),
new (_("Pan & Scan"), "-"),
new (_("Pan & Scan"), _("Move Left"), "add video-pan-x -0.01", "Ctrl+KP4"),
new (_("Pan & Scan"), _("Move Right"), "add video-pan-x 0.01", "Ctrl+KP6"),
new (_("Pan & Scan"), "-"),
new (_("Pan & Scan"), _("Move Up"), "add video-pan-y -0.01", "Ctrl+KP8"),
new (_("Pan & Scan"), _("Move Down"), "add video-pan-y 0.01", "Ctrl+KP2"),
new (_("Pan & Scan"), "-"),
new (_("Pan & Scan"), _("Decrease Height"), "add panscan -0.1", "w"),
new (_("Pan & Scan"), _("Increase Height"), "add panscan 0.1", "W"),
new (_("Pan & Scan"), "-"),
new (_("Pan & Scan"), _("Reset"), "set video-zoom 0; set video-pan-x 0; set video-pan-y 0", "Ctrl+BS"),
Add(b, new (_("Navigate"), "-"));
Add(b, new (_("Navigate"), _("Next Chapter"), "add chapter 1", "PGUP"));
Add(b, new (_("Navigate"), _("Previous Chapter"), "add chapter -1", "PGDWN"));
Add(b, new (_("Navigate"), "-"));
Add(b, new (_("Navigate"), _("Jump To Next Frame"), "frame-step", "."));
Add(b, new (_("Navigate"), _("Jump To Previous Frame"), "frame-back-step", ","));
Add(b, new (_("Navigate"), "-"));
Add(b, new (_("Navigate"), _("Jump 5 sec forward"), "seek 5", "Right"));
Add(b, new (_("Navigate"), _("Jump 5 sec backward"), "seek -5", "Left"));
Add(b, new (_("Navigate"), "-"));
Add(b, new (_("Navigate"), _("Jump 30 sec forward"), "seek 30", "Up"));
Add(b, new (_("Navigate"), _("Jump 30 sec backward"), "seek -30", "Down"));
Add(b, new (_("Navigate"), "-"));
Add(b, new (_("Navigate"), _("Jump 5 min forward"), "seek 300", "Ctrl+Right"));
Add(b, new (_("Navigate"), _("Jump 5 min backward"), "seek -300", "Ctrl+Left"));
Add(b, new (_("Navigate"), "-"));
Add(b, new (_("Navigate"), _("Title")));
Add(b, new (_("Navigate"), _("Chapter")));
new (_("Video"), _("Decrease Contrast"), "add contrast -1", "Ctrl+1"),
new (_("Video"), _("Increase Contrast"), "add contrast 1", "Ctrl+2"),
new (_("Video"), "-"),
new (_("Video"), _("Decrease Brightness"), "add brightness -1", "Ctrl+3"),
new (_("Video"), _("Increase Brightness"), "add brightness 1", "Ctrl+4"),
new (_("Video"), "-"),
new (_("Video"), _("Decrease Gamma"), "add gamma -1", "Ctrl+5"),
new (_("Video"), _("Increase Gamma"), "add gamma 1", "Ctrl+6"),
new (_("Video"), "-"),
new (_("Video"), _("Decrease Saturation"), "add saturation -1", "Ctrl+7"),
new (_("Video"), _("Increase Saturation"), "add saturation 1", "Ctrl+8"),
new (_("Video"), "-"),
new (_("Video"), _("Take Screenshot"), "async screenshot", "s"),
new (_("Video"), _("Take Screenshot without subtitles"), "async screenshot video", "S"),
new (_("Video"), _("Toggle Deinterlace"), "cycle deinterlace", "d"),
new (_("Video"), _("Change Aspect Ratio"), "cycle-values video-aspect-override 16:9 4:3 2.35:1 0 -1", "a"),
new (_("Video"), _("Rotate Video"), "cycle-values video-rotate 90 180 270 0", "Ctrl+r"),
Add(b, new (_("Pan & Scan"), _("Decrease Size"), "add video-zoom -0.1", "Ctrl+-"));
Add(b, new (_("Pan & Scan"), _("Increase Size"), "add video-zoom 0.1", "Ctrl++"));
Add(b, new (_("Pan & Scan"), "-"));
Add(b, new (_("Pan & Scan"), _("Move Left"), "add video-pan-x -0.01", "Ctrl+KP4"));
Add(b, new (_("Pan & Scan"), _("Move Right"), "add video-pan-x 0.01", "Ctrl+KP6"));
Add(b, new (_("Pan & Scan"), "-"));
Add(b, new (_("Pan & Scan"), _("Move Up"), "add video-pan-y -0.01", "Ctrl+KP8"));
Add(b, new (_("Pan & Scan"), _("Move Down"), "add video-pan-y 0.01", "Ctrl+KP2"));
Add(b, new (_("Pan & Scan"), "-"));
Add(b, new (_("Pan & Scan"), _("Decrease Height"), "add panscan -0.1", "w"));
Add(b, new (_("Pan & Scan"), _("Increase Height"), "add panscan 0.1", "W"));
Add(b, new (_("Pan & Scan"), "-"));
Add(b, new (_("Pan & Scan"), _("Reset"), "set video-zoom 0; set video-pan-x 0; set video-pan-y 0", "Ctrl+BS"));
new (_("Audio"), _("Audio Device")),
new (_("Audio"), _("Next Track"), "script-message-to mpvnet cycle-audio", "KP7"),
new (_("Audio"), "-"),
new (_("Audio"), _("Delay +0.1"), "add audio-delay 0.1", "Ctrl+d"),
new (_("Audio"), _("Delay -0.1"), "add audio-delay -0.1", "Ctrl+D"),
Add(b, new (_("Video"), _("Decrease Contrast"), "add contrast -1", "Ctrl+1"));
Add(b, new (_("Video"), _("Increase Contrast"), "add contrast 1", "Ctrl+2"));
Add(b, new (_("Video"), "-"));
Add(b, new (_("Video"), _("Decrease Brightness"), "add brightness -1", "Ctrl+3"));
Add(b, new (_("Video"), _("Increase Brightness"), "add brightness 1", "Ctrl+4"));
Add(b, new (_("Video"), "-"));
Add(b, new (_("Video"), _("Decrease Gamma"), "add gamma -1", "Ctrl+5"));
Add(b, new (_("Video"), _("Increase Gamma"), "add gamma 1", "Ctrl+6"));
Add(b, new (_("Video"), "-"));
Add(b, new (_("Video"), _("Decrease Saturation"), "add saturation -1", "Ctrl+7"));
Add(b, new (_("Video"), _("Increase Saturation"), "add saturation 1", "Ctrl+8"));
Add(b, new (_("Video"), "-"));
Add(b, new (_("Video"), _("Take Screenshot"), "async screenshot", "s"));
Add(b, new (_("Video"), _("Take Screenshot without subtitles"), "async screenshot video", "S"));
Add(b, new (_("Video"), _("Toggle Deinterlace"), "cycle deinterlace", "d"));
Add(b, new (_("Video"), _("Change Aspect Ratio"), "cycle-values video-aspect-override 16:9 4:3 2.35:1 0 -1", "a"));
Add(b, new (_("Video"), _("Rotate Video"), "cycle-values video-rotate 90 180 270 0", "Ctrl+r"));
new (_("Subtitle"), _("Next Track"), "script-message-to mpvnet cycle-subtitles", "KP8"),
new (_("Subtitle"), _("Toggle Visibility"), "cycle sub-visibility", "v"),
new (_("Subtitle"), "-"),
new (_("Subtitle"), _("Delay -0.1"), "add sub-delay -0.1", "z"),
new (_("Subtitle"), _("Delay +0.1"), "add sub-delay 0.1", "Z"),
new (_("Subtitle"), "-"),
new (_("Subtitle"), _("Move Up"), "add sub-pos -1", "r"),
new (_("Subtitle"), _("Move Down"), "add sub-pos 1", "R"),
new (_("Subtitle"), "-"),
new (_("Subtitle"), _("Decrease Font Size"), "add sub-scale -0.1", "F"),
new (_("Subtitle"), _("Increase Font Size"), "add sub-scale 0.1", "G"),
new (_("Subtitle"), "-"),
new (_("Subtitle") + " > " + _("More"), _("Toggle overriding SSA/ASS styles with normal styles"), "cycle-values sub-ass-override force no", "u"),
Add(b, new (_("Audio"), _("Audio Device")));
Add(b, new (_("Audio"), _("Next Track"), "script-message-to mpvnet cycle-audio", "KP7"));
Add(b, new (_("Audio"), "-"));
Add(b, new (_("Audio"), _("Delay +0.1"), "add audio-delay 0.1", "Ctrl+d"));
Add(b, new (_("Audio"), _("Delay -0.1"), "add audio-delay -0.1", "Ctrl+D"));
new ("", _("Track")),
Add(b, new (_("Subtitle"), _("Next Track"), "script-message-to mpvnet cycle-subtitles", "KP8"));
Add(b, new (_("Subtitle"), _("Toggle Visibility"), "cycle sub-visibility", "v"));
Add(b, new (_("Subtitle"), "-"));
Add(b, new (_("Subtitle"), _("Delay -0.1"), "add sub-delay -0.1", "z"));
Add(b, new (_("Subtitle"), _("Delay +0.1"), "add sub-delay 0.1", "Z"));
Add(b, new (_("Subtitle"), "-"));
Add(b, new (_("Subtitle"), _("Move Up"), "add sub-pos -1", "r"));
Add(b, new (_("Subtitle"), _("Move Down"), "add sub-pos 1", "R"));
Add(b, new (_("Subtitle"), "-"));
Add(b, new (_("Subtitle"), _("Decrease Font Size"), "add sub-scale -0.1", "F"));
Add(b, new (_("Subtitle"), _("Increase Font Size"), "add sub-scale 0.1", "G"));
Add(b, new (_("Subtitle"), "-"));
Add(b, new (_("Subtitle") + " > " + _("More"), _("Toggle overriding SSA/ASS styles with normal styles"), "cycle-values sub-ass-override force no", "u"));
new (_("Volume"), _p("Volume", "Up"), "add volume 2", "+"),
new (_("Volume"), _p("Volume", "Down"), "add volume -2", "-"),
new (_("Volume"), "-"),
new (_("Volume"), _("Mute"), "cycle mute", "m"),
Add(b, new ("", _("Track")));
new (_("Speed"), _("-10%"), "multiply speed 1/1.1", "["),
new (_("Speed"), _("+10%"), "multiply speed 1.1", "]"),
new (_("Speed"), "-"),
new (_("Speed"), _("Half"), "multiply speed 0.5", "{"),
new (_("Speed"), _("Double"), "multiply speed 2.0", "}"),
new (_("Speed"), "-"),
new (_("Speed"), _("Reset"), "set speed 1", "BS"),
Add(b, new (_("Volume"), _p("Volume", "Up"), "add volume 2", "+"));
Add(b, new (_("Volume"), _p("Volume", "Down"), "add volume -2", "-"));
Add(b, new (_("Volume"), "-"));
Add(b, new (_("Volume"), _("Mute"), "cycle mute", "m"));
new (_("View"), _("Toggle Statistics"), "script-binding stats/display-stats-toggle", "t"),
new (_("View"), _("Toggle OSC Visibility"), "script-binding osc/visibility", "Del"),
new (_("View"), _("Show Media Info On-Screen"), "script-message-to mpvnet show-media-info osd", "i"),
new (_("View"), _("Show Media Info Message Box"), "script-message-to mpvnet show-media-info msgbox", "Ctrl+m"),
new (_("View"), _("Show Progress"), "show-progress", "p"),
Add(b, new (_("Speed"), _("-10%"), "multiply speed 1/1.1", "["));
Add(b, new (_("Speed"), _("+10%"), "multiply speed 1.1", "]"));
Add(b, new (_("Speed"), "-"));
Add(b, new (_("Speed"), _("Half"), "multiply speed 0.5", "{"));
Add(b, new (_("Speed"), _("Double"), "multiply speed 2.0", "}"));
Add(b, new (_("Speed"), "-"));
Add(b, new (_("Speed"), _("Reset"), "set speed 1", "BS"));
new (_("View") + " > " + _("On Screen Menu"), _("Playlist"), "script-binding select/select-playlist", "F8"),
new (_("View") + " > " + _("On Screen Menu"), _("Bindings"), "script-binding select/select-binding", "F1"),
new (_("View") + " > " + _("On Screen Menu"), _("Properties"), "script-binding select/show-properties", "F3"),
new (_("View") + " > " + _("On Screen Menu"), _("Chapters"), "script-binding select/select-chapter", "Alt+c"),
new (_("View") + " > " + _("On Screen Menu"), _("Tracks"), "script-binding select/select-track", "F9"),
new (_("View") + " > " + _("On Screen Menu"), _("Audio Tracks"), "script-binding select/select-aid"),
new (_("View") + " > " + _("On Screen Menu"), _("Subtitle Tracks"), "script-binding select/select-sid"),
new (_("View") + " > " + _("On Screen Menu"), _("Secondary Subtitle"), "script-binding select/select-secondary-sid", "Alt+b"),
new (_("View") + " > " + _("On Screen Menu"), _("Video Tracks"), "script-binding select/select-vid", "Alt+v"),
new (_("View") + " > " + _("On Screen Menu"), _("Subtitle Lines"), "script-binding select/select-subtitle-line", "Alt+l"),
new (_("View") + " > " + _("On Screen Menu"), _("Audio Devices"), "script-binding select/select-audio-device", "Alt+d"),
Add(b, new (_("View"), _("Toggle Statistics"), "script-binding stats/display-stats-toggle", "t"));
Add(b, new (_("View"), _("Toggle OSC Visibility"), "script-binding osc/visibility", "Del"));
Add(b, new (_("View"), _("Show Media Info On-Screen"), "script-message-to mpvnet show-media-info osd", "i"));
Add(b, new (_("View"), _("Show Media Info Message Box"), "script-message-to mpvnet show-media-info msgbox", "Ctrl+m"));
Add(b, new (_("View"), _("Show Progress"), "show-progress", "p"));
new (_("View") + " > " + _("More"), _("Show Console"), "script-binding console/enable", "`"),
new (_("View") + " > " + _("More"), _("Show Commands"), "script-message-to mpvnet show-commands", "F2"),
new (_("View") + " > " + _("More"), _("Show Bindings"), "script-message-to mpvnet show-bindings"),
new (_("View") + " > " + _("More"), _("Show Keys"), "script-message-to mpvnet show-keys", "Alt+k"),
new (_("View") + " > " + _("More"), _("Show Protocols"), "script-message-to mpvnet show-protocols", "Alt+p"),
new (_("View") + " > " + _("More"), _("Show Decoders"), "script-message-to mpvnet show-decoders"),
new (_("View") + " > " + _("More"), _("Show Demuxers"), "script-message-to mpvnet show-demuxers"),
Add(b, new (_("View") + " > " + _("On Screen Menu"), _("Playlist"), "script-binding select/select-playlist", "F8"));
Add(b, new (_("View") + " > " + _("On Screen Menu"), _("Bindings"), "script-binding select/select-binding", "F1"));
Add(b, new (_("View") + " > " + _("On Screen Menu"), _("Properties"), "script-binding select/show-properties", "F3"));
Add(b, new (_("View") + " > " + _("On Screen Menu"), _("Chapters"), "script-binding select/select-chapter", "Alt+c"));
Add(b, new (_("View") + " > " + _("On Screen Menu"), _("Tracks"), "script-binding select/select-track", "F9"));
Add(b, new (_("View") + " > " + _("On Screen Menu"), _("Audio Tracks"), "script-binding select/select-aid"));
Add(b, new (_("View") + " > " + _("On Screen Menu"), _("Subtitle Tracks"), "script-binding select/select-sid"));
Add(b, new (_("View") + " > " + _("On Screen Menu"), _("Secondary Subtitle"), "script-binding select/select-secondary-sid", "Alt+b"));
Add(b, new (_("View") + " > " + _("On Screen Menu"), _("Video Tracks"), "script-binding select/select-vid", "Alt+v"));
Add(b, new (_("View") + " > " + _("On Screen Menu"), _("Subtitle Lines"), "script-binding select/select-subtitle-line", "Alt+l"));
Add(b, new (_("View") + " > " + _("On Screen Menu"), _("Audio Devices"), "script-binding select/select-audio-device", "Alt+d"));
new (_("Window"), _("Fullscreen"), "cycle fullscreen", "Enter"),
new (_("Window") + " > " + _("Zoom"), _("Enlarge"), "script-message-to mpvnet scale-window 1.2", "Alt++"),
new (_("Window") + " > " + _("Zoom"), _("Shrink"), "script-message-to mpvnet scale-window 0.8", "Alt+-"),
new (_("Window") + " > " + _("Zoom"), "-"),
new (_("Window") + " > " + _("Zoom"), _("50 %"), "script-message-to mpvnet window-scale 0.5", "Alt+0"),
new (_("Window") + " > " + _("Zoom"), _("100 %"), "script-message-to mpvnet window-scale 1.0", "Alt+1"),
new (_("Window") + " > " + _("Zoom"), _("200 %"), "script-message-to mpvnet window-scale 2.0", "Alt+2"),
new (_("Window") + " > " + _("Zoom"), _("300 %"), "script-message-to mpvnet window-scale 3.0", "Alt+3"),
new (_("Window") + " > " + _("Move"), _p("Move", "Left"), "script-message-to mpvnet move-window left", "Alt+Left"),
new (_("Window") + " > " + _("Move"), _p("Move", "Right"), "script-message-to mpvnet move-window right", "Alt+Right"),
new (_("Window") + " > " + _("Move"), _p("Move", "Up"), "script-message-to mpvnet move-window top", "Alt+Up"),
new (_("Window") + " > " + _("Move"), _p("Move", "Down"), "script-message-to mpvnet move-window bottom", "Alt+Down"),
new (_("Window") + " > " + _("Move"), _p("Move", "Center"), "script-message-to mpvnet move-window center", "Alt+BS"),
new (_("Window"), _("Toggle Border"), "cycle border", "b"),
new (_("Window"), _("Toggle On Top"), "cycle ontop", "Ctrl+t"),
if (File.Exists(Player.ConfigFolder + "/scripts/command_palette.lua"))
{
Add(b, new(_("View") + " > " + _("Command Palette"), _("Command Palette"), "script-message-to command_palette show-command-palette \"Command Palette\"", "Ctrl+p"));
Add(b, new(_("View") + " > " + _("Command Palette"), _("Bindings"), "script-message-to command_palette show-command-palette \"Bindings\"", "F1"));
Add(b, new(_("View") + " > " + _("Command Palette"), _("Properties"), "script-message-to command_palette show-command-palette \"Properties\"", "F2"));
Add(b, new(_("View") + " > " + _("Command Palette"), _("Commands"), "script-message-to command_palette show-command-palette \"Commands\"", "F3"));
Add(b, new(_("View") + " > " + _("Command Palette"), _("Options"), "script-message-to command_palette show-command-palette \"Options\"", "F4"));
Add(b, new(_("View") + " > " + _("Command Palette"), _("Playlist"), "script-message-to command_palette show-command-palette \"Playlist\"", "F8"));
Add(b, new(_("View") + " > " + _("Command Palette"), _("Tracks"), "script-message-to command_palette show-command-palette \"Tracks\"", "F9"));
Add(b, new(_("View") + " > " + _("Command Palette"), _("Audio Tracks"), "script-message-to command_palette show-command-palette \"Audio Tracks\"", "Alt+a"));
Add(b, new(_("View") + " > " + _("Command Palette"), _("Subtitle Tracks"), "script-message-to command_palette show-command-palette \"Subtitle Tracks\"", "Alt+s"));
Add(b, new(_("View") + " > " + _("Command Palette"), _("Secondary Subtitle"), "script-message-to command_palette show-command-palette \"Secondary Subtitle\"", "Alt+b"));
Add(b, new(_("View") + " > " + _("Command Palette"), _("Video Tracks"), "script-message-to command_palette show-command-palette \"Video Tracks\"", "Alt+v"));
Add(b, new(_("View") + " > " + _("Command Palette"), _("Chapters"), "script-message-to command_palette show-command-palette \"Chapters\"", "Alt+c"));
Add(b, new(_("View") + " > " + _("Command Palette"), _("Profiles"), "script-message-to command_palette show-command-palette \"Profiles\"", "Alt+p"));
Add(b, new(_("View") + " > " + _("Command Palette"), _("Audio Devices"), "script-message-to command_palette show-command-palette \"Audio Devices\"", "Alt+d"));
Add(b, new(_("View") + " > " + _("Command Palette"), _("Subtitle Line"), "script-message-to command_palette show-command-palette \"Subtitle Line\"", "Alt+l"));
Add(b, new(_("View") + " > " + _("Command Palette"), _("Blu-ray Titles"), "script-message-to command_palette show-command-palette \"Blu-ray Titles\"", "Alt+t"));
Add(b, new(_("View") + " > " + _("Command Palette"), _("Stream Quality"), "script-message-to command_palette show-command-palette \"Stream Quality\"", "Alt+q"));
Add(b, new(_("View") + " > " + _("Command Palette"), _("Aspect Ratio"), "script-message-to command_palette show-command-palette \"Aspect Ratio\"", "Alt+r"));
Add(b, new(_("View") + " > " + _("Command Palette"), _("Recent Files"), "script-message-to mpvnet show-recent-in-command-palette", "Alt+f"));
}
new ("", _("Profile")),
new (_("Settings"), _("Show Config Editor"), "script-message-to mpvnet show-conf-editor", "Ctrl+,"),
new (_("Settings"), _("Show Input Editor"), "script-message-to mpvnet show-input-editor", "Ctrl+i"),
new (_("Settings"), "-"),
new (_("Settings"), _("Edit mpv.conf"), "script-message-to mpvnet edit-conf-file mpv.conf", "c"),
new (_("Settings"), _("Edit input.conf"), "script-message-to mpvnet edit-conf-file input.conf", "k"),
new (_("Settings"), "-"),
new (_("Settings"), _("Open Config Folder"), "script-message-to mpvnet open-conf-folder", "Ctrl+f"),
new (_("Settings") + " > " + _("Setup"), _("Register video file associations"), "script-message-to mpvnet reg-file-assoc video"),
new (_("Settings") + " > " + _("Setup"), _("Register audio file associations"), "script-message-to mpvnet reg-file-assoc audio"),
new (_("Settings") + " > " + _("Setup"), _("Register image file associations"), "script-message-to mpvnet reg-file-assoc image"),
new (_("Settings") + " > " + _("Setup"), _("Unregister file associations"), "script-message-to mpvnet reg-file-assoc unreg"),
new (_("Settings") + " > " + _("Setup"), "-"),
new (_("Settings") + " > " + _("Setup"), _("Add mpv.net to Path environment variable"), "script-message-to mpvnet add-to-path"),
new (_("Settings") + " > " + _("Setup"), _("Remove mpv.net from Path environment variable"), "script-message-to mpvnet remove-from-path"),
new (_("Tools"), _("Set/clear A-B loop points"), "ab-loop", "l"),
new (_("Tools"), _("Toggle infinite file looping"), "cycle-values loop-file inf no", "L"),
new (_("Tools"), _("Shuffle Playlist"), "playlist-shuffle"),
new (_("Tools"), _("Toggle Hardware Decoding"), "cycle-values hwdec auto no", "Ctrl+h"),
new (_("Tools"), _("Exit Watch Later"), "quit-watch-later", "Q"),
new ("", _("Custom")),
Add(b, new (_("View") + " > " + _("More"), _("Show Console"), "script-binding console/enable", "`"));
Add(b, new (_("View") + " > " + _("More"), _("Show Commands"), "script-message-to mpvnet show-commands", "F2"));
Add(b, new (_("View") + " > " + _("More"), _("Show Bindings"), "script-message-to mpvnet show-bindings"));
Add(b, new (_("View") + " > " + _("More"), _("Show Keys"), "script-message-to mpvnet show-keys", "Alt+k"));
Add(b, new (_("View") + " > " + _("More"), _("Show Protocols"), "script-message-to mpvnet show-protocols", "Alt+p"));
Add(b, new (_("View") + " > " + _("More"), _("Show Decoders"), "script-message-to mpvnet show-decoders"));
Add(b, new (_("View") + " > " + _("More"), _("Show Demuxers"), "script-message-to mpvnet show-demuxers"));
new (_("Help"), _("Website mpv"), "script-message-to mpvnet shell-execute https://mpv.io", "Ctrl+Home"),
new (_("Help"), _("Website mpv.net"), "script-message-to mpvnet shell-execute https://github.com/mpvnet-player/mpv.net"),
new (_("Help"), "-"),
new (_("Help"), _("Manual mpv"), "script-message-to mpvnet shell-execute https://mpv.io/manual/stable", "Ctrl+F1"),
new (_("Help"), _("Manual mpv.net"), "script-message-to mpvnet shell-execute https://github.com/mpvnet-player/mpv.net/blob/main/docs/manual.md", "Ctrl+F2"),
new (_("Help"), "-"),
new (_("Help"), _("awesome-mpv"), "script-message-to mpvnet shell-execute https://github.com/stax76/awesome-mpv", "Ctrl+a"),
new (_("Help"), _("About mpv.net"), "script-message-to mpvnet show-about"),
Add(b, new (_("Window"), _("Fullscreen"), "cycle fullscreen", "Enter"));
Add(b, new (_("Window") + " > " + _("Zoom"), _("Enlarge"), "script-message-to mpvnet scale-window 1.2", "Alt++"));
Add(b, new (_("Window") + " > " + _("Zoom"), _("Shrink"), "script-message-to mpvnet scale-window 0.8", "Alt+-"));
Add(b, new (_("Window") + " > " + _("Zoom"), "-"));
Add(b, new (_("Window") + " > " + _("Zoom"), _("50 %"), "script-message-to mpvnet window-scale 0.5", "Alt+0"));
Add(b, new (_("Window") + " > " + _("Zoom"), _("100 %"), "script-message-to mpvnet window-scale 1.0", "Alt+1"));
Add(b, new (_("Window") + " > " + _("Zoom"), _("200 %"), "script-message-to mpvnet window-scale 2.0", "Alt+2"));
Add(b, new (_("Window") + " > " + _("Zoom"), _("300 %"), "script-message-to mpvnet window-scale 3.0", "Alt+3"));
Add(b, new (_("Window") + " > " + _("Move"), _p("Move", "Left"), "script-message-to mpvnet move-window left", "Alt+Left"));
Add(b, new (_("Window") + " > " + _("Move"), _p("Move", "Right"), "script-message-to mpvnet move-window right", "Alt+Right"));
Add(b, new (_("Window") + " > " + _("Move"), _p("Move", "Up"), "script-message-to mpvnet move-window top", "Alt+Up"));
Add(b, new (_("Window") + " > " + _("Move"), _p("Move", "Down"), "script-message-to mpvnet move-window bottom", "Alt+Down"));
Add(b, new (_("Window") + " > " + _("Move"), _p("Move", "Center"), "script-message-to mpvnet move-window center", "Alt+BS"));
Add(b, new (_("Window"), _("Toggle Border"), "cycle border", "b"));
Add(b, new (_("Window"), _("Toggle On Top"), "cycle ontop", "Ctrl+t"));
new ("", "", "quit", "q", _("Exit")),
new ("", "", "script-message-to mpvnet show-menu", "MBTN_Right", _("Show Menu")),
new ("", "", "script-message-to mpvnet play-pause", "Play", _("Play/Pause")),
new ("", "", "script-message-to mpvnet play-pause", "Pause", _("Play/Pause")),
new ("", "", "script-message-to mpvnet play-pause", "PlayPause", _("Play/Pause")),
new ("", "", "script-message-to mpvnet play-pause", "MBTN_Mid", _("Play/Pause")),
new ("", "", "stop", "Stop", _("Stop")),
new ("", "", "seek 60", "Forward", _("Forward")),
new ("", "", "seek -60", "Rewind", _("Backward")),
new ("", "", "add volume 2", "Wheel_Up", _("Volume Up")),
new ("", "", "add volume -2", "Wheel_Down", _("Volume Down")),
new ("", "", "add volume 2", "Wheel_Right", _("Volume Up")),
new ("", "", "add volume -2", "Wheel_Left", _("Volume Down")),
new ("", "", "playlist-prev", "Prev", _("Previous File")),
new ("", "", "playlist-next", "Next", _("Next File")),
new ("", "", "playlist-prev", "MBTN_Back", _("Previous File")),
new ("", "", "playlist-next", "MBTN_Forward", _("Next File")),
new ("", "", "playlist-prev", "<", _("Previous File")),
new ("", "", "playlist-next", ">", _("Next File")),
new ("", "", "ignore", "MBTN_Left", _("Ignore left mouse butten")),
new ("", "", "cycle fullscreen", "f", _("Fullscreen")),
new ("", "", "cycle fullscreen", "MBTN_Left_DBL", _("Fullscreen")),
new ("", "", "no-osd seek 1 exact", "Shift+Right", _("Seek Forward")),
new ("", "", "no-osd seek -1 exact", "Shift+Left", _("Seek Backward")),
new ("", "", "no-osd seek 5 exact", "Shift+Up", _("Seek Forward")),
new ("", "", "no-osd seek -5 exact", "Shift+Down", _("Seek Backward")),
new ("", "", "revert-seek", "Shift+BS", _("Undo previous (or marked) seek")),
new ("", "", "revert-seek mark", "Shift+Ctrl+BS", _("Mark position for revert-seek")),
new ("", "", "no-osd sub-seek -1", "Ctrl+Shift+Left", _("Seek to previous subtitle")),
new ("", "", "no-osd sub-seek 1", "Ctrl+Shift+Right", _("Seek to next subtitle")),
new ("", "", "no-osd seek 5", "Ctrl+Wheel_Up", _("Seek Forward")),
new ("", "", "no-osd seek -5", "Ctrl+Wheel_Down", _("Seek Backward")),
new ("", "", "quit", "Power", _("Exit")),
};
Add(b, new ("", _("Profile")));
return bindings;
Add(b, new (_("Settings"), _("Show Config Editor"), "script-message-to mpvnet show-conf-editor", "Ctrl+,"));
Add(b, new (_("Settings"), _("Show Input Editor"), "script-message-to mpvnet show-input-editor", "Ctrl+i"));
Add(b, new (_("Settings"), "-"));
Add(b, new (_("Settings"), _("Edit mpv.conf"), "script-message-to mpvnet edit-conf-file mpv.conf", "c"));
Add(b, new (_("Settings"), _("Edit input.conf"), "script-message-to mpvnet edit-conf-file input.conf", "k"));
Add(b, new (_("Settings"), "-"));
Add(b, new (_("Settings"), _("Open Config Folder"), "script-message-to mpvnet open-conf-folder", "Ctrl+f"));
Add(b, new (_("Settings") + " > " + _("Setup"), _("Register video file associations"), "script-message-to mpvnet reg-file-assoc video"));
Add(b, new (_("Settings") + " > " + _("Setup"), _("Register audio file associations"), "script-message-to mpvnet reg-file-assoc audio"));
Add(b, new (_("Settings") + " > " + _("Setup"), _("Register image file associations"), "script-message-to mpvnet reg-file-assoc image"));
Add(b, new (_("Settings") + " > " + _("Setup"), _("Unregister file associations"), "script-message-to mpvnet reg-file-assoc unreg"));
Add(b, new (_("Settings") + " > " + _("Setup"), "-"));
Add(b, new (_("Settings") + " > " + _("Setup"), _("Add mpv.net to Path environment variable"), "script-message-to mpvnet add-to-path"));
Add(b, new (_("Settings") + " > " + _("Setup"), _("Remove mpv.net from Path environment variable"), "script-message-to mpvnet remove-from-path"));
Add(b, new (_("Settings") + " > " + _("Setup"), "-"));
Add(b, new (_("Settings") + " > " + _("Setup"), _("Install Command Palette"), "script-message-to mpvnet install-command-palette"));
Add(b, new (_("Tools"), _("Set/clear A-B loop points"), "ab-loop", "l"));
Add(b, new (_("Tools"), _("Toggle infinite file looping"), "cycle-values loop-file inf no", "L"));
Add(b, new (_("Tools"), _("Shuffle Playlist"), "playlist-shuffle"));
Add(b, new (_("Tools"), _("Toggle Hardware Decoding"), "cycle-values hwdec auto no", "Ctrl+h"));
Add(b, new (_("Tools"), _("Exit Watch Later"), "quit-watch-later", "Q"));
Add(b, new ("", _("Custom")));
Add(b, new (_("Help"), _("Website mpv"), "script-message-to mpvnet shell-execute https://mpv.io", "Ctrl+Home"));
Add(b, new (_("Help"), _("Website mpv.net"), "script-message-to mpvnet shell-execute https://github.com/mpvnet-player/mpv.net"));
Add(b, new (_("Help"), "-"));
Add(b, new (_("Help"), _("Manual mpv"), "script-message-to mpvnet shell-execute https://mpv.io/manual/stable", "Ctrl+F1"));
Add(b, new (_("Help"), _("Manual mpv.net"), "script-message-to mpvnet shell-execute https://github.com/mpvnet-player/mpv.net/blob/main/docs/manual.md", "Ctrl+F2"));
Add(b, new (_("Help"), "-"));
Add(b, new (_("Help"), _("awesome-mpv"), "script-message-to mpvnet shell-execute https://github.com/stax76/awesome-mpv", "Ctrl+a"));
Add(b, new (_("Help"), _("About mpv.net"), "script-message-to mpvnet show-about"));
Add(b, new ("", "", "quit", "q", _("Exit")));
Add(b, new ("", "", "script-message-to mpvnet show-menu", "MBTN_Right", _("Show Menu")));
Add(b, new ("", "", "script-message-to mpvnet play-pause", "Play", _("Play/Pause")));
Add(b, new ("", "", "script-message-to mpvnet play-pause", "Pause", _("Play/Pause")));
Add(b, new ("", "", "script-message-to mpvnet play-pause", "PlayPause", _("Play/Pause")));
Add(b, new ("", "", "script-message-to mpvnet play-pause", "MBTN_Mid", _("Play/Pause")));
Add(b, new ("", "", "stop", "Stop", _("Stop")));
Add(b, new ("", "", "seek 60", "Forward", _("Forward")));
Add(b, new ("", "", "seek -60", "Rewind", _("Backward")));
Add(b, new ("", "", "add volume 2", "Wheel_Up", _("Volume Up")));
Add(b, new ("", "", "add volume -2", "Wheel_Down", _("Volume Down")));
Add(b, new ("", "", "add volume 2", "Wheel_Right", _("Volume Up")));
Add(b, new ("", "", "add volume -2", "Wheel_Left", _("Volume Down")));
Add(b, new ("", "", "playlist-prev", "Prev", _("Previous File")));
Add(b, new ("", "", "playlist-next", "Next", _("Next File")));
Add(b, new ("", "", "playlist-prev", "MBTN_Back", _("Previous File")));
Add(b, new ("", "", "playlist-next", "MBTN_Forward", _("Next File")));
Add(b, new ("", "", "playlist-prev", "<", _("Previous File")));
Add(b, new ("", "", "playlist-next", ">", _("Next File")));
Add(b, new ("", "", "ignore", "MBTN_Left", _("Ignore left mouse butten")));
Add(b, new ("", "", "cycle fullscreen", "f", _("Fullscreen")));
Add(b, new ("", "", "cycle fullscreen", "MBTN_Left_DBL", _("Fullscreen")));
Add(b, new ("", "", "no-osd seek 1 exact", "Shift+Right", _("Seek Forward")));
Add(b, new ("", "", "no-osd seek -1 exact", "Shift+Left", _("Seek Backward")));
Add(b, new ("", "", "no-osd seek 5 exact", "Shift+Up", _("Seek Forward")));
Add(b, new ("", "", "no-osd seek -5 exact", "Shift+Down", _("Seek Backward")));
Add(b, new ("", "", "revert-seek", "Shift+BS", _("Undo previous (or marked) seek")));
Add(b, new ("", "", "revert-seek mark", "Shift+Ctrl+BS", _("Mark position for revert-seek")));
Add(b, new ("", "", "no-osd sub-seek -1", "Ctrl+Shift+Left", _("Seek to previous subtitle")));
Add(b, new ("", "", "no-osd sub-seek 1", "Ctrl+Shift+Right", _("Seek to next subtitle")));
Add(b, new ("", "", "no-osd seek 5", "Ctrl+Wheel_Up", _("Seek Forward")));
Add(b, new ("", "", "no-osd seek -5", "Ctrl+Wheel_Down", _("Seek Backward")));
Add(b, new ("", "", "quit", "Power", _("Exit")));
return b;
static void Add(List<Binding> bindings, Binding b) => bindings.Add(b);
}
public static string ConvertToString(List<Binding> bindings)