Commit fd9d5ea09627
Changed files (1)
imperative
aomi
imperative/aomi/bootstrap.sh
@@ -230,7 +230,30 @@ setup_tpm() {
fi
}
-# --- Phase 5: unscd for nix NSS resolution ---
+# --- Phase 5: lid-close behavior (systemd-logind) ---
+
+setup_lid() {
+ # Under niri there is no gnome-settings-daemon power plugin, so lid handling
+ # is governed entirely by systemd-logind (dconf/gsettings have no effect).
+ # Ignore lid close on AC and when docked (external monitor use), but still
+ # suspend on battery.
+ log_info "Configuring lid-close behavior (systemd-logind)..."
+
+ sudo install -d /etc/systemd/logind.conf.d
+ sudo tee /etc/systemd/logind.conf.d/10-lid.conf >/dev/null <<-'EOF'
+ [Login]
+ HandleLidSwitch=suspend
+ HandleLidSwitchExternalPower=ignore
+ HandleLidSwitchDocked=ignore
+ EOF
+
+ # logind reads this config on events; reload makes it pick up the new file
+ # without the session disruption a full restart can cause.
+ sudo systemctl reload systemd-logind
+ log_info "Lid behavior: suspend on battery, ignore on AC/docked"
+}
+
+# --- Phase 6: unscd for nix NSS resolution ---
setup_unscd() {
# Nix glibc can't load system NSS modules (libnss_sss.so) so nix programs
@@ -379,6 +402,7 @@ main() {
setup_wireguard
install_native_apps
setup_tpm
+ setup_lid
setup_unscd
setup_home_manager
setup_shell