notifier-for-github
notifier-for-github copied to clipboard
Use Badging API if available to update the app badge
Hi there, thanks for this extension, really cool!
Using the Badging API (spec, shipped to stable Chrome in April 2020), navigator.setAppBadge(notificationsCount)
and navigator.clearAppBadge()
can set and clear the application badge that shows up with PWA and pseudo-PWA windows (create a pseudo-PWA with three dots menu -> More Tools -> Create Shortcut... -> Open as window).
On macOS this looks like this in the Dock:
Sure, but you should send a feature request to GitHub too. This should ideally be implemented by them.
Sure, but you should send a feature request to GitHub too. This should ideally be implemented by them.
Good idea! I will do this. I guess for this request, I can also mention the "empty" badge state with navigator.setAppBadge()
(no argument) - since they may not have the number of notifications everywhere yet:
Submitted a personal ticket on https://support.github.com/ just now
For display of the badge on tabs (non-PWA), there is also navigator.setClientBadge()
, but this is not implemented in any user agents, as far as I can tell.
An alternative here would be to dynamically recreate the favicon with a badge via canvas. Quick and dirty example:
https://gist.github.com/karlhorky/65bb8496f151d3248d9eed26cc24e6f1
I've made the canvas favicon generator into a userscript here: https://github.com/karlhorky/userscripts/blob/main/github-favicon-notification-badge.user.js
I'm not sure why this is here, this should ideally be in https://github.com/refined-github/refined-github.
We don't have access to, and will not have access to the DOM. Even then, the badging API only seems to work if the page is installed as a PWA.
I'm not sure why this is here, this should ideally be in refined-github/refined-github.
I think @sindresorhus said this is "outside the scope of refined-github
" here, didn't he? https://github.com/refined-github/refined-github/issues/1546
We don't have access to, and will not have access to the DOM
Why is there no access to the DOM?
Even then, the badging API only seems to work if the page is installed as a PWA.
Yeah, maybe it would be an idea to also include the favicon update approach? The icon in the favicon has proven very useful.