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

2
Cargo.lock generated
View file

@ -2386,7 +2386,7 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
[[package]] [[package]]
name = "switcheroo-control" name = "switcheroo-control"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/pop-os/dbus-settings-bindings#3b86984332be2c930a3536ab714b843c851fa8ca" source = "git+https://github.com/pop-os/dbus-settings-bindings#0fa672f8dadb884001ef9a251b149ed432879629"
dependencies = [ dependencies = [
"zbus", "zbus",
] ]

View file

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