fix: show discrete GPU as default within cosmic context menu

PrefersNonDefaultGPU is specified as follows in the Specification:
  If true, the application prefers to be run on a more powerful discrete
  GPU if available, which we describe as “a GPU other than the default
  one” in this spec to avoid the need to define what a discrete GPU is
  and in which cases it might be considered more powerful than the
  default GPU. This key is only a hint and support might not be present
  depending on the implementation.
  https://specifications.freedesktop.org/desktop-entry/latest/recognized-keys.html

Checking for a Discrete GPU is a more accurate implementation
despite the misleading name.
This commit is contained in:
Sentry 2026-02-14 21:17:43 +01:00 • committed by Michael Murphy
parent 5b86851071
commit a332a3a733
2 changed files with 2 additions and 2 deletions

View file

@ -299,7 +299,7 @@ impl<W: AsyncWrite + Unpin> App<W> {
if let Some(gpus) = self.gpus.as_ref() {
let default_idx = if entry.prefers_non_default_gpu() {
gpus.iter().position(|gpu| !gpu.default).unwrap_or(0)
gpus.iter().position(|gpu| gpu.discrete).unwrap_or(0)
} else {
gpus.iter().position(|gpu| gpu.default).unwrap_or(0)
};