Skip to content

Add API to register app ID#183

Open
jadahl wants to merge 2 commits into
flatpak:mainfrom
jadahl:wip/registry
Open

Add API to register app ID#183
jadahl wants to merge 2 commits into
flatpak:mainfrom
jadahl:wip/registry

Conversation

@jadahl

@jadahl jadahl commented Jan 14, 2025

Copy link
Copy Markdown
Contributor

Meant to be used by host apps to more reliably get an app ID. See flatpak/xdg-desktop-portal#1521.

@GeorgesStavracas GeorgesStavracas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, the only thing I think is missing is the documentation blocks for introspection.

Comment thread libportal/portal.c Outdated
@jadahl

jadahl commented Jan 15, 2025

Copy link
Copy Markdown
Contributor Author

Tweaked the qt examples a bit. The qt5 one now plumbs the app Id via QApplication, but couldn't do that in qt6 - I had to register the app ID before doing QApplication a(argc, argv); since constructing the QApplication already started to talk to the portal (I'm guessing for settings or something).

These are no-ops when running under flatpak or snap, but when running on
the host, they will call Register() on org.freedesktop.host.portal.Registry.
@ilya-fedin

Copy link
Copy Markdown
Contributor

The qt5 one now plumbs the app Id via QApplication, but couldn't do that in qt6 - I had to register the app ID before doing QApplication a(argc, argv); since constructing the QApplication already started to talk to the portal (I'm guessing for settings or something).

desktopFileName and setDesktopFileName are static methods of QGuiApplication (which QApplication inherits from), you can use them before constructing QApplication just fine

@smcv

smcv commented Feb 12, 2025

Copy link
Copy Markdown
Contributor

desktopFileName and setDesktopFileName are static methods of QGuiApplication (which QApplication inherits from), you can use them before constructing QApplication just fine

Does this mean it would be more correct to call them as QGuiApplication::setDesktopFileName(APP_ID) and QGuiApplication::desktopFileName(), rather than app->setDesktopFileName(APP_ID) and app->desktopFileName()?

@ilya-fedin

Copy link
Copy Markdown
Contributor

Does this mean it would be more correct to call them as QGuiApplication::setDesktopFileName(APP_ID) and QGuiApplication::desktopFileName(), rather than app->setDesktopFileName(APP_ID) and app->desktopFileName()?

Exactly

@smcv smcv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check whether the Qt code paths can be improved based on what @ilya-fedin said

@sithlord48

sithlord48 commented May 18, 2026

Copy link
Copy Markdown
Contributor

QCoreApplication is the base class for all Qt Application classes

The following members are static in QCoreApplication

QCoreApplication::setApplicationName / QCoreApplication::applicationName
QCoreApplication::setOrganizationDomain / QCoreApplication::organizationDomain
QCoreApplication::setOrganizationName / QCoreApplication::organizationName

The can be called by any of the Qt Application types set / get the needed info

@sithlord48

Copy link
Copy Markdown
Contributor

Any idea whats up with this PR ? it looks like we will need an appid to use the hotkey portal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants