diff --git a/AboutWindow.xaml b/AboutWindow.xaml index 5e263a5..ed04a18 100644 --- a/AboutWindow.xaml +++ b/AboutWindow.xaml @@ -28,7 +28,7 @@ Background="{DynamicResource AppSurfaceBrush}" HorizontalAlignment="Left" VerticalAlignment="Top"> - diff --git a/Services/LauncherController.cs b/Services/LauncherController.cs index a79a9fc..1c5931a 100644 --- a/Services/LauncherController.cs +++ b/Services/LauncherController.cs @@ -106,8 +106,22 @@ public sealed class LauncherController : IDisposable private static Icon LoadTrayIcon() { - string iconPath = Path.Combine(AppContext.BaseDirectory, "Assets", "TrayIcon.ico"); - return File.Exists(iconPath) ? new Icon(iconPath) : SystemIcons.Application; + try + { + Uri iconUri = new("pack://application:,,,/Assets/TrayIcon.ico", UriKind.Absolute); + System.Windows.Resources.StreamResourceInfo? resource = System.Windows.Application.GetResourceStream(iconUri); + if (resource?.Stream is null) + { + return SystemIcons.Application; + } + + using Icon icon = new(resource.Stream); + return (Icon)icon.Clone(); + } + catch + { + return SystemIcons.Application; + } } private void LaunchItem(LauncherItem item) diff --git a/TaskbarLauncher.csproj b/TaskbarLauncher.csproj index 673501b..b07477c 100644 --- a/TaskbarLauncher.csproj +++ b/TaskbarLauncher.csproj @@ -18,8 +18,8 @@ - - + +