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

Unread Notification Badge not working on KDE #298

Open
0-Kirby-0 opened this issue Dec 19, 2023 · 40 comments · May be fixed by #686
Open

Unread Notification Badge not working on KDE #298

0-Kirby-0 opened this issue Dec 19, 2023 · 40 comments · May be fixed by #686
Labels
bug Something isn't working upstream related to a dependency, for example electron wontfix This will not be worked on

Comments

@0-Kirby-0
Copy link

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
Copy link

HMassey commented Dec 20, 2023

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.

@Vendicated Vendicated added the bug Something isn't working label Jan 11, 2024
@Vendicated Vendicated changed the title Unread Notification Badge [Linux] Unread Notification Badge not working on KDE Jan 11, 2024
@justin13888
Copy link
Contributor

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
Copy link

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

Gnome does not support this Feature

@azzamsa
Copy link

azzamsa commented Jan 30, 2024

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

image

@0-Kirby-0
Copy link
Author

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
Copy link

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

@0-Kirby-0
Copy link
Author

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
Copy link

(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. 👽

@JakobDev
Copy link

JakobDev commented Mar 1, 2024

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

@Tiagoquix
Copy link
Contributor

Tiagoquix commented Mar 6, 2024

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

Edit: installing libunity fixed the problem.

@ghostlyentity
Copy link

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

@JakobDev
Copy link

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
Copy link

Elloer commented Mar 30, 2024

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
Copy link

How did you install Vesktop?

@Elloer
Copy link

Elloer commented Mar 31, 2024

How did you install Vesktop?

via bauh I installed the flatpak.

@JakobDev
Copy link

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
Copy link

DexyStorm commented Apr 12, 2024

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
Copy link

Covkie commented Apr 17, 2024

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
Copy link

DexyStorm commented Apr 17, 2024

stock discord works fine for me on plasma 6

@Covkie
Copy link

Covkie commented Apr 18, 2024

stock discord works fine for me on plasma 6

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

@DexyStorm
Copy link

DexyStorm commented Apr 18, 2024

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
Copy link

Covkie commented Apr 18, 2024

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

@DexyStorm
Copy link

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
Copy link

Covkie commented Apr 20, 2024

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
Copy link

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
Copy link

Covkie commented Apr 26, 2024

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
Copy link
Member

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

const mentionCount = GuildReadStateStore.getTotalMentionCount();
const pendingRequests = RelationshipStore.getPendingCount();
const hasUnread = GuildReadStateStore.hasAnyUnread();
const disableUnreadBadge = NotificationSettingsStore.getDisableUnreadBadge();
let totalCount = mentionCount + pendingRequests;
if (!totalCount && hasUnread && !disableUnreadBadge) totalCount = -1;
VesktopNative.app.setBadgeCount(totalCount);
(note how it sends -1 for unreads), but only supports the unread badge on windows and mac because Linux only supports numbers
case "linux":
if (count === -1) count = 0;
app.setBadgeCount(count);
break;

@AstralPhnx
Copy link

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
Copy link

JakobDev commented May 3, 2024

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
Copy link

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
Copy link

AstralPhnx commented May 21, 2024

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
Copy link

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
Copy link

Covkie commented Jun 14, 2024

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

@PavelDobCZ23
Copy link

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
Copy link

Covkie commented Jun 14, 2024

Plasma bug report time 💥

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

@PavelDobCZ23
Copy link

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 Vendicated added wontfix This will not be worked on upstream related to a dependency, for example electron labels Jun 14, 2024
@Vendicated
Copy link
Member

image-220

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

@Covkie
Copy link

Covkie commented Jun 15, 2024

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

@Covkie
Copy link

Covkie commented Jun 17, 2024

@PavelDobCZ23

Maybe Electron needs to update the way they handle this.

Oh most definitely. Libunity hasn't had an update in years. In fact electron/electron#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

@Covkie Covkie mentioned this issue Jun 18, 2024
13 tasks
Covkie added a commit to Covkie/Vesktop that referenced this issue Jun 21, 2024
Closes Vencord#298, Vencord#424, Vencord#189

remove (#) title prefix when `Notification Badge` option is toggled

explode scuffed option libunity dependency (kabloomed)
@flying-sheep
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working upstream related to a dependency, for example electron wontfix This will not be worked on
Projects
None yet