dglent / meteo-qt

System tray application for weather status information
GNU General Public License v3.0
82 stars 21 forks source link

Notifications don't respect markup #122

Open kanyck opened 2 years ago

kanyck commented 2 years ago

While on mouse-over it renders just fine (on the dark gray background), change notifications are shown with tags (on the yellow background) as follows: screenshot1 You can see <b> tags instead of bold font.

dglent commented 2 years ago

I saw this in iceWM but not in LXQt Which DE do you use ? I'm afraid that is DE depended, but i try to workaround the (deactivate) rich html if the DE does not support them in notifications

kanyck commented 2 years ago

No DE. Crafted handmade Compiz standalone + tint2)) No idea if it uses libnotify.

kanyck commented 2 years ago

Tried to replace notification-daemon with dunst that supposed to accept html tags -- no difference. What do you use to show notifications? UPD: my bad. Typing faster than thinking)) Notification position suggests that probably it's not notification-daemon who shows the notification.

dglent commented 2 years ago

The notifications are shown by QSystemTrayIcon After i suppose that QT communicate the message to the system's notifier. I don't define if it will be in plain or rich text somewhere (i d'on't think that this is possible). So it is defined by the host tray (?) I show that in icewm the notification bubble doesn't use rich text. Probably some notification systems doesn't support rich formating, maybe is better to detect (by having a list of supported DE ... ?) and deactivated the html tags.

kanyck commented 2 years ago

It looks like it works as supposed -- the spec states plain text for balloon:

void QSystemTrayIcon::showMessage(const QString &title, const QString &message, QSystemTrayIcon::MessageIcon icon = QSystemTrayIcon::Information, int millisecondsTimeoutHint = 10000)

Shows a balloon message for the entry with the given title, message and icon for the time specified in millisecondsTimeoutHint. title and message must be plain text strings.
kanyck commented 2 years ago

Well, probably this may be the answer https://stackoverflow.com/questions/5805081/qt-how-to-make-decorated-rich-popup-window-instead-the-default-qsystemtrayicon

dglent commented 2 years ago

So it means that in order to use rich text everywhere it needs the usage of a widget which will be shown at the area of the tray icon. This is interesting approach as the widget can contain whatever element, as the icon of the weather... The rich text in balloons message of the system tray is managed by the DE, if i'm not wrong in LXQt is here: https://github.com/lxqt/lxqt-notificationd/blob/9b46ceee1222f119328aba20b94febc8b2bc0aa1/src/notification.cpp#L148

kanyck commented 2 years ago

I may try to replace notification-daemon with lxqt-notification in a shout while. Will let you know about the result))

kanyck commented 2 years ago

Well, it didn't help. Apparently meteo-qt don't use these daemons for notification. (both lxqt-notificationd and notification-daemon do understand <b> tags, when I issue notify-send "Summary" "Notification <b>text</b>." I can see "text" in bold, but the form and placing of the balloon differ from meteo-qt shows).

dglent commented 2 years ago

I found this: https://code.woboq.org/qt5/qtbase/src/widgets/util/qsystemtrayicon.cpp.html#513 I understand that It depends in the config of qt and maybe in lxqt is configured differently (to support plain text), i 'll try to find if there is a specific configuration in the DE

BeholdersEye commented 2 months ago

Any progress here? The "<b>"...</b> tags in the notification are the only flaws I perceive with this software.

Seems to me the obvious solution is to remove the inline tags since:

  1. As kanyck mentioned, the spec says "title and message must be plain text strings".

  2. They are not serving their intended function: Making the text bold.

dglent commented 2 months ago

I can add an option in the settings to disable the formatting. I think that you reproduce it only in the notification with the Tomorrow here: https://github.com/dglent/meteo-qt/blob/acdd3efc6e91a466231fba7bc608b775afaa760a/meteo_qt/meteo_qt.py#L70C26-L70C30 right ? Because the alerts don't work any more with the free openweathermap key In this case, to not wait the evolution you can remove the tags manually (i don't know if you are comfortable or not to modify the code)

dglent commented 2 months ago

Or if you use a translation version you can modify locally the translation file Example for French language: https://translate.lxqt-project.org/translate/dglent/meteo-qt/fr/?offset=1&q=tomorrow&sort_by=-priority%2Cposition&checksum=