https://bugs.kde.org/show_bug.cgi?id=517489

            Bug ID: 517489
           Summary: ** Expose a `ClearHistory()` DBus method in
                    `org.kde.NotificationManager`
    Classification: Plasma
           Product: plasmashell
      Version First master
       Reported In:
          Platform: Arch Linux
                OS: Linux
            Status: REPORTED
          Severity: wishlist
          Priority: NOR
         Component: Notifications
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
  Target Milestone: 1.0

Currently, there is no programmatic way to clear the notification history in
Plasma 6. The `org.freedesktop.Notifications` interface exposed by plasmashell
only provides `CloseNotification(uint id)`, which closes individual active
notifications but does not affect the history stored in memory by
`libnotificationmanager`.

This makes it impossible to automate history cleanup (e.g., via a systemd
timer, a script, or a third-party application) without restarting
`plasmashell`, which is disruptive.

**Suggested solution:**

Add a `ClearHistory()` method to the `org.kde.NotificationManager` DBus
interface, already present at `/org/freedesktop/Notifications`.

The implementation would live in `libnotificationmanager`, specifically:
- `server_p.cpp` — register the new DBus method
- `notificationsmodel.cpp` — implement the actual history clearing logic

Pseudocode of expected behavior:

```
// DBus interface: org.kde.NotificationManager
// Object path: /org/freedesktop/Notifications

method void ClearHistory()
    notificationsModel.removeAll(where: isExpired OR isPersistent)
    emit HistoryCleared()
```

Expected DBus call from userspace:

```bash
qdbus6 org.kde.plasmashell /org/freedesktop/Notifications \
    org.kde.NotificationManager.ClearHistory
```

This would enable simple automation such as a systemd user timer:

```ini
# ~/.config/systemd/user/clear-notifications.service
[Service]
Type=oneshot
ExecStart=qdbus6 org.kde.plasmashell /org/freedesktop/Notifications \
          org.kde.NotificationManager.ClearHistory
```

**Optionally**, a variant accepting a max-age argument would be even more
flexible:

```
method void ClearHistory(uint olderThanSeconds)
    // removes only notifications older than the given threshold
```

**Steps to reproduce / verify the gap:**

1. Run: `qdbus6 org.kde.plasmashell /org/freedesktop/Notifications`
2. Observe that `org.kde.NotificationManager` only exposes `InvokeAction`,
`RegisterWatcher`, and `UnRegisterWatcher` — no method to clear or expire
history entries.

**Why this matters:**

Users may want to clear notification history periodically for privacy reasons,
to reduce clutter, or as part of automated workflows. The infrastructure is
already in place; this is a small and self-contained addition.

**Environment:**
- Plasma 6
- Arch Linux (fully updated)
- Wayland session

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to