ErikReider / SwayNotificationCenter

A simple GTK based notification daemon for SwayWM
GNU General Public License v3.0
1.29k stars 62 forks source link

[Bug] urgent notifications ignore timeout #278

Closed hboetes closed 1 year ago

hboetes commented 1 year ago

Please read through the README and the Man pages before submitting Please also make sure that there isn't any prior issue describing this bug

Describe the bug urgent notifications ignore timeout

To Reproduce run notify-send -t 500 -u critical 'Battery low!' and see how the notification does not go away.

Expected behaviour Since I explicitly defined a timeout value, I'd expect the notification to disappear after the set time.

My code looks like this, so I make the thing blink, for something which I consider urgent.

while sleep 1; do
    notify-send -t 500 -u critical 'Battery low!'
done

Desktop:

ErikReider commented 1 year ago

Can you provide your config?

hboetes commented 1 year ago

That's the unedited config, straight from the git repo.

%  cat /etc/xdg/swaync/config.json
{
  "$schema": "/etc/xdg/swaync/configSchema.json",
  "positionX": "right",
  "positionY": "top",
  "layer": "overlay",
  "control-center-layer": "top",
  "layer-shell": true,
  "cssPriority": "application",
  "control-center-margin-top": 0,
  "control-center-margin-bottom": 0,
  "control-center-margin-right": 0,
  "control-center-margin-left": 0,
  "notification-2fa-action": true,
  "notification-inline-replies": false,
  "notification-icon-size": 64,
  "notification-body-image-height": 100,
  "notification-body-image-width": 200,
  "timeout": 10,
  "timeout-low": 5,
  "timeout-critical": 0,
  "fit-to-screen": true,
  "control-center-width": 500,
  "control-center-height": 600,
  "notification-window-width": 500,
  "keyboard-shortcuts": true,
  "image-visibility": "when-available",
  "transition-time": 200,
  "hide-on-clear": false,
  "hide-on-action": true,
  "script-fail-notify": true,
  "scripts": {
    "example-script": {
      "exec": "echo 'Do something...'",
      "urgency": "Normal"
    },
    "example-action-script": {
      "exec": "echo 'Do something actionable!'",
      "urgency": "Normal",
      "run-on": "action"
    }
  },
  "notification-visibility": {
    "example-name": {
      "state": "muted",
      "urgency": "Low",
      "app-name": "Spotify"
    }
  },
  "widgets": [
    "inhibitors",
    "title",
    "dnd",
    "notifications"
  ],
  "widget-config": {
    "inhibitors": {
      "text": "Inhibitors",
      "button-text": "Clear All",
      "clear-all-button": true
    },
    "title": {
      "text": "Notifications",
      "clear-all-button": true,
      "button-text": "Clear All"
    },
    "dnd": {
      "text": "Do Not Disturb"
    },
    "label": {
      "max-lines": 5,
      "text": "Label Text"
    },
    "mpris": {
      "image-size": 96,
      "image-radius": 12
    }
  }
}
ErikReider commented 1 year ago

The documentation states that setting the timeout-critical value to 0 disables the timeout.

You could run a script that replaces the notification after a set amount of time?

Example replacing script:

seq 100 | while read number; do                       
  notify-send -h int:value:$number -h string:synchronous:my-progress "Progress"
  sleep 0.3
done

Otherwise you could create a script that sends a critical notification, dismisses it and creates a new one, so on and so forth... :)

hboetes commented 1 year ago

I can understand that critical warning without specified timeout remains visible, but when I do specify a timeout I think it would make more sense if that timeout is honoured.

ErikReider commented 1 year ago

I can understand that critical warning without specified timeout remains visible, but when I do specify a timeout I think it would make more sense if that timeout is honoured.

I'm just following the spec

hboetes commented 1 year ago

Ah, I've found a great solution. Mako doesn't have this weird behaviour.