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>
20 lines
890 B
Lua
20 lines
890 B
Lua
local paths = require("default.hypr.paths")
|
|
|
|
local nvidia = paths.omarchy_path .. "/bin/omarchy-hw-nvidia"
|
|
local nvidia_gsp = paths.omarchy_path .. "/bin/omarchy-hw-nvidia-gsp"
|
|
local nvidia_without_gsp = paths.omarchy_path .. "/bin/omarchy-hw-nvidia-without-gsp"
|
|
|
|
-- These detectors read cached sysfs IDs rather than shelling out to lspci.
|
|
-- lspci reads PCI config space, which resumes a runtime-suspended GPU, and on a
|
|
-- hybrid laptop that wake alone outlasts Hyprland's 1.5s config reload budget.
|
|
if o.shell_succeeds(o.shell_quote(nvidia)) then
|
|
if o.shell_succeeds(o.shell_quote(nvidia_gsp)) then
|
|
hl.env("NVD_BACKEND", "direct")
|
|
hl.env("LIBVA_DRIVER_NAME", "nvidia")
|
|
hl.env("__GLX_VENDOR_LIBRARY_NAME", "nvidia")
|
|
elseif o.shell_succeeds(o.shell_quote(nvidia_without_gsp)) then
|
|
hl.env("NVD_BACKEND", "egl")
|
|
hl.env("__GLX_VENDOR_LIBRARY_NAME", "nvidia")
|
|
end
|
|
end
|