Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/Neptuo.Productivity.SnippetManager.Avalonia/TrayIcon.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.IO;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Threading;
using Neptuo.Productivity.SnippetManager.Plugins;
using NativeMenu = Avalonia.Controls.NativeMenu;
using NativeMenuItem = Avalonia.Controls.NativeMenuItem;
Expand Down Expand Up @@ -193,9 +194,17 @@ public void AddSeparator()

private void OnHookFailed(string message)
{
trayIcon.ToolTipText = $"Snippet Manager — {message}";
if (hotkeyMenuItem != null)
hotkeyMenuItem.Header = "Hotkey unavailable";
void UpdateUi()
{
trayIcon.ToolTipText = $"Snippet Manager — {message}";
if (hotkeyMenuItem != null)
hotkeyMenuItem.Header = "Hotkey unavailable";
}

if (Dispatcher.UIThread.CheckAccess())
UpdateUi();
else
Dispatcher.UIThread.Post(UpdateUi);
}

private void ToggleHotkey()
Expand Down
Loading