Forráskód Böngészése

Sync: 2026-09-14 20:33:17

Gabriel Capella 1 hónapja
szülő
commit
f7073dc74e
2 módosított fájl, 16 hozzáadás és 2 törlés
  1. 14 0
      bootstrap
  2. 2 2
      dots/.config/sway/config

+ 14 - 0
bootstrap

@@ -146,6 +146,20 @@ TimeoutStopSec=5"; then
     reload_needed=1
 fi
 
+# ---------------------------------------------------------------------------
+# sleep: suspend-then-hibernate hibernates after 2h asleep (jellyfish only).
+#
+# sway's swayidle and lid switch call suspend-then-hibernate. This laptop only
+# supports s2idle, which drains the battery noticeably, so a forgotten suspend
+# would otherwise run it flat. Unset, systemd guesses from the discharge rate;
+# a fixed delay is predictable. Read at sleep time -- no reload needed.
+# ---------------------------------------------------------------------------
+if [[ $hostname_id == jellyfish ]]; then
+    install_file /etc/systemd/sleep.conf.d/10-hibernate-delay.conf \
+"[Sleep]
+HibernateDelaySec=2h" || true
+fi
+
 if [[ $reload_needed -eq 1 ]]; then
     log_info "Reloading systemd"
     sudo systemctl daemon-reload

+ 2 - 2
dots/.config/sway/config

@@ -241,12 +241,12 @@ input type:pointer {
 exec swayidle -w \
          timeout 300 'gtklock -d -c /home/capella/.config/gtklock/config.ini' \
          timeout 600 'swaymsg "output * power off"' resume 'swaymsg "output * power on"' \
-         timeout 1200 'systemctl suspend' \
+         timeout 1200 'systemctl suspend-then-hibernate' \
          before-sleep 'gtklock -d -c /home/capella/.config/gtklock/config.ini'
 
 bindsym $mod+q exec 'gtklock -d -c /home/capella/.config/gtklock/config.ini'
 
-bindswitch --reload --locked lid:on exec 'gtklock -d -c /home/capella/.config/gtklock/config.ini && systemctl suspend'
+bindswitch --reload --locked lid:on exec 'gtklock -d -c /home/capella/.config/gtklock/config.ini && systemctl suspend-then-hibernate'
 # @end
 
 # @host tompot