Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TrayIcon fixes #16111

Merged
merged 12 commits into from
Jun 26, 2024
10 changes: 3 additions & 7 deletions src/Avalonia.Controls/TrayIcon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Avalonia.Controls.Platform;
using Avalonia.Platform;
using Avalonia.Reactive;
using Avalonia.Threading;

namespace Avalonia.Controls
{
Expand Down Expand Up @@ -64,12 +65,7 @@ static TrayIcon()
}
});

var app = Application.Current ?? throw new InvalidOperationException("Application not yet initialized.");

if (app.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime lifetime)
{
lifetime.Exit += Lifetime_Exit;
}
Dispatcher.UIThread.ShutdownStarted += ShutdownStarted;
}

/// <summary>
Expand Down Expand Up @@ -184,7 +180,7 @@ public bool IsVisible

internal ITrayIconImpl? Impl => _impl;

private static void Lifetime_Exit(object? sender, ControlledApplicationLifetimeExitEventArgs e)
private static void ShutdownStarted(object? sender, EventArgs? e)
{
var app = Application.Current ?? throw new InvalidOperationException("Application not yet initialized.");
var trayIcons = GetIcons(app);
Expand Down
4 changes: 2 additions & 2 deletions src/Avalonia.FreeDesktop/DBusTrayIconImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ private async void WatchAsync()
var nameOwner = await _dBus.GetNameOwnerAsync("org.kde.StatusNotifierWatcher");
OnNameChange("org.kde.StatusNotifierWatcher", nameOwner);
}
catch
catch (Exception e)
{
_serviceWatchDisposable = null;
Logger.TryGet(LogEventLevel.Error, "DBUS")
?.Log(this, "Interface 'org.kde.StatusNotifierWatcher' is unavailable.");
?.Log(this, "Interface 'org.kde.StatusNotifierWatcher' is unavailable.\n{Exception}", e);
}
}

Expand Down
27 changes: 0 additions & 27 deletions src/Browser/Avalonia.Browser/webapp/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading