Subject: bug#77496: [PATCH] Add 'ns-app-badge' to set macOS / GNUstep icon badge

From: Björn Bidar <[email-masked]>
Date: Wed, 23 Apr 2025 19:53:59 +0300

Sorry forgot to reply to the mail.

Ship Mints <[email-masked]> writes:

> On Tue, Apr 8, 2025 at 5:51 PM Björn Bidar via Bug reports for GNU Emacs,
> the Swiss army knife of text editors <[email-masked]> wrote:
>
>> Ship Mints <[email-masked]> writes:
>>
>> > On Fri, Apr 4, 2025 at 7:44 AM Eli Zaretskii <[email-masked]> wrote:
>> >
>> >> > From: Ship Mints <[email-masked]>
>> >> > Date: Fri, 4 Apr 2025 07:37:57 -0400
>> >> > Cc: [email-masked]
>> >> >
>> >> >  P.S. All this doesn't change the fact that we can only install this
>> >> >  feature when it can be made available on free systems.
>> >> >
>> >> > This feature exists in GNUstep.  Is this not sufficiently free?
>> >>
>> >> I mean the underlying OS.
>> >>
>> >
>> > GNUstep on Linux would do.
>> >
>> >> If you think we really need complete parity with Linux desktop systems
>> >> beyond GNUstep, based on some
>> >> > research this morning, we may be able to leverage dbus messages for
>> >> desktops that support for "count"
>> >> > (numeric only, sheesh) / "count-visible".  This functionality appears
>> >> not to be tied to the running process as on
>> >> > macOS/GNUstep but to a "URL" like "application://{appname}.desktop"
>> >> where I guess appname would be
>> >> > emacs or Emacs, I dunno yet how this really works when there are more
>> >> than one running copies of an app
>> >> > process.  I'll experiment and see if I can tease this out.
>> >> >
>> >> > If this seems easy and you're 100% adamant that GNUstep is
>> >> insufficiently free, I can try to craft a more
>> >> > generic API that supports numeric counts for Linux desktop shells, and
>> >> text labels for macOS/GNUstep.
>> >>
>> >> I'd be surprised if X and/or GTK don't have a comparable feature.  So
>> >> yes, I think we should have something similar on GNU/Linux.
>> >>
>> >
>> > Seems not.  Seems to be a feature of desktop shells.
>> >
>> > Not getting any love from trying 'gdbus' to force an app badge.  I'm
>> surely
>> > just an ignorant boob with dbus.
>> >
>> > For anyone interested in helping out, this is the hack I'm trying, which,
>> > if it worked, we'd model in Emacs invoking dbus directly vs. via command
>> > line.
>> >
>>
>> Which desktop environment do you use? It seems that at least KDE Plasma
>> and Unity support this API. I assume that also applies to GNOME Shell at
>> least under Ubuntu.
>>
>
> I've been experimenting with Ubuntu.  The app icon badge protocol is
> implemented in the gnome-shell dock extension (this is a brittle
> methodology in several ways but that's what we have to work with).  I have
> been unable to make it work, however.  It seems that despite the gjs dock
> code appearing to contain the dbus subscriptions, d-spy doesn't show the
> endpoint and dbus command-line tools also suggest the subscription isn't
> working.  I ain't no dbus expert and this has been a tad frustrating, to
> say the least.  That there is no "BDFL" in the Linux desktop ecosystem
> definitely shows.

For desktop Linux there is Freedesktop.org which is largely still the
established platform to coordinate standards and share some
implementation of standards. However some actors such as GNOME have
become difficult to interact with or ignore some standards. The cost of
that being to improve their platform instead of "Linux", I don't write
GNU/Linux since desktop Linux isn't just GNU but
GNU/Freedesktop/GNOME/Qt/KDE/Linux etc the name would get quite long.

> Does your gnome-shell dock properly react to
> com.canonical.Unity.LauncherEntry.Update signals?

I'm nott using Gnome-Shell but KDE Plasma. For Plasma it works out of
the box once you have the task widget in your panel.

The easiest example for me to test this is a messaging app such as Telegram.
Just have widget add, start Telegram, have unread messages and look.
There are no need to open the options to toggle for you to enable it.
But you can configure the support for those in System-Settings ->
Notifications -> Additional Feedback.

Because usually I don't use a taskbar but a tilling window manager no
taskbar needed, some quick internet searches revealved some information
that might help to understand this.

This post is about KDE Plasma and Qt but the explanation does apply to
any implementation of the support for badges using that protocol:
https://reionwong.github.io/posts/kde/kde-badge/

The official Canonical documentation:
https://wiki.ubuntu.com/Unity/LauncherAPI

This gnome shell extension seems to support the launcher API:
https://github.com/micheleg/dash-to-dock (not-tested)
It's the same extension Ubuntu installs to provide a similar UX as in
Unity 7.
Check this bug for more:
https://bugs.launchpad.net/ubuntu/+source/gnome-shell-extension-ubuntu-dock/+bug/1713712