Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions cosmic-notifications-config/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::collections::HashSet;

use cosmic_config::{CosmicConfigEntry, cosmic_config_derive::CosmicConfigEntry};

pub const ID: &str = "com.system76.CosmicNotifications";
Expand All @@ -19,6 +21,8 @@ pub enum Anchor {
#[version = 1]
pub struct NotificationsConfig {
pub do_not_disturb: bool,
/// App IDs allowed to bypass DND.
pub do_not_disturb_overrides: HashSet<String>,
pub anchor: Anchor,
/// The maximum number of notifications that can be displayed at once.
pub max_notifications: u32,
Expand All @@ -36,6 +40,7 @@ impl Default for NotificationsConfig {
fn default() -> Self {
Self {
do_not_disturb: false,
do_not_disturb_overrides: HashSet::default(),
anchor: Anchor::default(),
max_notifications: 3,
max_per_app: 2,
Expand Down
8 changes: 7 additions & 1 deletion src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,13 @@ impl CosmicNotifications {
iced::Task::none()
}];

if self.cards.is_empty() && !self.config.do_not_disturb {
if self.cards.is_empty()
&& (!self.config.do_not_disturb
|| self
.config
.do_not_disturb_overrides
.contains(&notification.app_name))
{
let (anchor, _output) = self.anchor.clone().unwrap_or((Anchor::TOP, None));
self.active_surface = true;
tasks.push(get_layer_surface(SctkLayerSurfaceSettings {
Expand Down