diff --git a/src/EchoHub.Client/AppOrchestrator.cs b/src/EchoHub.Client/AppOrchestrator.cs
index 9ac9b5c..7769d0a 100644
--- a/src/EchoHub.Client/AppOrchestrator.cs
+++ b/src/EchoHub.Client/AppOrchestrator.cs
@@ -27,6 +27,7 @@ public sealed class AppOrchestrator : IDisposable
private readonly ChatMessageManager _messageManager;
private readonly CommandHandler _commandHandler;
private readonly NotificationSoundService _notificationSound;
+ private readonly OsNotificationService _osNotification;
private readonly AudioPlaybackService _audioPlayback = new();
private readonly UpdateChecker _updateService;
private readonly ConnectionManager _conn = new();
@@ -65,6 +66,7 @@ public sealed class AppOrchestrator : IDisposable
_mainWindow = new MainWindow(app, _messageManager);
_commandHandler = new CommandHandler();
_notificationSound = new NotificationSoundService(config.Notifications);
+ _osNotification = new OsNotificationService();
_updateService = new UpdateChecker(app);
WireMainWindowEvents();
@@ -1105,6 +1107,9 @@ public sealed class AppOrchestrator : IDisposable
&& message.Content.Contains($"@{_session.Username}", StringComparison.OrdinalIgnoreCase))
{
_ = _notificationSound.PlayAsync();
+ string title = $"Mentioned by {message.SenderDisplayName ?? message.SenderUsername} in #{message.ChannelName}";
+ string body = message.Content.Length > 200 ? message.Content[..200] + "..." : message.Content;
+ _osNotification.Show(title, body);
}
};
diff --git a/src/EchoHub.Client/EchoHub.Client.csproj b/src/EchoHub.Client/EchoHub.Client.csproj
index 8e4bd85..7b52cb1 100644
--- a/src/EchoHub.Client/EchoHub.Client.csproj
+++ b/src/EchoHub.Client/EchoHub.Client.csproj
@@ -9,6 +9,7 @@
+
diff --git a/src/EchoHub.Client/Services/OsNotificationService.cs b/src/EchoHub.Client/Services/OsNotificationService.cs
new file mode 100644
index 0000000..3401aeb
--- /dev/null
+++ b/src/EchoHub.Client/Services/OsNotificationService.cs
@@ -0,0 +1,34 @@
+using OsNotifications;
+
+using Serilog;
+
+namespace EchoHub.Client.Services;
+
+public sealed class OsNotificationService
+{
+ static OsNotificationService()
+ {
+ Notifications.SetGuiApplication(true);
+ }
+
+ ///
+ /// Shows an OS notification with the given title and optional body.
+ ///
+ ///
+ ///
+ public void Show(string title, string? body = null)
+ {
+ try
+ {
+ Notifications.ShowNotification(title, body ?? string.Empty);
+ }
+ catch (PlatformNotSupportedException ex)
+ {
+ Log.Warning(ex, "OS notifications not supported on this platform");
+ }
+ catch (Exception ex)
+ {
+ Log.Warning(ex, "Failed to show OS notification");
+ }
+ }
+}