Skip to content

feat(notification): toggle visible notifications on DND - #3701

Draft
MaksRawski wants to merge 1 commit into
noctalia-dev:mainfrom
MaksRawski:main
Draft

feat(notification): toggle visible notifications on DND#3701
MaksRawski wants to merge 1 commit into
noctalia-dev:mainfrom
MaksRawski:main

Conversation

@MaksRawski

Copy link
Copy Markdown

Summary

Hide visible notifications the moment DND is enabled and show them again when DND is disabled.

Motivation

Imagine you're showing someone something on your computer irl, and you get a text from someone that you quickly recognize that you would prefer to not be seen by the person next to you.
You quickly hit your toggle DND keybind as you clearly forgot to do it beforehand.
After you're done showing whatever it was, you toggle DND and get to read that text in peace.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Refactoring
  • Build / packaging

Testing

Manually tested with notify-send. just test also passes.

Manual Coverage

  • Tested on Niri
  • Tested on Hyprland
  • Tested on Sway
  • Tested on another compositor:
  • Tested with different bar positions and density settings
  • Tested at different interface scaling values
  • Tested with multiple monitors

Checklist

  • This PR is ready for review, or it is marked as Draft.
  • I read and followed the relevant guidance in CONTRIBUTING.md.
  • I ran just format with clang-format v22+ installed, or this PR has no code changes.
  • I ran the relevant build or test commands, or explained why they were not run.
  • I self-reviewed the changes.
  • I checked for new warnings or errors.
  • I will update end-user documentation after merge, or this PR does not change user-facing configuration or behavior.
  • I added or updated assets/translations/en.json, or this PR adds no new user-facing strings.
  • I did not edit non-English translation files unless this PR is explicitly for translation tooling, an import/export sync, or a maintainer-requested locale change.
  • I used the existing canonical names for config keys, IPC names, paths, and identifiers.

@ItsLemmy

Copy link
Copy Markdown
Collaborator

Thanks for the PR. I like the idea, this has already happened to me too.

  1. All DND transition paths must hide active toasts

The PR calls dndToggled() only from application_ipc.cpp. The control-center button and internal shortcut call
NotificationManager::toggleDoNotDisturb() directly, so they bypass the new behavior. Toast visibility should be connected to the canonical DND state transition so every toggle path behaves consistently.

  1. Pending additions must not appear after DND is enabled

A notification already in m_pendingAdds can be flushed after the toggle because enabling DND does not clear it and flushPendingAdds() does not re-check the DND state. Clear pending additions when enabling DND or guard the flush.

More importantly, we do not want to introduce any replay of hidden toasts when DND is disabled.

Notifications are already retained in notification history, which is the appropriate place to read notifications missed while DND was active.
Reconstructing old toast state introduces substantial lifecycle complexity: notifications may be replaced or closed while hidden, expiry state must be preserved, and queued entries can expire or reappear unexpectedly.

The intended behavior is:

  • Enabling DND immediately hides currently displayed toast popups while leaving their notifications in history.
  • Disabling DND does not show those popups again.
  • Only notifications received after DND is disabled may create new toast popups.

@ItsLemmy
ItsLemmy marked this pull request as draft July 30, 2026 01:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants