Vencord / Vesktop

Vesktop is a custom Discord App aiming to give you better performance and improve linux support
GNU General Public License v3.0
3.66k stars 172 forks source link

Unread Notification Badge not working on KDE #298

Open 0-Kirby-0 opened 9 months ago

0-Kirby-0 commented 9 months ago

Cross-platform duplicate of this Win10 feature request.

Feature looks like this: notif_badge.

Note: Vanilla discord has a missing dependency in libunity which is responsible for notification badges, as referenced in this thread. As shown above, the feature works on vanilla discord after installing libunity (or on distros that come with it), but not on Vencord.

HMassey commented 9 months ago

I can corroborate this, though I've arrived at the same result through the same steps: image

I have a feeling it's just not being added to KDE's notification manager part when you install it, but I tried jamming it into plasmanotifyrc and still no dice. I don't know if the notifications/badges is a more generic abstracted function though.

justin13888 commented 7 months ago

I also don't see the badge while on GNOME. Unsure whether it's settings although I've looked everything possible. I know it works perfectly fine on Windows.

JakobDev commented 7 months ago

I also don't see the badge while on GNOME.

Gnome does not support this Feature

azzamsa commented 7 months ago

The official Discord client has a red dot to show unread notifications.

image

0-Kirby-0 commented 7 months ago

My original issue seems to have been resolved. I don't know which version, unfortunately, but it works now. Thank you!

2024-02-05_18-31

Leaving the issue open for related problems above, but I'm satisfied here. Have a good one!

RileyInkTheCat commented 7 months ago

I have this exact problem, running Vesktop on ArchLinux through the flatpak version, any ideas on how to fix?

0-Kirby-0 commented 7 months ago

I have this exact problem, running Vesktop on ArchLinux through the flatpak version, any ideas on how to fix?

Double-check if you have libunity installed, since it's not a listed dependency. Beyond that I wouldn't know, but I wanted to point it out just in case.

soko7awen commented 6 months ago

(Fedora 39 KDE) I had this problem while using the flatpak, installing the rpm resolved that exact issue. I am now able to see an unread notifications counter on the app icon in the taskbar. Unfortunately however, the system tray icon does not have this feature for me, is it supposed to? I normally have Discord minimized to the tray, so the taskbar app icon badge is not very useful for me. :alien:

JakobDev commented 6 months ago

I have made a PR that makes this work on the Flatpak version

Tiagoquix commented 6 months ago

Using Fedora 39 KDE here. I don't see the notification badge.

Edit: installing libunity fixed the problem.

ghostlyentity commented 5 months ago

on endeavouros/arch, even after installing libunity i still do not get any notifications

JakobDev commented 5 months ago

on endeavouros/arch, even after installing libunity i still do not get any notifications

How did you install it? What Desktop do you use?

Elloer commented 5 months ago

on endeavouros/arch, even after installing libunity i still do not get any notifications

How did you install it? What Desktop do you use?

I am also on EndeavourOS, KDE 6 desktop. I also have this problem even though I have libunity installed. Badges don't show up to display the number of discord notifications. I installed libunity via yay.

JakobDev commented 5 months ago

How did you install Vesktop?

Elloer commented 5 months ago

How did you install Vesktop?

via bauh I installed the flatpak.

JakobDev commented 5 months ago

I installed the flatpak

Flatpak is completely separated from your System. That you have installed libunity on your Host doesn't matter. Libunity is included in the Flatpak anyway, but there are a few changes needed to make the notifications work. See my PR for more Details.

DexyStorm commented 5 months ago

I also have this problem. I am on Arch with KDE and I installed both libunity and vekstop with yay and I still dont have the notification badge.

Covkie commented 5 months ago

I've narrowed it down to an issue with what I think is libunity and Plasma 6 (5?) specifically - unable to test 5 at the moment. This affects both the stock Discord and the Flatpak version. Libunity is old and hasn't been touched in ages, so I guess its about time it breaks...

DexyStorm commented 5 months ago

stock discord works fine for me on plasma 6

Covkie commented 5 months ago

stock discord works fine for me on plasma 6

How are you testing the badge, perhaps I'm doing something wrong?

