Skip to content

Add AppId option for Linux notifications - #158

Merged
maxkatz6 merged 2 commits into
mainfrom
fix/linux-notifications-appid
Oct 26, 2026
Merged

maxkatz6 merged 2 commits into
mainfrom
fix/linux-notifications-appid

Conversation

@maxkatz6

@maxkatz6 maxkatz6 commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

Fixes #136

Problem

On Linux, xdg-desktop-portal infers the app ID of a non-sandboxed app from its systemd scope (app-<id>-*.scope). An app started from a terminal gets an empty ID; one started from an IDE inherits the IDE's ID. GNOME Shell then rejects notifications with org.gtk.Notifications.Error.InvalidApp.

Change

  • New Linux-only AppNotificationOptions.AppId.
  • When set, the manager calls org.freedesktop.host.portal.Registry.Register(appId, {}) before any other portal call on its connection (xdg-desktop-portal 1.19+).
  • If registration fails (older portal, sandboxed app, or no matching .desktop file), the error is ignored and the portal's inferred ID is used, as before.
  • Nothing changes when AppId isn't set. Avalonia's own D-Bus connection isn't touched.
.WithAppNotifications(new AppNotificationOptions { AppId = "org.example.MyApp" })

Requires an installed org.example.MyApp.desktop.

maxkatz6 and others added 2 commits October 25, 2026 19:41
Registers the app ID with xdg-desktop-portal (org.freedesktop.host.portal.Registry)
before any other portal call, so notifications are not sent with an empty or
inferred app ID.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@maxkatz6 maxkatz6 added the bug Something isn't working label Oct 26, 2026
@maxkatz6
maxkatz6 merged commit df005b1 into main Oct 26, 2026
1 check passed
@maxkatz6
maxkatz6 deleted the fix/linux-notifications-appid branch October 26, 2026 02:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Avalonia.Labs.Notifications invalid App ID Linux

1 participant