Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux: Set application ID properly #1008

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

guihkx
Copy link

@guihkx guihkx commented Jan 3, 2024

This fixes window association issues on Linux.

Here's a before/after output from xprop:

Before:

$ xprop
...
_GTK_WINDOW_OBJECT_PATH(UTF8_STRING) = "/org/gtk/Application/anonymous/window/1"
_GTK_APPLICATION_OBJECT_PATH(UTF8_STRING) = "/org/gtk/Application/anonymous"

After:

$ xprop
...
_GTK_WINDOW_OBJECT_PATH(UTF8_STRING) = "/com/github/KRTirtho/Spotube/window/1"
_GTK_APPLICATION_OBJECT_PATH(UTF8_STRING) = "/com/github/KRTirtho/Spotube"
_GTK_APPLICATION_ID(UTF8_STRING) = "com.github.KRTirtho.Spotube"

@guihkx guihkx changed the title Llnux: Set application ID properly Linux: Set application ID properly Jan 5, 2024
@KRTirtho
Copy link
Owner

But com.github.krtirtho.spotube isn't the domain of the project it was only applied for Flathub as flathub doesn't accept domain .oss

@guihkx
Copy link
Author

guihkx commented Jan 24, 2024

I see...

On one hand, if I use oss.krtirtho.spotube globally, then window association on the Flatpak package will likely remain broken, because the application id has to match the name of its .desktop file.

On the other hand, the .desktop file on deb and rpm packages you distribute, is simply called spotube, which might also cause issues.

So, for your Linux packages I'd recommend you use the same id used on Flathub, and then rename the .desktop file accordingly (and optionally the icon file as well).

@KRTirtho
Copy link
Owner

I get your point, but can we do this conditionally instead of using a CMake variable? We can detect the runtime environment (Flatpak or not) and set the id accordingly.

https://stackoverflow.com/questions/75274925/is-there-a-way-to-find-out-if-i-am-running-inside-a-flatpak-appimage-or-another

@guihkx
Copy link
Author

guihkx commented Apr 12, 2024

I'm not sure I understand. The com.github.KRTirtho.Spotube id is only applied to Unix-like OSes (excluding macOS):

if(UNIX AND NOT APPLE)
set(APPLICATION_ID "com.github.KRTirtho.Spotube")
else()
set(APPLICATION_ID "oss.krtirtho.spotube")
endif()

@guihkx
Copy link
Author

guihkx commented Apr 12, 2024

I think I understand what you mean now: Do you want to only use the com.github.KRTirtho.Spotube for Flatpak, and use a different one for different Linux packaging formats?

If that's the case, please note that window association will still remain broken with these other packaging formats, unless you rename the spotube.desktop file to <app ID>.desktop as well.

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.

None yet

2 participants