Use macOS template icons
This PR changes the macOS TrayIcon to use template icons that change automatically based on the darkness of the desktop background. Also updates AvaloniaUI to latest version. This fixes #6021
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 6.0 KiB |
|
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 6.0 KiB |
|
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 5.6 KiB |
|
Before Width: | Height: | Size: 6.8 KiB After Width: | Height: | Size: 5.7 KiB |
|
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 5.6 KiB |
|
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 5.3 KiB |
|
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 6.0 KiB |
|
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 6.0 KiB |
|
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 5.6 KiB |
|
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 5.7 KiB |
|
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 5.6 KiB |
@@ -61,25 +61,25 @@ namespace Duplicati.GUI.TrayIcon
|
||||
|
||||
internal Task RunOnUIThread(Action action)
|
||||
{
|
||||
if (_disposed != 0)
|
||||
return Task.CompletedTask;
|
||||
if (_disposed != 0)
|
||||
return Task.CompletedTask;
|
||||
|
||||
return actionDelayer.ExecuteAction(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
if (_disposed != 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
RunOnUIThreadInternal(action);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.WriteErrorMessage(LOGTAG, "AvaloniaRunOnUIThreadFailed", ex, "Failed to run action on UI thread");
|
||||
throw;
|
||||
}
|
||||
});
|
||||
return actionDelayer.ExecuteAction(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
if (_disposed != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
RunOnUIThreadInternal(action);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.WriteErrorMessage(LOGTAG, "AvaloniaRunOnUIThreadFailed", ex, "Failed to run action on UI thread");
|
||||
throw;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void RunOnUIThreadInternal(Action action)
|
||||
@@ -89,7 +89,7 @@ namespace Duplicati.GUI.TrayIcon
|
||||
return;
|
||||
|
||||
if (_disposed != 0)
|
||||
return ;
|
||||
return;
|
||||
|
||||
if (Dispatcher.UIThread.CheckAccess())
|
||||
action();
|
||||
@@ -340,7 +340,7 @@ namespace Duplicati.GUI.TrayIcon
|
||||
private void UpdateIcon()
|
||||
{
|
||||
if (nativeMenuItem == null)
|
||||
return;
|
||||
return;
|
||||
|
||||
nativeMenuItem.Icon = this.Icon switch
|
||||
{
|
||||
@@ -410,6 +410,7 @@ namespace Duplicati.GUI.TrayIcon
|
||||
if (this.trayIcon == null)
|
||||
return;
|
||||
|
||||
MacOSProperties.SetIsTemplateIcon(this.trayIcon, true);
|
||||
switch (icon)
|
||||
{
|
||||
case TrayIcons.IdleError:
|
||||
@@ -482,7 +483,7 @@ namespace Duplicati.GUI.TrayIcon
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"AVALALONIA desktop.Shutdown() failed because of {ex}");
|
||||
Console.WriteLine($"AVALALONIA desktop.Shutdown() failed because of {ex}");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,11 +21,11 @@
|
||||
<TrimmableAssembly Include="Avalonia.Themes.Default" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia" Version="11.2.0" />
|
||||
<PackageReference Include="Avalonia.Desktop" Version="11.2.0" />
|
||||
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.2.0" />
|
||||
<PackageReference Include="Avalonia" Version="11.3.2" />
|
||||
<PackageReference Include="Avalonia.Desktop" Version="11.3.2" />
|
||||
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.3.2" />
|
||||
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
|
||||
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.2.0" />
|
||||
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.3.2" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AvaloniaResource Include="Assets\**" />
|
||||
|
||||