From a6e27b890352338cb96198c2959a5635394cf28e Mon Sep 17 00:00:00 2001 From: Henrik Bakken Date: Thu, 6 Nov 2025 15:42:30 +0100 Subject: [PATCH] sleep hack for surface --- CONFIG/sway/scripts/power_menu.sh | 2 +- .../ROOT/etc/systemd/logind.conf.d/suspend.conf | 8 ++++---- .../ROOT/lib/systemd/system-sleep/iptsd-hack.sh | 12 ++++++++++++ .../ROOT/etc/systemd/logind.conf.d/suspend.conf | 8 ++++---- .../ROOT/lib/systemd/system-sleep/iptsd-hack.sh | 12 ++++++++++++ endos.py | 3 +++ 6 files changed, 36 insertions(+), 9 deletions(-) create mode 100755 custom-sl3/ROOT/lib/systemd/system-sleep/iptsd-hack.sh create mode 100755 custom-spro5/ROOT/lib/systemd/system-sleep/iptsd-hack.sh diff --git a/CONFIG/sway/scripts/power_menu.sh b/CONFIG/sway/scripts/power_menu.sh index 3e782a9..34a1a32 100755 --- a/CONFIG/sway/scripts/power_menu.sh +++ b/CONFIG/sway/scripts/power_menu.sh @@ -13,7 +13,7 @@ case $SELECTION in gtklock;; *"󰤄 Suspend"*) if confirm_action "Suspend"; then - systemctl suspend + systemctl suspend-then-hibernate fi;; *"󰍃 Log out"*) if confirm_action "Log out"; then diff --git a/custom-sl3/ROOT/etc/systemd/logind.conf.d/suspend.conf b/custom-sl3/ROOT/etc/systemd/logind.conf.d/suspend.conf index 33648b7..eccabdd 100644 --- a/custom-sl3/ROOT/etc/systemd/logind.conf.d/suspend.conf +++ b/custom-sl3/ROOT/etc/systemd/logind.conf.d/suspend.conf @@ -1,8 +1,8 @@ [Login] -IdleAction=suspend-then-hibernate +IdleAction=hibernate IdleActionSec=10min -HandlePowerKey=suspend-then-hibernate +HandlePowerKey=hibernate HandlePowerKeyLongPress=poweroff -HandleLidSwitch=suspend-then-hibernate -HandleLidSwitchExternalPower=suspend-then-hibernate +HandleLidSwitch=hibernate +HandleLidSwitchExternalPower=hibernate HandleLidSwitchDocked=ignore diff --git a/custom-sl3/ROOT/lib/systemd/system-sleep/iptsd-hack.sh b/custom-sl3/ROOT/lib/systemd/system-sleep/iptsd-hack.sh new file mode 100755 index 0000000..ce1d7d8 --- /dev/null +++ b/custom-sl3/ROOT/lib/systemd/system-sleep/iptsd-hack.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +# This file (or a link to it) must be in /lib/systemd/system-sleep/iptsd.sh +logger -t "iptsd-hack" "\$0=$0, \$1=$1, \$2=$2" + +if [ $1 == "pre" ]; then + logger -t "iptsd-hack" "stopping iptsd" + iptsd-systemd -- stop +else + logger -t "iptsd-hack" "starting iptsd" + iptsd-systemd -- start +fi diff --git a/custom-spro5/ROOT/etc/systemd/logind.conf.d/suspend.conf b/custom-spro5/ROOT/etc/systemd/logind.conf.d/suspend.conf index 33648b7..eccabdd 100644 --- a/custom-spro5/ROOT/etc/systemd/logind.conf.d/suspend.conf +++ b/custom-spro5/ROOT/etc/systemd/logind.conf.d/suspend.conf @@ -1,8 +1,8 @@ [Login] -IdleAction=suspend-then-hibernate +IdleAction=hibernate IdleActionSec=10min -HandlePowerKey=suspend-then-hibernate +HandlePowerKey=hibernate HandlePowerKeyLongPress=poweroff -HandleLidSwitch=suspend-then-hibernate -HandleLidSwitchExternalPower=suspend-then-hibernate +HandleLidSwitch=hibernate +HandleLidSwitchExternalPower=hibernate HandleLidSwitchDocked=ignore diff --git a/custom-spro5/ROOT/lib/systemd/system-sleep/iptsd-hack.sh b/custom-spro5/ROOT/lib/systemd/system-sleep/iptsd-hack.sh new file mode 100755 index 0000000..ce1d7d8 --- /dev/null +++ b/custom-spro5/ROOT/lib/systemd/system-sleep/iptsd-hack.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +# This file (or a link to it) must be in /lib/systemd/system-sleep/iptsd.sh +logger -t "iptsd-hack" "\$0=$0, \$1=$1, \$2=$2" + +if [ $1 == "pre" ]; then + logger -t "iptsd-hack" "stopping iptsd" + iptsd-systemd -- stop +else + logger -t "iptsd-hack" "starting iptsd" + iptsd-systemd -- start +fi diff --git a/endos.py b/endos.py index cb26a9a..bfe3038 100755 --- a/endos.py +++ b/endos.py @@ -345,8 +345,11 @@ def install_sway(overwrite: bool, reinstall: bool) -> None: "etc/systemd/logind.conf.d/suspend.conf", "etc/systemd/sleep.conf.d/hibernate.conf", "etc/greetd/sway.cfg", + "lib/systemd/system-sleep/iptsd.sh", ]: src = CUSTOM_SRC / "ROOT" / sub + if not src.exists(): + continue tgt = ROOT_TGT / sub run(["sudo", "mkdir", "-p", str(tgt.parent)]) if tgt.exists():