DexyStorm commented 5 months ago

How I am testing:

Either: Requirements: none 1) Join a popular server. 2) Check if notification dot is there.

OR: Requirements: Friend 1) Ask Friend to DM you. 2) Check if notification dot is there.

Observation: its there for Discord, but not Vesktop.

image

I have the same settings for Vesktop and for stock Discord and I get the badge for Discord, but not Vesktop. If you want, I can record a short YT video where I show it happening and stuff.

Covkie commented 5 months ago

Oh you are talking about the tray indicator. That is different than what this issue is about.

DexyStorm commented 5 months ago

Oh, sorry. There was a comment about it aswell so I thought we were talking about both. Kind of like the problem is caused by the same thing. Sorry!

Covkie commented 4 months ago

I've narrowed it down to an issue with what I think is libunity and Plasma 6 (5?) specifically - unable to test 5 at the moment. This affects both the stock Discord and the Flatpak version. Libunity is old and hasn't been touched in ages, so I guess its about time it breaks...

Alright, I've tested on Kubuntu 23.10(plasma 5) in a virtual machine- the Snap, Flatpak (snap and flatpak both bundle libunity) and Deb+libunity9 all display the task indicator.

This is most definitely an upstream Plasma 6/Electron(relies on libunity) bug. There is an open issue on electron here to replace libunity.

JakobDev commented 4 months ago

I think it's a good idea to give a explanation what is needed to make this work:

  1. Electron currently checks the Desktop before using the API. I had removed this check, so this should be gone with the next Electron version, but for now you may have to set some environment variables, if your desktop is not in the list.
  2. Libunity must be installed and can be loaded by Electron. Sadly there's no message if libunity is not found, but as long as you have installed it, this should not be a problem.

After that, the API should be working. But there's a problem in the API itself: You can't said that a counter should be displayed on Window foo. You can only give the API the filename of a desktop file and the counter will be displayed on all windows that belongs to this file. That means the following:

  1. Vesktop must be installed
  2. The name of the desktop file must be vesktop.desktop. Not any other name.
  3. The window must be connected to the desktop file.
Covkie commented 4 months ago

Adding XDG_CURRENT_DESKTOP=KDE5 to vesktop.desktop along with installing libunity has this working on Plasma 6 for me! Some things to note though:

  1. Enabling settings>Notifications>Enable Unread Message Badge adds a useless dot to the window title when there is no unread notification. (Option should be hidden and off as Vesktop has its own setting which actually toggles the badge under settings>Vesktop>Notification Badge) image
  2. When there is an unread notification there is a redundant display count in the non-static window title. This is pointless with working badges. (hides the dot from 1. when active) image
Vendicated commented 4 months ago

Enabling settings>Notifications>Enable Unread Message Badge adds a useless dot to the window title when there is no unread notification. (Option should be hidden and off as Vesktop has its own setting which actually toggles the badge under settings>Vesktop>Notification Badge)

this setting is not about enabling the badge itself, it's about enabling an undead message indicator

ping => number badge unread messages (non pings, just any message in an unmuted channel) => dot

vesktop uses this setting https://github.com/Vencord/Vesktop/blob/2733727a40a4cf542277dedcf89e87e7740f962d/src/renderer/appBadge.ts#L19-L27 (note how it sends -1 for unreads), but only supports the unread badge on windows and mac because Linux only supports numbers https://github.com/Vencord/Vesktop/blob/2733727a40a4cf542277dedcf89e87e7740f962d/src/main/appBadge.ts#L26-L29

AstralPhnx commented 4 months ago

I think it's a good idea to give a explanation what is needed to make this work:

