linux/systemd: add an app- prefix to the systemd unit#7959
Merged
jcollie merged 2 commits intoghostty-org:mainfrom Jul 16, 2025
Merged
linux/systemd: add an app- prefix to the systemd unit#7959jcollie merged 2 commits intoghostty-org:mainfrom
jcollie merged 2 commits intoghostty-org:mainfrom
Conversation
Member
Author
Member
Author
|
For future reference: flatpak/xdg-desktop-portal#579 |
The XDG Freedesktop Portal has a _major_ undocumented requirement for programs that are launched/controlled by `systemd` to interact with the Portal. The unit _must_ be named `app-<appid>.service`. The Portal uses the systemd unit name figure out what the program's application ID is and it will only look at unit names that begin with `app-`. I can find no place that this is documented other than by inspecting the code or the issue and PR that introduced this feature. See the following code: https://github.com/flatpak/xdg-desktop-portal/blob/7d4d48cf079147c8887da17ec6c3954acd5a285c/src/xdp-utils.c#L152-L220 This may fix many people's issues with getting global shortcuts to work. Note that this is a breaking change if you have been using Ghostty compiled from source since ghostty-org#7433 was merged. You will need to ensure that any Ghosty systemd unit files _not_ prefixed with `app-` are deleted. Original discussion/PR in the XDG Desktop Portal repository: flatpak/xdg-desktop-portal#579 flatpak/xdg-desktop-portal#719 Originally discussed on Discord: https://discord.com/channels/1005603569187160125/1394845362186879026 Co-authored-by: ambareeshbalaji@gmail.com
0a0a03d to
2435cee
Compare
pluiedev
approved these changes
Jul 16, 2025
Member
pluiedev
left a comment
There was a problem hiding this comment.
Maybe we want to leave a comment in the Zig code explaining exactly why this is, but this by itself already LGTM
mitchellh
approved these changes
Jul 16, 2025
Contributor
mitchellh
left a comment
There was a problem hiding this comment.
Good catch, nice comment. I think we should add a shorter comment to the unit file too just pointing people to maybe our build scripts to learn more, just for future people who may touch those files.
3c74648 to
959b2c8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The XDG Freedesktop Portal has a major undocumented requirement for
programs that are launched/controlled by
systemdto interact with thePortal. The unit must be named
app-<appid>.service. The Portal usesthe systemd unit name figure out what the program's application ID is
and it will only look at unit names that begin with
app-. I can findno place that this is documented other than by inspecting the code or the
issue and PR that introduced this feature. See the following code:
https://github.com/flatpak/xdg-desktop-portal/blob/7d4d48cf079147c8887da17ec6c3954acd5a285c/src/xdp-utils.c#L152-L220
This may fix many people's issues with getting global shortcuts
to work.
Note that this is a breaking change if you have been using Ghostty
compiled from source since #7433 was merged. You will need to ensure
that any Ghosty systemd unit files not prefixed with
app-aredeleted.
Original discussion/PR in the XDG Desktop Portal repository:
flatpak/xdg-desktop-portal#579
flatpak/xdg-desktop-portal#719
Originally discussed on Discord:
https://discord.com/channels/1005603569187160125/1394845362186879026
Co-authored-by: ambareeshbalaji@gmail.com