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
parent a6efc0b8da
commit 02ff63341e
14 changed files with 1019 additions and 5 deletions

View File

@@ -9,6 +9,7 @@ import com.ts3client.sound.SoundNotifier;
import com.ts3client.sound.SoundPack;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JFileChooser;
@@ -76,6 +77,8 @@ final class NotificationsPanel extends JPanel {
private final JLabel packInfo = new JLabel();
private final JSlider volume;
private final JTextField packDirField;
private final JCheckBox desktopNotifications =
new JCheckBox("Show pokes and private messages as desktop notifications while in the background");
private final JTable table;
private final EventTableModel tableModel = new EventTableModel();
@@ -107,6 +110,7 @@ final class NotificationsPanel extends JPanel {
String directory = packDirField.getText().trim();
boolean rescan = !directory.equals(settings.soundPackDir);
settings.soundPackDir = directory;
settings.desktopNotifications = desktopNotifications.isSelected();
sounds.setPack((SoundPack) packCombo.getSelectedItem());
if (rescan) sounds.reload();
}
@@ -153,7 +157,14 @@ final class NotificationsPanel extends JPanel {
dirRow.add(packDirField, BorderLayout.CENTER);
dirRow.add(browse, BorderLayout.EAST);
packDirField.setToolTipText("Extra folder to look for sound packs in");
addRow(p, c, row, new JLabel("Extra pack folder:"), dirRow);
addRow(p, c, row++, new JLabel("Extra pack folder:"), dirRow);
desktopNotifications.setSelected(settings.desktopNotifications);
c.gridx = 0;
c.gridy = row;
c.gridwidth = 2;
p.add(desktopNotifications, c);
c.gridwidth = 1;
return p;
}