1. Electron [currently checks the Desktop](https://github.com/electron/electron/blob/5ad8b4b7d16ff8026243251bac98bbcf343c77e3/shell/browser/linux/unity_service.cc#L63) before using the API. I had [removed this check](https://github.com/electron/electron/pull/41211), so this should be gone with the next Electron version, but for now you may have to set some environment variables, if your desktop is not in the list.

2. Libunity must be installed and can be loaded by Electron. Sadly there's no message if libunity is not found, but as long as you have installed it, this should not be a problem.

After that, the API should be working. But there's a problem in the API itself: You can't said that a counter should be displayed on Window foo. You can only give the API the filename of a desktop file and the counter will be displayed on all windows that belongs to this file. That means the following:

1. Vesktop must be installed

2. The name of the desktop file must be `vesktop.desktop`. Not any other name.

3. The window must be connected to the desktop file.

Currently trying to figure this out on my end myself and it's (rightfully) being a real ballache with the flatpak and appimages which both use their own funny haha .desktop filenames and can't really be changed around all that easily without causing issues. Is this .desktop file thing an absolute requirement at this point? And heck, how would these types of notifications even work in a sandbox like a flatpak or appimage to begin with? How would it go about talking to libunity? Does that also need to be installed systemside as well as sandbox side?

JakobDev commented 4 months ago

being a real ballache with the flatpak and appimages which both use their own funny haha .desktop filenames

If you take a look at my PR, I use the patch-desktop-filename script, so Vesktop will use the correct dev.vencord.Vesktop.desktop filename. For AppImage there is no way to make this work.

Is this .desktop file thing an absolute requirement at this point?

Yes. This is even a bigger problem on Wayland. On Wayland Apps can't set a Icon. The Icon from the desktop file is used instead. So if the Window is not connected to the correct desktop file, it will not have the correct Icon. If a Window is not connected to the correct desktop filename, it can cause other Issues too.

And heck, how would these types of notifications even work in a sandbox like a flatpak or appimage to begin with?

It works with my Patch in the Flatpak. For AppImages (which are not sandboxed btw) there is no way to make this work out of the box.

How would it go about talking to libunity? Does that also need to be installed systemside as well as sandbox side?

It only need to be installed in the Sandbox (which it already is).

Just a tip: If you use KDE you can run the command gdbus call -e -d org.kde.KWin -o /KWin -m org.kde.KWin.showDebugConsole to open the debug console and see which desktop filename is connected to a Window.

AstralPhnx commented 4 months ago

being a real ballache with the flatpak and appimages which both use their own funny haha .desktop filenames

If you take a look at my PR, I use the patch-desktop-filename script, so Vesktop will use the correct dev.vencord.Vesktop.desktop filename. For AppImage there is no way to make this work.

Is this .desktop file thing an absolute requirement at this point?

Yes. This is even a bigger problem on Wayland. On Wayland Apps can't set a Icon. The Icon from the desktop file is used instead. So if the Window is not connected to the correct desktop file, it will not have the correct Icon. If a Window is not connected to the correct desktop filename, it can cause other Issues too.

And heck, how would these types of notifications even work in a sandbox like a flatpak or appimage to begin with?

It works with my Patch in the Flatpak. For AppImages (which are not sandboxed btw) there is no way to make this work out of the box.

How would it go about talking to libunity? Does that also need to be installed systemside as well as sandbox side?

It only need to be installed in the Sandbox (which it already is).

Just a tip: If you use KDE you can run the command gdbus call -e -d org.kde.KWin -o /KWin -m org.kde.KWin.showDebugConsole to open the debug console and see which desktop filename is connected to a Window.

Can confirm having looked at your PR earlier and building Vesktop as a Flatpak with your changes added that tray notifications now function as expected under GNOME 46 using Dash To Dock and Dash To Panel. Hopefully that gets folded into the flatpak officially sooner rather than later.

AstralPhnx commented 3 months ago

Adding XDG_CURRENT_DESKTOP=KDE5 to vesktop.desktop along with installing libunity has this working on Plasma 6 for me! Some things to note though:

1. Enabling `settings>Notifications>Enable Unread Message Badge` adds a useless dot to the window title when there is no unread notification. (Option should be hidden and off as Vesktop has its own setting which actually toggles the badge under `settings>Vesktop>Notification Badge`)
   ![image](https://private-user-images.githubusercontent.com/52550063/325844946-8db1c855-80c4-4405-b5d1-53ab27024e35.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTYyNTc1NjEsIm5iZiI6MTcxNjI1NzI2MSwicGF0aCI6Ii81MjU1MDA2My8zMjU4NDQ5NDYtOGRiMWM4NTUtODBjNC00NDA1LWI1ZDEtNTNhYjI3MDI0ZTM1LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA1MjElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNTIxVDAyMDc0MVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTQxODMyZjFmZjA2MmZiNmJmY2EyNzJjMTIwYTI1MzE5MTI4MzgwOGE2ZjYxNzcyOWYwNGNkMDYxMzg0OWYyYmUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.Yc69sNp1VRns7lLkVYn7Z2HHoPh_6Vq56zcrEF8IHnc)

2. When there is an unread notification there is a redundant display count in the non-static window title. This is pointless with working badges. (hides the dot from 1. when active)
   ![image](https://private-user-images.githubusercontent.com/52550063/325845223-59470107-0401-4800-9b11-691180cbd508.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTYyNTc1NjEsIm5iZiI6MTcxNjI1NzI2MSwicGF0aCI6Ii81MjU1MDA2My8zMjU4NDUyMjMtNTk0NzAxMDctMDQwMS00ODAwLTliMTEtNjkxMTgwY2JkNTA4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA1MjElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNTIxVDAyMDc0MVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWM0MTg3OGNjMGQ2ODhmMGQzZGQ5NDE2ZjI1NjFlMzkyYmMxY2RmZDcxMTM5MjczMmM1MDkxNmU3MjQ3ZDliODgmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.Lpps3h45xzWUflvBqY96-QhtdxnW4utXCJHFAp8IfYk)

I should note that while this works for me for getting the panel notifications back over on GNOME, it seems to have the unintended side effect of entirely breaking vesktop's ability to open web links in my browser. I can click them all I want but firefox just doesn't open. No clue why.

Andrew15-5 commented 3 months ago

Is the problem with tray icon not showing the unread messages can be discussed here or a separate issue must be created?

It doesn't work on Pop!_OS 22.04 GNOME 42.* Vesktop v1.5.2 Debian/Flatpak. I tried installing https://extensions.gnome.org/extension/615/appindicator-support/, but it doesn't seem to change anything. Is the session logout necessary or something else?

image

Covkie commented 3 months ago

Seems this is broken again even with libunity and XDG_CURRENT_DESKTOP=KDE5 being set.

PavelDobCZ23 commented 3 months ago

Seems this is broken again even with libunity and XDG_CURRENT_DESKTOP=KDE5 being set.

I can confirm, both native Discord and rpm Vencord don't show the badge on KDE, with libunity on the system.

Covkie commented 3 months ago

Plasma bug report time 💥

Edit: https://bugs.kde.org/show_bug.cgi?id=486245

PavelDobCZ23 commented 3 months ago

Plasma bug report time 💥

Edit: https://bugs.kde.org/show_bug.cgi?id=486245

Tbf I'm not sure that the issue is on the Plasma side of things, because apps not made in Electron, like Telegram, display the badge fine. Maybe Electron needs to update the way they handle this.

Vendicated commented 3 months ago

image-220

is this not the fix? try building with that electron version and see if it works

Covkie commented 3 months ago

@Vendicated Thats not (im pretty sure) the fix because the workaround broke, meaning libunity + plasma arent playing nice.

Covkie commented 3 months ago

@PavelDobCZ23

Maybe Electron needs to update the way they handle this.

Oh most definitely. Libunity hasn't had an update in years. In fact https://github.com/electron/electron/issues/30085 is open for that exact reason.

A dirty fix for vesktop while that's handled upstream would be to emit the dbus signal itself. Try gdbus emit --session --object-path / --signal com.canonical.Unity.LauncherEntry.Update "application://vesktop.desktop" "{'count': <int64 3>, 'count-visible': <true>}" in your terminal to see it work. Telegram Desktop handles that here For the task bar and here for the tray icon (linux only). For windows and mac it just bakes the badge into the tray icon itself. Search around for Core::App().unreadBadge()

Doing the above would close #298, #189(doesnt do anything anyway why is it still open??) and #261

flying-sheep commented 1 month ago

gdbus isn’t necessarily installed everywhere. Since this is an electron app, using a DBus library for node.js would probably be the way to go.