Skip to content

frontend: call setDesktopFileName earlier#13323

Open
leia-uwu wants to merge 1 commit intoobsproject:masterfrom
leia-uwu:set-desktopfilename-earlier
Open

frontend: call setDesktopFileName earlier#13323
leia-uwu wants to merge 1 commit intoobsproject:masterfrom
leia-uwu:set-desktopfilename-earlier

Conversation

@leia-uwu
Copy link
Copy Markdown

Description

Qt 6.10.1+ will register the dbus app ID when outside a sandbox, but that requires the desktop file name to be set earlier

Motivation and Context

This fixes portal dialogs using Qt dbus having the wrong app name when launching OBS e.g via a terminal / not through the desktop file

see leia-uwu/obs-wayland-hotkeys#5

How Has This Been Tested?

I ran OBS with this patch and with my wayland hotkeys plugin from inside konsole and the portal dialog properly showed up as "OBS Studio" requesting the hotkeys instead of "Konsole"

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • Tweak (non-breaking change to improve existing functionality)

Checklist:

  • I have read the contributing document.
  • My code has been run through clang-format.
  • My code follows the project's style guidelines
  • My code is not on the master branch.
  • My code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.

Qt 6.10.1+ will register the dbus app ID when outside a sandbox,
but that requires the desktop file name to be set earlier

This fixes portal dialogs using Qt dbus having the wrong app name
when launching OBS e.g via a terminal / not through the desktop file

see leia-uwu/obs-wayland-hotkeys#5
@leia-uwu
Copy link
Copy Markdown
Author

note: portal dialogs that use gio dbus instead of qt dbus still don't seem get proper app IDs when launched from a terminal (like the pipewire screencast portal) :/

i'm not familiar with glib2 and gio APIs to figure out how and where to call the portal registry to also fix that, if someone could figure out how to also fix those it would be nice

@Fenrirthviti
Copy link
Copy Markdown
Member

Does this still fix the issue that it was intended to fix in #5778?

@RytoEX
Copy link
Copy Markdown
Member

RytoEX commented Apr 14, 2026

Please confirm that this has no regressions on older versions of Qt and when launching OBS Studio normally.

@leia-uwu
Copy link
Copy Markdown
Author

yeah it shouldn't break anything, its just getting called earlier so Qt can know the app ID as early as possible

the portal dbus registry needs to be called before any other portal dbus call as stated in the documentation:

https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.host.portal.Registry.html

Registering must be done before any portal method call; registering after such a call will result in an error.

before it was getting called too late / after other stuff already did portal dbus calls

for older Qt versions I'm pretty sure it will change absolutely nothing, but i also can't easily test locally

@tytan652
Copy link
Copy Markdown
Collaborator

tytan652 commented Apr 15, 2026

note: portal dialogs that use gio dbus instead of qt dbus still don't seem get proper app IDs when launched from a terminal (like the pipewire screencast portal) :/

Portals expects the user to properly ran the application, running from a terminal (besides flatpak run) is not supported.
DEs usually expects you to use their UI with Desktop entries to run them, which allows to properly apply a cgroup and other things.

The registry portal is a crutch that should not be used unless necessary (toolkit using it without opt-in is not always the best thing).

@tytan652
Copy link
Copy Markdown
Collaborator

tytan652 commented Apr 15, 2026

Moving setDesktopFileName to ensure that it is called before any of our frontend portal calls to match Qt internal usage of the registry portal is fine.

But the "running from a terminal" and end up with the terminal ID is not fine as a justification.

@WizardCM WizardCM added kind/bug Categorizes issue or PR as related to a bug. kind/enhancement Enhancements are not bugs or new features but can improve usability or performance. labels Apr 18, 2026
@Warchamp7 Warchamp7 added this to the OBS Studio 32.2 milestone May 6, 2026
Copy link
Copy Markdown
Member

@RytoEX RytoEX left a comment

Choose a reason for hiding this comment

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

Commit message nits:

  • Capitalize the first word after the prefix as if it is the first word of a sentence or title (i.e., "Call" instead of "call")
  • Use "e.g.," instead of "e.g" (or drop it entirely)
  • Use "or" instead of "/"
  • Use punctuation at the end of sentences

Still looking for an approval from one of the other reviewers who might have a better idea about this change on Linux platforms.

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

Labels

kind/bug Categorizes issue or PR as related to a bug. kind/enhancement Enhancements are not bugs or new features but can improve usability or performance.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants