Trying to fix hibernation and suspension
This commit is contained in:
1 parent
f3d6cdd615
commit
60de80e2e0
3 files changed
+53
No files matched your search
Executable
+39
@@ -0,0 +1,39 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# off: called by niri-dpms-before-nvidia-sleep.service, before nvidia-sleep.sh.
|
||||||
|
# post: called by systemd-sleep after the kernel sleep returns, including
|
||||||
|
# when that return is an error and nvidia-resume.service does not run.
|
||||||
|
# pre: systemd-sleep also invokes every hook here.
|
||||||
|
|
||||||
|
action=$1
|
||||||
|
if [ "$action" != off ] && [ "$action" != post ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
set -- /run/user/1000/niri.wayland-*.sock
|
||||||
|
if [ ! -S "$1" ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
socket=$1
|
||||||
|
if [ "$action" = off ]; then
|
||||||
|
verb=power-off-monitors
|
||||||
|
else
|
||||||
|
verb=power-on-monitors
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$(id -u)" -eq 0 ]; then
|
||||||
|
runuser -u benq -- env \
|
||||||
|
XDG_RUNTIME_DIR=/run/user/1000 \
|
||||||
|
NIRI_SOCKET="$socket" \
|
||||||
|
/usr/bin/niri msg action "$verb" || exit $?
|
||||||
|
else
|
||||||
|
env \
|
||||||
|
XDG_RUNTIME_DIR=/run/user/1000 \
|
||||||
|
NIRI_SOCKET="$socket" \
|
||||||
|
/usr/bin/niri msg action "$verb" || exit $?
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$action" = off ]; then
|
||||||
|
# Let in-flight page flips drain before nvidia_modeset tears DisplayPort down.
|
||||||
|
sleep 0.3
|
||||||
|
fi
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Blank niri outputs before NVIDIA sleep
|
||||||
|
Before=nvidia-suspend.service nvidia-hibernate.service
|
||||||
|
DefaultDependencies=no
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
User=benq
|
||||||
|
Environment=XDG_RUNTIME_DIR=/run/user/1000
|
||||||
|
ExecStart=/etc/systemd/system-sleep/niri-dpms off
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=nvidia-suspend.service nvidia-hibernate.service
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
w /sys/power/image_size - - - - 21474836480
|
||||||
Reference in new issue
Block a user