Bug 456422 - introduce clean solution for notification popups without summary
Summary: introduce clean solution for notification popups without summary
Status: RESOLVED NOT A BUG
Alias: None
Product: plasmashell
Classification: Plasma
Component: Notifications (show other bugs)
Version: 5.24.5
Platform: Debian unstable Linux
: NOR wishlist
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-07-06 23:48 UTC by Oswald Buddenhagen
Modified: 2022-07-14 16:40 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Oswald Buddenhagen 2022-07-06 23:48:54 UTC
i'm displaying notifications about new mails. i want to keep the visual clutter down, so the application name is abused to say "new mail in <box>", the summary says "from: <address>" and the body says "*subject:* <subject>". the problem with that is that the summary is completely in bold, which makes it use too much space, and looks just ugly.

making the app name empty would be somewhat pointless, as a) that would not really save much screen real estate, as the notification's age and close button are displayed in the same line and b) the summary would then say "new mail ..." in bold, which is again needless clutter (the notifications are visually distinct due to their body).

so a better solution would be permitting omitting the summary. pedantically, plasma actually allows empty summaries, and the spec does not explicitly forbid it, but it goes against the spirit of the spec, which aims to be presentation-agnostic. and the notify-send tool (from libnotify-bin) does enforce a non-empty summary.

so i think a solution which would be clean enough to upstream into the spec would be introducing a new boolean notification hint, say redundant-summary, which being true would mean that the summary should be omitted if the body is also displayed.
Comment 1 Nate Graham 2022-07-13 18:09:07 UTC
>  so the application name is abused to say "new mail in <box>", the summary says "from: <address>"
> and the body says "*subject:* <subject>". the problem with that is that the summary is completely in
> bold, which makes it use too much space, and looks just ugly.
I think this is kind of your own problem, right? You admit you're abusing the notification popup. :) 

It would make more sense to me if the summary (which is always bold) was used to display the subject line of the email. But this is up to the app that sends the notification; it determines what goes into the summary and what goes into the body. If that app is under your control, I think you should experiment with doing it that way.
Comment 2 Oswald Buddenhagen 2022-07-13 18:51:56 UTC
don't try to be so clever. the only abuse is in the exact use of the parameters, because their intended usage isn't optimized for my use case.

swapping subject and body would make the issue even worse, as the subject is usually longer than the from address, which would mean even more bold text.

i'm now using

        gdbus call --session --dest org.freedesktop.Notifications --object-path /org/freedesktop/Notifications --method org.freedesktop.Notifications.Notify "New mail in INBOX" 0 "mail-unread-new" "" '<b>From:</b> fooish.bar@baz.com<br/><b>Subject:</b> earn millions in one day!!!11!' [] {} 15000
 
which produces a really neat result.
it's just too bad that this relies on undocumented, out-of-spec, kde-specific behavior.
Comment 3 Nate Graham 2022-07-14 16:26:39 UTC
You're absolutely abusing the notifications by putting the subject in the header, which is normally where the app name goes. Without the app name, the user can't tell what app sent the notification. An app that does this looks malicious, like it's trying to hide its identity. I recommend against doing that.

That said, ultimately being able to omit the summary so that you can style the body however you want does seem reasonable to me. I'll let the maintainer decide further.
Comment 4 Kai Uwe Broulik 2022-07-14 16:32:13 UTC
Plasma's notifications also hides the summary if it matches the displayed application name.

$ notify-send "New Mail" "You got mail" -a "New Mail"

If you want to propose an addition to the notification spec, feel free to do so over at XDG: https://gitlab.freedesktop.org/xdg/xdg-specs/-/merge_requests/ – good luck!
Comment 5 Oswald Buddenhagen 2022-07-14 16:40:46 UTC
@nate:
it's a weee bit over the top to call this malicious. if somebody had thought that this is a security or otherwise issue, the spec wouldn't make it so easy to "fake" it. and "New mail in ..." certainly is a good enough identification of the "app". also, this is a local script of mine, so literally no-one cares.

@kai:
that's also a hack, and not much better than what i already do (though it has the advantage of working with notify-send).

deferring to XDG is just a way to say FU. this is a process that has to be actively driven by an actual downstream implementer.