From 51da158ad6a4a6f289a661b234d88c8520a71528 Mon Sep 17 00:00:00 2001 From: affederaffe <68356204+affederaffe@users.noreply.github.com> Date: Wed, 31 May 2023 21:10:34 +0200 Subject: [PATCH] Fix DBus Tray Icon when the org.kde.StatusNotifierWatcher service is unavailable --- src/Avalonia.FreeDesktop/DBusTrayIconImpl.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Avalonia.FreeDesktop/DBusTrayIconImpl.cs b/src/Avalonia.FreeDesktop/DBusTrayIconImpl.cs index 9abf4f97a7..61e46b651e 100644 --- a/src/Avalonia.FreeDesktop/DBusTrayIconImpl.cs +++ b/src/Avalonia.FreeDesktop/DBusTrayIconImpl.cs @@ -60,9 +60,9 @@ namespace Avalonia.FreeDesktop { 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"); - OnNameChange(nameOwner); + OnNameChange("org.kde.StatusNotifierWatcher", nameOwner); } 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; if (!_serviceConnected & newOwner is not null)