Commit 431185c836fd

Vincent Demeester <vincent@sbr.pm>
2026-03-27 13:38:00
fix(regreet): pre-seed state for session auto-select
ReGreet populates the session dropdown but never auto-selects an entry without cached state. On first boot the cache is empty, and manual entry doesn't persist because sess_id is None. Added an activation script to seed state.toml so Niri is pre-selected.
1 parent a4c9e76
Changed files (1)
systems
common
desktop
systems/common/desktop/niri.nix
@@ -39,6 +39,17 @@
   systemd.services.greetd.environment.XDG_DATA_DIRS =
     "${config.services.displayManager.sessionData.desktops}/share";
 
+  # Pre-seed ReGreet state so "Niri" is auto-selected in the session dropdown.
+  # Without this, the session combo box is populated but nothing is selected
+  # because regreet only auto-selects from cache (which is empty on first boot).
+  system.activationScripts.regreet-state.text = ''
+    if [ ! -f /var/lib/regreet/state.toml ]; then
+      mkdir -p /var/lib/regreet
+      printf 'last_user = "vincent"\n\n[user_to_last_sess]\nvincent = "Niri"\n' > /var/lib/regreet/state.toml
+      chown greeter:greeter /var/lib/regreet/state.toml
+    fi
+  '';
+
   # ReGreet greeter (runs under cage via greetd)
   # Unlocks gnome-keyring via PAM on login
   programs.regreet = {