Notify of pokes and private messages on the desktop

While none of the client's windows has the focus, a poke or a private
message shows a desktop notification, which the desktop's notification
centre keeps. A private conversation keeps one notification, updated as
messages come; clicking it brings the window forward with that chat open,
and they all go once a window of the client is in front again.

On Linux they go to the freedesktop.org notification service, spoken to
over the session bus by a small D-Bus client of our own on Java's Unix
sockets, so no library or native code is involved; Plasma also takes a
reply typed into the notification. Elsewhere they are AWT tray messages,
which Windows and macOS put in their notification centres. The options
can turn them off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-26 15:20:51 +00:00
co-authored by Claude Opus 5.5
parent a6efc0b8da
commit 02ff63341e
14 changed files with 1019 additions and 5 deletions
@@ -0,0 +1,36 @@
package com.ts3client.ui;
import com.ts3client.notify.desktop.DesktopNotifications;
import com.ts3client.ui.tray.AwtTray;
/**
* Desktop notifications as messages from AWT's tray icon, for Windows and macOS: they
* land in the system's notification centre. A message cannot be replaced or taken back.
*/
final class TrayNotifications implements DesktopNotifications {
private final AwtTray tray;
TrayNotifications(AwtTray tray) {
this.tray = tray;
}
@Override
public int show(Notice notice, int replaces) {
tray.showMessage(notice.title(), notice.body(), notice.onOpen());
return 1;
}
@Override
public void close(int id) {
}
@Override
public boolean canReply() {
return false;
}
@Override
public void shutdown() {
}
}