Last active
March 7, 2025 09:05
-
-
Save danilw/000f6aa34f7e950950fa526d25456db1 to your computer and use it in GitHub Desktop.
Nvidia make suspend work in Linux in Wayland
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Source: | |
https://gist.github.com/jstarcher/abdac9c2c0b5de8b073d527870b73a19 | |
https://bbs.archlinux.org/viewtopic.php?pid=2044189#p2044189 | |
/etc/modprobe.d/nvidia.conf | |
blacklist nouveau | |
options nvidia_drm modeset=1 | |
options nvidia_drm fbdev=1 | |
options nvidia NVreg_EnableGpuFirmware=0 | |
options nvidia NVreg_PreserveVideoMemoryAllocations=1 NVreg_TemporaryFilePath=/var/tmp | |
boot grub kernel option: | |
nvidia_drm.modeset=1 nvidia_drm.fbdev=1 | |
/usr/local/bin/suspend-gnome-shell.sh | |
#!/bin/bash | |
case "$1" in | |
suspend) | |
killall -STOP chrome | |
killall -STOP firefox | |
killall -STOP gnome-shell | |
;; | |
resume) | |
killall -CONT gnome-shell | |
killall -CONT chrome | |
killall -CONT firefox | |
;; | |
esac | |
sudo chmod +x /usr/local/bin/suspend-gnome-shell.sh | |
/etc/systemd/system/gnome-shell-suspend.service | |
[Unit] | |
Description=Suspend gnome-shell | |
Before=systemd-suspend.service | |
Before=systemd-hibernate.service | |
Before=nvidia-suspend.service | |
Before=nvidia-hibernate.service | |
[Service] | |
Type=oneshot | |
ExecStart=/usr/local/bin/suspend-gnome-shell.sh suspend | |
[Install] | |
WantedBy=systemd-suspend.service | |
WantedBy=systemd-hibernate.service | |
/etc/systemd/system/gnome-shell-resume.service | |
[Unit] | |
Description=Resume gnome-shell | |
After=systemd-suspend.service | |
After=systemd-hibernate.service | |
After=nvidia-resume.service | |
[Service] | |
Type=oneshot | |
ExecStart=/usr/local/bin/suspend-gnome-shell.sh resume | |
[Install] | |
WantedBy=systemd-suspend.service | |
WantedBy=systemd-hibernate.service | |
systemctl daemon-reload | |
systemctl enable gnome-shell-suspend | |
systemctl enable gnome-shell-resume | |
reboot | |
OPTIONAL - to block wakeup from keyboard (or when keyboard broken and wakeup automatically) | |
echo PTXH | sudo tee /proc/acpi/wakeup | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment