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 #228

Closed
Adamcake opened this issue Jun 21, 2022 · 18 comments · Fixed by #368
Closed

Unread notification badge #228

Adamcake opened this issue Jun 21, 2022 · 18 comments · Fixed by #368
Labels
enhancement Issues where an enhancement could be made to the application help wanted Issues where help is wanted

Comments

@Adamcake
Copy link

Adamcake commented Jun 21, 2022

The regular Discord client for Linux has an unread notification badge that shows up in my KDE task manager, if you turn on the "Enable Unread Message Badge" setting. It looks like this (the colour varies depending on if your DE has a colour scheme.) However, it only works if libunity is present on the system (almost certainly because Discord only tested their software on Ubuntu, but I digress.) If libunity SOs not present then no badges will ever be shown in the task manager, regardless of whether that setting is on or off.

Keeping libunity and its dependencies up-to-date on a system that doesn't ship with it is quite a hassle. Is there anything flatpak can do to implement this feature?

@TingPing
Copy link
Member

There was an attempt at packaging libunity here: #167

Not sure why it never happened, but with some love and testing maybe it could be done.

@Adamcake
Copy link
Author

Well, I've managed to build master with this patch included, but it hasn't added notification badges for me. Of course there is every possibility I did it wrong - I don't know anything about flatpak repos.

@TingPing
Copy link
Member

Could be a missing permission, can you run it with --socket=session-bus?

@Adamcake
Copy link
Author

No difference there - I'm assuming you meant for me to run my build with flatpak run com.discordapp.Discord --socket=session-bus, although there is no socket option mentioned in the help menu?

@TingPing
Copy link
Member

No difference there - I'm assuming you meant for me to run my build with flatpak run com.discordapp.Discord --socket=session-bus, although there is no socket option mentioned in the help menu?

Almost; It's an option for flatpak run rather than discord, so try flatpak run --socket=session-bus com.discordapp.Discord.

If that works it means we can track down a specific dbus permission to allow the library to work.

@Adamcake
Copy link
Author

No success, sadly. Although I did spot an interesting detail, the first line printed in the console after running the app was:
/app/bin/discord: line 3: socat: command not found
This line doesn't get printed when running the app normally (that is, flatpak install com.discordapp.Discord & flatpak run com.discordapp.Discord). It is there when running my own build, regardless of whether I pass --socket=session-bus or not. A couple of JSON errors printed during the build process too.

Here's the full console output of what I did just now:

[void@adam ~/flat/com.discordapp.Discord] $ rm -r build 
[void@adam ~/flat/com.discordapp.Discord] $ mkdir build
[void@adam ~/flat/com.discordapp.Discord] $ flatpak-builder build com.discordapp.Discord.json 

(flatpak-builder:3746): Json-WARNING **: 22:12:26.435: Failed to deserialize "modules" property of type "gpointer" for an object of type "BuilderModule"
Downloading sources
Starting build of com.discordapp.Discord
Cache hit for twemoji-fonts, skipping build
Cache hit for xprop, skipping build
Cache hit for python-setuptools_scm, skipping build
Cache hit for python-xlib, skipping build
Cache hit for discord, skipping build
Cache hit for cleanup, skipping
Cache hit for finish, skipping
Everything cached, checking out from cache
Pruning cache
[void@adam ~/flat/com.discordapp.Discord] $ flatpak-builder --user --install --force-clean build com.discordapp.Discord.json 

(flatpak-builder:3784): Json-WARNING **: 22:12:58.363: Failed to deserialize "modules" property of type "gpointer" for an object of type "BuilderModule"
Emptying app dir 'build'
Downloading sources
Starting build of com.discordapp.Discord
Cache hit for twemoji-fonts, skipping build
Cache hit for xprop, skipping build
Cache hit for python-setuptools_scm, skipping build
Cache hit for python-xlib, skipping build
Cache hit for discord, skipping build
Cache hit for cleanup, skipping
Cache hit for finish, skipping
Everything cached, checking out from cache
Exporting com.discordapp.Discord to repo
Commit: fbbf9b6e1e35f992d8058b4e507ebc682b6953fdec7429e50e0bf8a9b8b953e8
Metadata Total: 405
Metadata Written: 1
Content Total: 383
Content Written: 0
Content Bytes Written: 0 (0 bytes)
Exporting com.discordapp.Discord.Debug to repo
Commit: b5ed7648ca92936537d3d3b8a10819d0a32c1276b71a037d81be2960db1d2389
Metadata Total: 11
Metadata Written: 1
Content Total: 7
Content Written: 0
Content Bytes Written: 0 (0 bytes)
Installing app/com.discordapp.Discord/x86_64/master
Pruning cache
[void@adam ~/flat/com.discordapp.Discord] $ flatpak run --socket=session-bus com.discordapp.Discord 
/app/bin/discord: line 3: socat: command not found
...

@Adamcake
Copy link
Author

Adamcake commented Jun 27, 2022

Incidentally, I do have socat installed because it's a distant dependency of glibc, but I guess flatpak's sandbox may be preventing Discord from finding it.

@TingPing
Copy link
Member

TingPing commented Jul 4, 2022

git submodules update --init

@Adamcake
Copy link
Author

Adamcake commented Jul 8, 2022

Oh duh - I should've done that up front. Okay, with submodules included I have a build error with dee's makefile:

/usr/bin/mkdir: cannot create directory ‘/usr/lib/python3.9/site-packages/gi’: Read-only file system
make[3]: *** [Makefile:379: install-pygioverridesPYTHON] Error 1
make[3]: Leaving directory '/run/build/dee/bindings/python'
make[2]: *** [Makefile:472: install-am] Error 2
make[2]: Leaving directory '/run/build/dee/bindings/python'
make[1]: *** [Makefile:406: install-recursive] Error 1
make[1]: Leaving directory '/run/build/dee/bindings'
make: *** [Makefile:527: install-recursive] Error 1
Error: module dee: Child process exited with code 2

I don't have python 3.9, so I guess this is provided by flatpak's build system, right? Looks to me like it's trying to install a Python package by directly writing files into python 3.9's home dir but isn't being given write permission.

@TingPing
Copy link
Member

TingPing commented Jul 8, 2022

Patch their build system to write into /app instead of /usr. A lazy sed -i s/usr/app/g ./a/Makefile post-configure may even work. Ideally patch the autotools files though.

Also just to be clear about a misunderstanding on your part. Everything is in flatpak. Your host packages mean nothing and are not used.

@Adamcake
Copy link
Author

Adamcake commented Jul 10, 2022

Alright, so with a TON of help from @viriuwu we managed to get libunity to build as part of Discord's manifest (https://github.com/Adamcake/com.discordapp.Discord). However, still no notification badge.

Here's the full output from flatpak run --socket=session-bus com.discordapp.Discord. This is a log from running the application for maybe 30 seconds in total, during which I sent myself a message from an alt account, in case receiving a notification would log something useful.
discord.log

I don't know what I'm looking for but nothing is jumping out at me.

Thanks for your help so far.

(having re-read our conversation, maybe it's not the console output that you needed?)

@TingPing
Copy link
Member

If it worked I was going to help track down the permission it needed.

Since it doesn't work more investigation is needed to figure out why it works on the host.

@Starcr0ss
Copy link

Any updates on this? I'd love to get notification badges on Discord as a Flatpak

@Adamcake
Copy link
Author

Adamcake commented Oct 3, 2023

A few days after I last posted in this thread, Discord pushed an update which completely broke notification badges on their program, even on the official Ubuntu version. I don't know if they've fixed it since but, given the amount of basic technical understanding they seem to lack, and the sheer difficulty of reporting any issue to them, I doubt it.

So it seems pretty unlikely that you'd be able to get the feature to work inside flatpak now, given that it doesn't work to begin with.

I wonder if there'd be any mileage in running the Windows version through Wine?

@TingPing
Copy link
Member

TingPing commented Oct 3, 2023

I wonder if there'd be any mileage in running the Windows version through Wine?

The badges are a Linux specific DBus API. So I'm not sure what you'd expect from that.

@Adamcake
Copy link
Author

Adamcake commented Oct 4, 2023

Discord on Windows has notification badges. Depending on how they're implemented, Wine may well be able to translate them into an X11 context. Sure it probably wouldn't be going via dbus and the DE anymore, but it'd be better than nothing.

Okay, now that I read this comment back it does sound like an extreme change for a tiny feature. But I honestly don't think we'd really be sacrificing anything. Discord is mostly Windows devs so the Windows client works better in general.

@TingPing
Copy link
Member

TingPing commented Oct 4, 2023

Wine may well be able to translate them

It does not: https://github.com/wine-mirror/wine/blob/3db7506221e44e8091887d7eb42fe1666d422166/dlls/explorerframe/taskbarlist.c#L226-L235

I don't think there is a reasonable translation between the two APIs.

@Adamcake
Copy link
Author

Adamcake commented Oct 5, 2023

Well that's a shame, back to square 1 then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Issues where an enhancement could be made to the application help wanted Issues where help is wanted
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants