configs

configs
git clone https://git.prime8.dev/configs.git
Log | Files | Refs | README

commit 87766d7789cf8ebc613610bfb96e4ce2e1844a93
parent 6c1b170643b6e6ce39265082398b297979e7f9ec
Author: Damian Myrda <damian@prime8.dev>
Date:   Tue, 17 Feb 2026 21:38:52 -0600

add suspend-then-hibernate on lid close

- configure systemd-logind to suspend then hibernate when lid is closed
- set 30min delay before auto-hibernation
- add hibernation kernel arg detection to setup.sh
- install systemd configs via link.sh

Diffstat:
Mlink.sh | 25+++++++++++++++++++++++++
Aprograms/systemd/logind.conf | 4++++
Aprograms/systemd/sleep.conf | 2++
Msetup.sh | 20++++++++++++++++++++
4 files changed, 51 insertions(+), 0 deletions(-)

diff --git a/link.sh b/link.sh @@ -108,6 +108,31 @@ if [ -d "$PROGRAMS_DIR/modprobe" ]; then done fi +# Systemd configs (system-wide, requires sudo) +if [ -d "$PROGRAMS_DIR/systemd" ]; then + echo "→ Installing systemd configs..." + + # Install logind.conf + if [ -f "$PROGRAMS_DIR/systemd/logind.conf" ]; then + echo " → Installing logind.conf" + if [ -e "/etc/systemd/logind.conf" ]; then + sudo mv "/etc/systemd/logind.conf" "/etc/systemd/logind.conf.bak" + fi + sudo cp "$PROGRAMS_DIR/systemd/logind.conf" "/etc/systemd/logind.conf" + echo " ✅ Installed logind.conf" + fi + + # Install sleep.conf + if [ -f "$PROGRAMS_DIR/systemd/sleep.conf" ]; then + echo " → Installing sleep.conf" + if [ -e "/etc/systemd/sleep.conf" ]; then + sudo mv "/etc/systemd/sleep.conf" "/etc/systemd/sleep.conf.bak" + fi + sudo cp "$PROGRAMS_DIR/systemd/sleep.conf" "/etc/systemd/sleep.conf" + echo " ✅ Installed sleep.conf" + fi +fi + # Systemd user services mkdir -p "$HOME/.local/bin" link_config "$PROGRAMS_DIR/systemd/g14-volume-sync" "$HOME/.local/bin/g14-volume-sync" diff --git a/programs/systemd/logind.conf b/programs/systemd/logind.conf @@ -0,0 +1,4 @@ +[Login] +HandleLidSwitch=suspend-then-hibernate +HandleLidSwitchExternalPower=suspend-then-hibernate +HandleLidSwitchDocked=ignore diff --git a/programs/systemd/sleep.conf b/programs/systemd/sleep.conf @@ -0,0 +1,2 @@ +[Sleep] +HibernateDelaySec=30min diff --git a/setup.sh b/setup.sh @@ -212,6 +212,26 @@ fi # Symlink configs "$SCRIPT_DIR/link.sh" +# Enable hibernation support +## Check if swap partition exists and resume karg is set +SWAP_DEV="/dev/nvme0n1p3" +if [ -b "$SWAP_DEV" ]; then + SWAP_UUID=$(lsblk -no UUID "$SWAP_DEV" 2>/dev/null || echo "") + if [ -n "$SWAP_UUID" ]; then + if ! rpm-ostree kargs | grep -q "resume=UUID=$SWAP_UUID"; then + echo "Adding resume kernel argument for hibernation..." + sudo rpm-ostree kargs --append="resume=UUID=$SWAP_UUID" + echo "Hibernation enabled. Reboot required to apply changes." + else + echo "Resume kernel argument already set" + fi + else + echo "Warning: Could not determine UUID for $SWAP_DEV" + fi +else + echo "Warning: Swap partition $SWAP_DEV not found" +fi + # Change default shell to fish if command -v fish &>/dev/null; then if [ "$SHELL" != "$(which fish)" ]; then