telegramdesktop / tdesktop

Telegram Desktop messaging app
https://desktop.telegram.org/
Other
26.03k stars 5.17k forks source link

Use native notifications in Linux #91

Closed edubxb closed 7 years ago

edubxb commented 10 years ago

Use the desktop native notification system in Linux to a better user experience.

tanwald commented 9 years ago

For most distributions this could be achieved by implementing the org.freedesktop.Notifications interface (https://developer.gnome.org/notification-spec/).

hai-nguyen-van commented 9 years ago

Or just use libnotify library which is the official notification library for most distributions (incl. Ubuntu). You can for instancen have a look at GNotifier (authored by @mkiol) which transfers Firefox/XUL notifications to generic system notifications.

ezdev128 commented 9 years ago

I'm fully agree wih @EmptyStackExn about libnotify. Also, it's good to have a choice between Telegram's notifications and OS's system (notify)

bardo commented 9 years ago

This would be great for UI consistency and it would also allow for free notification customization.

lindhe commented 9 years ago

That would be great! The notifications that are now always obscures the input field for me.

png2378 commented 9 years ago

That would be very cool!

beamju commented 9 years ago

:+1:

Also needs support for gnome 3.16 notifications that can work like that:

image here

AsavarTzeth commented 9 years ago

I too would love to see a libnotify implementation of Telegram notifications. If I am not misstaken, it should have easy to use bindings for QT.

davcri commented 9 years ago

:+1:

Clementine (a multiplatform/Qt music player) leaves choice to the user. Source code can be found here https://github.com/clementine-player/Clementine

img

ghost commented 9 years ago

Notification like Clementine is a clever idea :+1:

davcri commented 9 years ago

I just discovered a nice project for notifications and Qt: https://github.com/Snorenotify/Snorenotify. I don't know if it can be really useful for this purpose, but it's good to take a look.

WhyNotHugo commented 9 years ago

@davcri Looks like they support the XDG desktop notifications, so it'd work great, plus, notifications for other non-X OSs come for free.

SanKro commented 9 years ago

Problem is that telegram dont link to external souces. its one binary blob with all dependencies inside. thats not always possible with licenses other projects (like snorenotify)

senpos commented 9 years ago

Would be nice to see.

imcatwhocode commented 9 years ago

It will be very nice feature.

l4rzy commented 9 years ago

The native notification looks good on Windows 10. it will be great on Linux, too :+1: Take a look at libnotify https://developer.gnome.org/libnotify/unstable/NotifyNotification.html

auchri commented 9 years ago

@davcri I'm not sure, but does Snorenotify use the same license (LGPL-3) as Qt?

If yes, why we cannot use it? @SanKro

davcri commented 9 years ago

Yes it seems to use LGPL3: https://github.com/Snorenotify/Snorenotify/blob/master/COPYING.LGPL-3

auchri commented 9 years ago

So it should be no problem to implement it in telegram desktop?

davcri commented 9 years ago

I'm not very experienced with these things, but I don't find any problem in using it.

WhyNotHugo commented 9 years ago

Indeed using it would not cause any licensing issues. LGPL allows you to link to it freely. Any changes made to the library must be shared under the LGPL alike (though you usually don't need to modify it).

Also, since tdesktop is GPL, this library should not bring any controversy or dislikes amongst authors either.

nortexoid commented 9 years ago

The Qt build of QupZilla also allows the use of native or its own notifications.

sergioad commented 9 years ago

:+1: I want to see native notiffications for Linux too and maybe an option to use a non native titlebar (like Chrome or Vivaldi) with the same colour of the app's toolbar, I want a more consistent and good looking app, Windows has EVEN the amazing GNOME liike client side decorations and we do not have them having GNOME one of the first desktops wich fully adopted the CSDs; maybe we can not use a CSD looking app because of Fluxbox Openbox and KDE but maybe the posibility to use a Chrome like non native titlebar could be really good

@auchri could you see what to do with the notiffications and the titlebar? also if you make TDesktop compatible with KfileChooser and Gnome file chooser and use them on KDE and GNOME respectively instead of the generic Qt file chooser and fuse the hide / show Telegram Desktop menu entries on the tray icon's rght click menu I will thank to you a lot

And me too, I do not use a lot TDesktop because of the lack of native notiffications, I use mostly Cutegram but it does not works at all for me on Ubuntu so I use TDesktop on Ubuntu derivates

bestbug456 commented 8 years ago

Hope you will implement soon this feature!

EvelynSubarrow commented 8 years ago

++ It blocks both my clock and my view of weechat's input. For now I've disabled notifications, but this isn't my preference.

psamim commented 8 years ago

+1. Telegram's notification is displayed on the chat messages! So I cannot chat if a notification appears. We need full control and a native notification system.

WhyNotHugo commented 8 years ago

Indeed, the lower corners are the most annoying possible. Any time I need to use a terminal, or a chat window, that's where my cursor is, and telegram keeps popping up notifications on top of it.

What's worse, unlike my native notifications, there's not hotkey to close them, so I need to stop working, grab my mouse, and point-and-click. It's absurdly annoying.

sergioad commented 8 years ago

@telegramdesktop please add them :smile:

ghost commented 8 years ago

I too would like this. It would provide us with a much better way to see missed notifications without opening the app and they would appear on the lockscreen as well. Hope you'll implement this soon.

nortexoid commented 8 years ago

One way to get native notifications is to use the web app, and install the Firefox extension/add-on called "Gnotifier" which lets Firefox use your system's native notification system. Not ideal since you can't access telegram from your system tray, but better than non-native notifications if you ask me.

nortexoid commented 8 years ago

Over a year old, lots of discussion, presumably not difficult to implement, and yet not a single comment by telegramdesktop. Don't get your hopes up!

fbt commented 8 years ago

Would also be nice to have telegram set the WM urgency flag btw.

nortexoid commented 8 years ago

Perhaps this is relevant for developers: https://github.com/KDE/snorenotify

Igetin commented 8 years ago

+1.

Legitimately wondering what is the reason @telegramdesktop even uses GitHub if absolutely no comments on their part are given to this issue in a whole year.

telegramdesktop commented 8 years ago

@Igetin Because it is a good way of holding an open source project :) issues are hold open mostly for critical bug reports. Talking about that particular issue — "I didn't get to it yet".

WhyNotHugo commented 8 years ago

@Igetin FWIW, nobody has come up with a patch/push-request for this either. This issue here means it's open for anyone interested to fix it, but it seems that nobody interested and knowledgeable enough has come around, regrettably.

AlessandroLongo commented 8 years ago

@sergioad maybe you are interested in this Plasma tricks: custom title bars for apps and some consistency

sergioad commented 8 years ago

@AlessandroLongo cool, thanks for the tip :smile:

telegramdesktop commented 8 years ago

@mrshadowtux I'll try to use this thing some day:

https://developer.gnome.org/libnotify/0.7/NotifyNotification.html

if it uses what you want, then this will be done. If not — I'm not sure.

SanKro commented 8 years ago

@telegramdesktop wouldnt it be better to use https://techbase.kde.org/Projects/Snorenotify

cause of:

Backends Windows Toast Notification OSX Notification Center Free Desktop Notifications (this one is what libnotify does) Growl Snarl Integrated Notification Backend System Tray

on top of that its Qt already. so you would have native notifications on all plattforms.. not linux only

auchri commented 8 years ago

@SanKro see my comment here: https://github.com/telegramdesktop/tdesktop/issues/1610#issuecomment-183979008 :smile:

@telegramdesktop Why don't use something like https://github.com/KDE/snorenotify? The licence of Snorenotify is also compatible with the licence of tdesktop.

PandorasFox commented 8 years ago

@telegramdesktop that is indeed what I was thinking of - libnotify's binary is notify-send and sends the notification to the user's notification daemon and allows for native notifications.

@auchri that's not native notifications; it doesn't support Linux's notification daemons. For example here - libnotify is an implementation of the desktop notification standard; snorenotify doesn't list that as one of their backends and won't be native.

nevermind, I missed the freedesktop notifs. I needed coffee.

SanKro commented 8 years ago

@Arcaena you're wrong. snorenotify uses dbus to communicate. thats the freedesktop standard. Telegram+snorenotify integrated > dbus > usersdesktop

on your side it would be like this telegram > bash > notify-send > dbus > userdesktop

libnotify has also the disadvantage that you need to have it (wich is only a GTK desktop thing, cause no Qt desktop has it preinstalled.. there is no need for).

snorenotify can be integrated into the telegram binary and used on windows and osx too without dependencies outside...

so from the users point of view its much better to use snorenotify from devs pov its even more secure because it communicates directly with dbus, not with an external pipe + external dependency...

@telegramdesktop

PandorasFox commented 8 years ago

actually yeah, I looked at the snorenotify docs before I had my coffee and completely missed it listed in their supported backends, so it should work fine. My bad.

auchri commented 8 years ago

And @telegramdesktop would not have to write the notification code for every platform

WhyNotHugo commented 8 years ago

Regrettably, I'm far from being proficient with C++, but for someone who is, using snorenotify shouldn't be too complex:

https://github.com/KDE/snorenotify#qmake http://hannah.von-reth.de/snorenotify/doc/0.7.0/classSnore_1_1Notification.html

From what I can tell, Telegram/SourceFiles/window.cpp is where Notifications are call, but I may be mistaken.

1358 commented 8 years ago

using Snorenotify is incredibly easy: https://github.com/jendas1/Snorenotify/blob/master/examples/Simplest%20notification/main.cpp

telegramdesktop commented 8 years ago

@auchri it doesn't look that good.

For example it does not support reply from notification on OS X, no subtitles and thumb images in OS X notifications (all this is already in tdesktop) and in Win10 notifications (which I hope to add in the near future) + it requires shipping of additional binaries on Windows (which is not an option with current way of the autoupdating and everything works) + I don't see options to remove already shown notification (at least in OS X).

I didn't yet look if it does play well with Qt static linking (there are some problems with plugins in that approach as I know). But it looks like supporting libnotify on the systems where it is (dynamically loaded) is better for tdesktop.

mrshadowtux commented 8 years ago

Loading it dynamically would be perfectly fine, no need to link it static

WhyNotHugo commented 8 years ago

For example it does not support reply from notification on OS X, no subtitles and thumb images in OS X notifications (all this is already in tdesktop) and in Win10 notifications (which I hope to add in the near future) + it requires shipping of additional binaries on Windows (which is not an option with current way of the autoupdating and everything works) + I don't see options to remove already shown notification (at least in OS X).

That's a pretty bad situation we've landed in. Looks like you're make full use of the OS X notifications, while using broken notifications for *nix/Xorg.

Maybe this can be used everywhere except OS X, and keep using current code there?

Regarding conflicts with auto-updating: we don't really need that on most *nix distributions, since they already come with a package manager that does the job for us, so again, maybe OS X could be exceptional?