Vendor the command set the menu and shell depend on
This commit is contained in:
Executable
+24
@@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
# blob:summary=Detect whether the system has an active hybrid GPU configuration
|
||||
|
||||
multiple_gpus() {
|
||||
(($(lspci | grep -cE 'VGA|3D|Display') >= 2))
|
||||
}
|
||||
|
||||
if blob-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
|
||||
Reference in New Issue
Block a user