/ de-omarchy / bin / omarchy-hw-hybrid-gpu
swadhinbiswas Initial de-omarchy: Omarchy UI layer for Arch-based distros · 8/22/2026
9f393b2
25 lines · 674 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/bash

# omarchy:summary=Detect whether the system has an active hybrid GPU configuration

multiple_gpus() {
  (($(lspci | grep -cE 'VGA|3D|Display') >= 2))
}

if omarchy-cmd-present supergfxctl; then
  # A wedged supergfxd blocks its clients forever, and this gate runs while
  # the menu renders. Bound the query, and treat a daemon that cannot answer
  # like a machine without supergfxctl: count GPUs instead of hiding hardware
  # that is really there.
  modes=$(timeout --kill-after=1s 1s supergfxctl -s 2>/dev/null)
  status=$?

  if ((status == 124 || status == 137)); then
    multiple_gpus
  else
    grep -qw Hybrid <<<"$modes"
  fi
else
  multiple_gpus
fi