gnome-search-provider: Configure application name in DBUS_BUS_NAME and DBUS_OBJECT_PATH
Categories
(Core :: Widget: Gtk, task, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox115 | --- | fixed |
People
(Reporter: jan, Assigned: stransky)
References
(Blocks 2 open bugs)
Details
(Keywords: nightly-community)
Attachments
(3 files, 1 obsolete file)
MOZ_APP_REMOTINGNAME can be firefox, firefox-beta, firefox-aurora, firefox-nightly, firefox-esr.
DBUS_BUS_NAME "org.mozilla.Firefox.SearchProvider"
DBUS_OBJECT_PATH "/org/mozilla/Firefox/SearchProvider"
DBUS_BUS_NAME should be org.mozilla.MOZ_APP_REMOTINGNAME.SearchProvider
DBUS_OBJECT_PATH should be /org/mozilla/MOZ_APP_REMOTINGNAME/SearchProvider
MOZ_APP_REMOTINGNAME is already used here: https://searchfox.org/mozilla-central/rev/ca52886e3b6051ca87861567e0c7628915f68780/toolkit/xre/nsAppRunner.cpp#4637
g_set_prgname(gAppData->remotingName);
Assignee | ||
Updated•1 years ago
|
Assignee | ||
Updated•1 years ago
|
Assignee | ||
Updated•1 years ago
|
Assignee | ||
Comment 1•1 years ago
|
||
Updated•1 years ago
|
Assignee | ||
Comment 2•1 years ago
|
||
Unfortunately this doesn't work as DBus refuses to use interface/path names with '-' char.
As I see Bug 1805440 and Bug 1835141 it would be better to use env variable to set search provider DBus name.
Assignee | ||
Comment 3•1 years ago
|
||
Depends on D179203
Assignee | ||
Comment 4•1 years ago
|
||
I wonder if we need such patch for other DBus code too - for instance remoting one:
https://searchfox.org/mozilla-central/rev/f4d3fe187cf7dffa4c13b354bbde9bc47b5ccd3f/toolkit/components/remote/nsDBusRemoteServer.cpp#96
Assignee | ||
Updated•1 years ago
|
Reporter | ||
Comment 5•1 years ago
•
|
||
org.mozilla.firefox_nightly and org.mozilla.thunderbird are already used for dbus in snapcraft.yaml.
-
DBUS:
XRemote dbus name seems to contain base64(profilename) so that parallel running profiles would be fine.
But the search provider dbus name couldn't contain base64(profilename) because search-provider.ini would need to know it which is not possible.XREAppData::GetDBusAppName returns MOZ_APP_REMOTINGNAME with "-" replaced with "_" .
How it should probably be:
XRemote: org.mozilla.<what GetDBusAppName returns>.<base64(profilename)>
Search: org.mozilla.<what GetDBusAppName returns>.SearchProviderSnap doesn't support Gnome search providers yet: https://forum.snapcraft.io/t/gnome-shell-search-providers-in-snaps/5265
-
bug 1826330:
The terms DesktopId and Wayland app id refer to <DesktopId>.desktop.
Call g_set_prgname() with desktopid that you get from a new method XREAppData::GetDesktopId which should return:- if IsRunningUnderFlatpak()
org.mozilla.<MOZ_APP_REMOTINGNAME with "-" replaced with "_" > // to match org.mozilla.firefox.desktop, org.mozilla.thunderbird.desktop
org.mozilla.<what GetDBusAppName returns> - else if SNAP_NAME env var is not empty:
- If SNAP_INSTANCE_KEY env var is not empty:
<SNAP_NAME>+<SNAP_INSTANCE_KEY>_<SNAP_NAME> // to match firefox+userdefinedaliasname_firefox.desktop, thunderbird+userdefinedaliasname_thunderbird.desktop - else
<SNAP_NAME>_<SNAP_NAME> // to match firefox_firefox.desktop, thunderbird_thunderbird.desktop
- If SNAP_INSTANCE_KEY env var is not empty:
- else
MOZ_APP_REMOTINGNAME // to match firefox-nightly.desktop, thunderbird.desktop
Snap background:
packagename can have multiple apps with desktop file. First app's name is usually the same as packagename.
$ sudo snap install packagename
$ sudo snap install packagename_userdefinedaliasname
$ snap run packagename
is possible if appname==packagename
$ snap run packagename.appname
(packagename_appname.desktop)
$ snap run packagename_userdefinedaliasname
is possible if appname==packagename
$ snap run packagename_userdefinedaliasname.appname
(packagename+userdefinedaliasname_appname.desktop)SNAP_NAME env var contains packagename.
SNAP_INSTANCE_KEY env var contains userdefinedaliasname.
SNAP_INSTANCE_NAME is packagename_userdefinedaliasname
There is no env var for appname.$ cat /var/lib/snapd/desktop/applications/firefox+minefield_firefox.desktop
[Desktop Entry]
X-SnapInstanceName=firefox_minefield
[...]
Exec=env BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/firefox+minefield_firefox.desktop /snap/bin/firefox_minefield %u
[...]I assume KDE Wayland ignores the BAMF_DESKTOP_FILE_HINT, otherwise it might have shown the correct icon.
- if IsRunningUnderFlatpak()
-
DBUS usage in https://searchfox.org/mozilla-central/rev/0c2945ad4769e2d4428c72e6ddd78d60eb920394/dom/system/linux/GeoclueLocationProvider.cpp#476
At the moment, GetDBusAppName would just return firefox_nightly IIUC.
https://www.freedesktop.org/software/geoclue/docs/gdbus-org.freedesktop.GeoClue2.Client.html#gdbus-property-org-freedesktop-GeoClue2-Client.DesktopIdThe desktop file id (the basename of the desktop file). This property must be set by applications for authorization to work.
Maybe the call to GetDBusAppName
a) should be replaced with new GetDesktopId
b) or should stay because it might break in case the DesktopId is "firefox+userdefinedaliasname_firefox".
https://dbus.freedesktop.org/doc/dbus-specification.html
Note that the hyphen ('-') character is allowed in bus names but not in interface names. It is also problematic or not allowed in various specifications and APIs that refer to D-Bus, such as Flatpak application IDs, the DBusActivatable interface in the Desktop Entry Specification, and the convention that an application's "main" interface and object path resemble its bus name. To avoid situations that require special-case handling, it is recommended that new D-Bus names consistently replace hyphens with underscores.
- In case a Nightly flatpak package should ever be made, it should probably be named org.mozilla.firefox_nightly.
- Debian packages names require the opposite: "-" and not "_".
- These use "-" in Flatpak application ids:
https://flathub.org/apps/org.gnome.font-viewer
https://flathub.org/apps/com.github.bajoja.indicator-kdeconnect - These use both:
org.gnome.Evolution-alarm-notify.desktop
org.kde.plasma.browser_integration.host.desktop (https://addons.mozilla.org/en-US/firefox/addon/plasma-integration/)
Assignee | ||
Comment 6•1 years ago
|
||
Thanks. I think we should use XREAppData::GetDBusAppName() then and add ability to override the app name there.
Updated•1 years ago
|
Assignee | ||
Comment 7•1 years ago
|
||
Depends on D179203
Assignee | ||
Comment 8•1 years ago
|
||
Depends on D179432
Comment 10•1 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/964b57d61881
https://hg.mozilla.org/mozilla-central/rev/a7f56dd3c21c
https://hg.mozilla.org/mozilla-central/rev/238468b1748e
Description
•