lspci reads PCI config space, and the kernel resumes a runtime-suspended device to serve that read. On a hybrid laptop the discrete GPU idles in D3cold, so the first lspci of a Hyprland config load spends over a second waking it — longer than the 1.5s budget Hyprland gives the whole load. The reload then fails at whichever line runs next, which is why the error pointed at default/hypr/apps/1password.lua rather than at nvidia.lua. Read the vendor, class, and device IDs from sysfs instead. Those are served from cached fields and never touch config space, so nothing wakes up. Classify by device ID while we're here: Turing is both the first generation with GSP firmware and the first at 0x1e00 or above, and Maxwell opens at 0x1340, one ID past the last Kepler part. Bounding the older detector at both ends keeps pre-Maxwell cards off the 580xx driver that cannot drive them, and picks up the Maxwell and Pascal parts the lspci name regex used to miss. omarchy-hw-nvidia was also checked in without its executable bit, which it needs now that nvidia.lua runs it. Fixes #6660 Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
21 lines
685 B
Bash
Executable File
21 lines
685 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# omarchy:summary=Detect whether the computer has an NVIDIA GPU with GSP firmware (Turing or newer).
|
|
|
|
# Turing is the first generation with GSP firmware, and the first to use device
|
|
# IDs at 0x1e00 or above; Maxwell, Pascal, and Volta all sit below that line.
|
|
#
|
|
# Read the cached sysfs IDs rather than lspci, which reads PCI config space and
|
|
# resumes runtime-suspended GPUs.
|
|
pci_devices_path="${OMARCHY_PCI_DEVICES_PATH:-/sys/bus/pci/devices}"
|
|
|
|
shopt -s nullglob
|
|
|
|
for device in "$pci_devices_path"/*; do
|
|
[[ $(< "$device/vendor") == "0x10de" ]] || continue
|
|
[[ $(< "$device/class") == 0x03* ]] || continue
|
|
(( $(< "$device/device") >= 0x1e00 )) && exit 0
|
|
done
|
|
|
|
exit 1
|