Skip to content

Commit

Permalink
fix dark mode window title bar color and support uosc exclamation mar…
Browse files Browse the repository at this point in the history
…k menu syntax
  • Loading branch information
stax76 committed Nov 5, 2023
1 parent 1d3fe0a commit 684e103
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/MpvNet.Windows/WinForms/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public MainForm()
{
InitializeComponent();

if (Environment.OSVersion.Version >= new Version(10, 0, 18985))
if (Environment.OSVersion.Version >= new Version(10, 0, 18985) && Theme.DarkMode)
DwmSetWindowAttribute(Handle, 20, new[] { 1 }, 4); // DWMWA_USE_IMMERSIVE_DARK_MODE = 20

try
Expand Down
1 change: 1 addition & 0 deletions src/MpvNet/Binding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public class Binding : ObservableObject

public bool IsCustomMenu { get; set; }
public bool IsMenu { get; set; }
public bool IsShortMenuSyntax { get; set; }

string _input = "";

Expand Down
25 changes: 17 additions & 8 deletions src/MpvNet/InputHelp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -221,15 +221,23 @@ public static string ConvertToString(List<Binding> bindings)
string comment;

if (binding.IsMenu)
comment = "menu: " + binding.Comment.Trim();
{
if (binding.IsShortMenuSyntax)
comment = "! " + binding.Comment.Trim();
else
comment = "menu: " + binding.Comment.Trim();
}
else if (binding.IsCustomMenu)
comment = "custom-menu: " + binding.Comment.Trim();
else
comment = binding.Comment.Trim();

if (comment != "")
{
if (comment.StartsWith("menu: ") || comment.StartsWith("custom-menu: "))
if (comment.StartsWith("menu: ") ||
comment.StartsWith("custom-menu: ") ||
comment.StartsWith("! "))

comment = " #" + comment;
else
comment = " # " + comment;
Expand Down Expand Up @@ -297,12 +305,13 @@ public static List<Binding> Parse(string content)
binding.IsMenu = true;
line = line[..line.IndexOf("#menu:")];
}
//else if (line.Contains("#!"))
//{
// binding.Comment = line[(line.IndexOf("#!") + 2)..].Trim();
// binding.IsMenu = true;
// line = line[..line.IndexOf("#!")];
//}
else if (line.Contains("#!"))
{
binding.Comment = line[(line.IndexOf("#!") + 2)..].Trim();
binding.IsMenu = true;
binding.IsShortMenuSyntax = true;
line = line[..line.IndexOf("#!")];
}
else if (line.Contains("#custom-menu:"))
{
binding.Comment = line[(line.IndexOf("#custom-menu:") + 13)..].Trim();
Expand Down

0 comments on commit 684e103

Please sign in to comment.