node-notifier icon indicating copy to clipboard operation
node-notifier copied to clipboard

timeout on GNU/Linux is in milliseconds, not seconds

Open nmschulte opened this issue 5 years ago • 4 comments

version 5.4.3

Specifying timeout: 5 on my machine causes the notification to "instantly" disappear. Using a timeout of 5000 has the desired effect of a 5 second timeout.

Also, using wait: true without timeout seems to have no effect.

cat /etc/debian_version

bullseye/sid

cat /etc/os-release

PRETTY_NAME="Debian GNU/Linux bullseye/sid"
NAME="Debian GNU/Linux"
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

uname -a

Linux desmas-l.desmas 5.2.0-2-amd64 #1 SMP Debian 5.2.9-1 (2019-08-18) x86_64 GNU/Linux

notify-send --version

notify-send 0.7.8

dunst --version

Dunst - A customizable and lightweight notification-daemon 1.4.1 (2019-07-03)

aptitude show libnotify-dev dunst

Package: libnotify-dev                   
Version: 0.7.8-1
State: not installed
Multi-Arch: same
Priority: optional
Section: libdevel
Maintainer: Debian GNOME Maintainers <[email protected]>
Architecture: amd64
Uncompressed Size: 79.9 k
Depends: libnotify4 (= 0.7.8-1), gir1.2-notify-0.7 (= 0.7.8-1), libglib2.0-dev (>= 2.26), libgdk-pixbuf2.0-dev
Breaks: libnotify-dev:i386 (!= 0.7.8-1)
Replaces: libnotify-dev:i386 (< 0.7.8-1)
Description: sends desktop notifications to a notification daemon (Development files)
 A library that sends desktop notifications to a notification daemon, as defined in the Desktop Notifications spec. These notifications can be used to inform the user about an event or display some form of information without getting in the user's way. 
 
 This package contains the include files and static library.
Tags: devel::library, role::devel-lib

Package: dunst
Version: 1.4.1-1
State: installed
Automatically installed: yes
Priority: optional
Section: x11
Maintainer: Nikos Tsipinakis <[email protected]>
Architecture: amd64
Uncompressed Size: 176 k
Depends: libc6 (>= 2.17), libcairo2 (>= 1.10.0), libgdk-pixbuf2.0-0 (>= 2.31.1), libglib2.0-0 (>= 2.35.8), libpango-1.0-0 (>= 1.14.0), libpangocairo-1.0-0 (>= 1.22.0), libx11-6, libxext6, libxinerama1, libxrandr2 (>= 2:1.5.0), libxss1, init-system-helpers (>= 1.52),
         default-dbus-session-bus | dbus-session-bus
Recommends: sensible-utils
Conflicts: dunst:i386
Provides: notification-daemon
Description: dmenu-ish notification-daemon
 Dunst is a highly configurable and lightweight notification-daemon: The only thing it displays is a colored box with unformatted text. The whole notification specification (non-optional parts and the "body" capability) is supported as long as it fits into this look &
 feel. 
 
 Dunst is designed to fit nicely into minimalistic windowmanagers like dwm, but it should work on any Linux desktop.
Homepage: https://dunst-project.org/
Tags: uitoolkit::gtk

nmschulte avatar Aug 22 '19 14:08 nmschulte

Hi @nmschulte! Thanks for raising the issue. What resolution would you want for this? Also, are you using node-notifier in the generic cross-platform way or are you using the platform specific option?

We've currently got a note in the readme about the lack of wait support in notify-send (which I guess we could add if that's desired... wait is just a predefined timeout).

I hesitate to have timeout automatically convert to seconds (aka multiply the passed in value by 1000) since that'd be a breaking change, but I'd be open to adding a timeout-seconds flag that you can use for notify-send that will convert for you?

jnielson94 avatar Nov 14 '19 21:11 jnielson94

Using node-notifier in the generic cross-platform way; notifier.notify({ timeout: 5 }). I imagined a breaking change to make Linux/notify-send timeout option work generically; multiply the value by 1000 before passing along to notify-send/... I've already worked around the issue for myself.

An alternative option would work well too, of course. timeout-seconds, or perhaps timeout-milliseconds if the timeouts are not meant to support fractional values.

nmschulte avatar Nov 14 '19 21:11 nmschulte

Ah, what did you do in your project to work around it?

I'm currently leaning towards timeout-seconds but I'll have to chat with @mikaelbr to see what he thinks of breaking change to make it more cross-platform or splitting the platforms a little more with different options 🤷‍♂

jnielson94 avatar Nov 14 '19 21:11 jnielson94

I simply stopped relying on the feature. Admittedly not the ideal solution.

Also, you could "bundle" the "quirks" under an option: enable-quirks, enable-fixes, etc. By this I mean, instead of introducing a parallel option (timeout + timeout-seconds), you could alter the behavior of timeout (and any other API-breaking changes/fixes) with a new option (a la enable-fixes).

nmschulte avatar Nov 14 '19 22:11 nmschulte