Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support transient notifications #102

Merged
merged 2 commits into from
Sep 29, 2021

Conversation

yajo
Copy link
Contributor

@yajo yajo commented Mar 15, 2021

With this patch, if the user does set -U __done_notification_transient 1, these will disappear automatically on Linux systems.

See https://gist.github.com/carsondarling/6217755 for details.

With this patch, if the user does `set -U __done_notification_transient 1`, these will disappear automatically on Linux systems.
@franciscolourenco
Copy link
Owner

@yajo I'm thinking transient notifications should be the default, no?

@ammgws
Copy link
Contributor

ammgws commented Mar 15, 2021

https://gitlab.freedesktop.org/xdg/xdg-specs/-/blob/master/notification/notification-spec.xml#L780

When set the server will treat the notification as transient and by-pass the server's persistence capability, if it should exist.

Does this mean this would override a user's timeout/etc settings in their notification daemon config?

Hints are a way to provide extra data to a notification server that the server may be able to make use of.
Neither clients nor notification servers are required to support any hints. Both sides should assume that hints are not passed, and should ignore any hints they do not understand. The following table lists the standard hints as defined by this specification. Future hints may be proposed and added to this list over time. Once again, implementations are not required to support these.

What notification daemons currently implement this? A quick test with and grep of mako seemed to suggest it wasn't implemented there. Dunst?

Not sure about how other notification daemons are configured, but couldn't a user just set all notifications from done to have the specific timeout they wish in their notification daemon config? IIRC it should be possible with both mako and dunst.

@yajo
Copy link
Contributor Author

yajo commented Mar 15, 2021

transient notifications should be the default, no?

I think so, I was just trying to do the least aggressive PR possible.

Does this mean this would override a user's timeout/etc settings in their notification daemon config?

I think that means that the notification disappears. At least, that's what happens for me.

Over time, opening the notifications panel and seeing it full of 1 notification for each command that lasted more than 5 seconds is annoying. These bury the important notifications, or force me to click on them to avoid that accumulation, while I just want to know the command finished, with nothing more.

What notification daemons currently implement this?

On GNOME 3.38.4 this works. And some older GNOME versions too.

implementations are not required to support these

So we could make this not optional, and just pass the hint always, so if the notification manager understands it, the notification will disappear; and if it doesn't... well, it'll be the same as until today. Does that sound reasonable?

@nzig
Copy link

nzig commented Mar 25, 2021

+1 for making this the default.

@franciscolourenco
Copy link
Owner

@yajo are you positive that the hint will be ingored by implementations which don't support it? Thanks!

@yajo
Copy link
Contributor Author

yajo commented Apr 6, 2021

According to the spec:

Neither clients nor notification servers are required to support any hints. Both sides should assume that hints are not passed, and should ignore any hints they do not understand.

To my understanding, it should break nothing. But I have to admit I didn't test this on any other implementations.

@yajo
Copy link
Contributor Author

yajo commented May 19, 2021

So, anything else left to merge this?

@franciscolourenco
Copy link
Owner

@yajo we would need a manual test at at least in another implementation

@yajo
Copy link
Contributor Author

yajo commented Sep 8, 2021

There you have:

KDE, running notify-send --hint=int:transient:1 --urgency=normal --icon=utilities-terminal --app-name=fish title message

notify

@yajo
Copy link
Contributor Author

yajo commented Sep 10, 2021

So, could we merge?

@yajo
Copy link
Contributor Author

yajo commented Sep 29, 2021

Hello, is there anything left here to merge?

@franciscolourenco
Copy link
Owner

Hi @yajo sorry for the delay and thank you for pinging me on this. Let's merge! 🙏

@franciscolourenco franciscolourenco merged commit 4864b1c into franciscolourenco:master Sep 29, 2021
@yajo yajo deleted the patch-1 branch September 29, 2021 15:45
@khaveesh
Copy link

mako supports the --expire-time flag of notify-send. So, my suggestion would be to send both this and the current transient hint to cover all possible implementations.

@franciscolourenco
Copy link
Owner

@khaveesh any chance providing options which are not supported might result in an error?

@khaveesh
Copy link

From notify-send manpage:

       -t, --expire-time=TIME
           The duration, in milliseconds, for the notification to appear on screen.

           (Ubuntu's Notify OSD and GNOME Shell both ignore this parameter.)

So, it shouldn't result in an error

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.

5 participants