Browse Source

Merge pull request #11591 from affederaffe/fix-dbus-tray-icon

Fix DBus Tray Icon when the org.kde.StatusNotifierWatcher service is unavailable
pull/11597/head
Jumar Macato 3 years ago
committed by GitHub
parent
commit
57eb77b474
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      src/Avalonia.FreeDesktop/DBusTrayIconImpl.cs

8
src/Avalonia.FreeDesktop/DBusTrayIconImpl.cs

@ -60,9 +60,9 @@ namespace Avalonia.FreeDesktop
{ {
try try
{ {
_serviceWatchDisposable = await _dBus!.WatchNameOwnerChangedAsync((_, x) => OnNameChange(x.Item2)); _serviceWatchDisposable = await _dBus!.WatchNameOwnerChangedAsync((_, x) => OnNameChange(x.Item1, x.Item3));
var nameOwner = await _dBus.GetNameOwnerAsync("org.kde.StatusNotifierWatcher"); var nameOwner = await _dBus.GetNameOwnerAsync("org.kde.StatusNotifierWatcher");
OnNameChange(nameOwner); OnNameChange("org.kde.StatusNotifierWatcher", nameOwner);
} }
catch catch
{ {
@ -72,9 +72,9 @@ namespace Avalonia.FreeDesktop
} }
} }
private void OnNameChange(string? newOwner) private void OnNameChange(string name, string? newOwner)
{ {
if (_isDisposed || _connection is null) if (_isDisposed || _connection is null || name != "org.kde.StatusNotifierWatcher")
return; return;
if (!_serviceConnected & newOwner is not null) if (!_serviceConnected & newOwner is not null)

Loading…
Cancel
Save