-
Notifications
You must be signed in to change notification settings - Fork 47
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
libcosmic: Add desktop-file helpers #281
Conversation
1fc5463
to
b287acf
Compare
I noticed that COSMIC applications weren't running on integrated graphics by default unless explicitly setting |
So an app would lookup it's own desktop file and assuming it finds one check if it has the dGPU preference set? Sounds neat, but I don't think this would work in a sandbox like flatpak. I am honestly a bit annoyed of this behavior by wgpu. It should select whatever mesa picks by default to allow environment variables to work correctly. |
There's only two main env vars that will be set by switccheroo control, one for nvidia, one for amd. Our apps should set wgpu power pref if those are not set |
DRI_PRIME the default GPU is the one used by Wayland/Xorg or the one connected to a display. This variable allows to select a different GPU. It applies to OpenGL and Vulkan (in this case “select” means the GPU will be first in the reported physical devices list). The supported syntaxes are:
For Vulkan it’s possible to append !, in which case only the selected GPU will be exposed to the application (eg: DRI_PRIME=1!). |
Honestly, parsing these environment variables manually feels like a hack as well and get more complicated when you consider things like I think the first thing we should do is neither force this to Overall I am not happy we need to fix WGPU's enumeration here at all, but at least there is an open issue for that, so I am not entirely unhopeful that this will be fixed long-term upstream: gfx-rs/wgpu#3464 (Possibly something we could contribute.) |
b287acf
to
d10650e
Compare
This looks good to me, it just needs a cargo fmt, anything else you want to do in this PR? |
d10650e
to
efaa451
Compare
Ready for review, now that I have verified, that this is good enough for all potential users:
|
Gonna leave the branch for you to delete when the prs are updated |
This is an attempt at unifying implementations of this across
cosmic-applibrary
,cosmic-launcher
,cosmic-app-list
(in cosmic-applets) and sooncosmic-store
.This is mostly based on the app-list implementation, as that parses most of the desktop files contents. Particular attention was given to allow for all the different filtering these apps do, as well as to easy icon handling. Additionally contains code necessary for handling gpu selection in the future (
prefers_dgpu
and explicitly setting awayland_display
for the spawn method).This is just doing code deduplication and cleanup, the goal is not e.g. to do complete
exec
parsing in this PR.I'll keep this as a draft until I have written proper implementations against all our use-cases, but in principle this is ready for review.