#!/usr/bin/env sh
case "$1" in
post)
# Check device number with `lspci | grep -i nvidia` and replace it here!
echo 'auto' > '/sys/bus/pci/devices/0000:01:00.0/power/control'
;;
esac
gpu-switch() {
if [ ! -z $(command -v optimus-manager) ]; then
if [[ "$(glxinfo | grep "OpenGL vendor")" =~ .*Intel.* ]] && \
[[ "$(cat '/sys/bus/pci/devices/0000:01:00.0/power/control')" == "auto" ]]
then
read -p "Are you sure? System will reboot! [Y/n] " -r
if [[ ! $REPLY =~ ^[Nn]$ ]]; then
optimus-manager --set-startup nvidia_once
reboot
fi
else
optimus-manager --switch auto
i3-msg exit
fi
fi
}
尝试使用以下内核参数之一:
GRUB_CMDLINE_LINUX="pcie_port_pm=off"
GRUB_CMDLINE_LINUX="acpi_osi=! acpi_osi='Windows 2009' pcie_port_pm=off"
GRUB_CMDLINE_LINUX="acpi_osi!'Windows 2009"
GRUB_CMDLINE_LINUX="acpi_osi=! acpi_osi='Windows 2009'"
GRUB_CMDLINE_LINUX="Linux"
如果这些没有帮助,那么创建
/lib/systemd/system-sleep/fan_madness_after_suspend.sh
:如果您使用带有optimus-manager 的Arch Linux,那么这个用于切换 GPU 的 Bash 脚本可能会很方便: