Session manager for Niri that automatically saves and restores your window layout.
- Auto-saves session every 5 minutes (configurable)
- Restores windows to their workspaces on startup
- Preserves workspace names, indices, outputs, and window sizes
- Map
app_idto custom launch commands - Skip specific apps from being restored
Add nirinit to your flake inputs:
{
inputs.nirinit = {
url = "github:amaanq/nirinit";
inputs.nixpkgs.follows = "nixpkgs";
};
}Import the NixOS module and configure:
# configuration.nix
{ inputs, ... }:
{
imports = [ inputs.nirinit.nixosModules.nirinit ];
services.nirinit = {
enable = true;
settings = {
# Map app_id to launch command (useful for PWAs, flatpaks, etc.)
launch = {
"chromium-example.com__-Default" = "example-web-app";
};
# Apps to skip during restore
skip.apps = [ "steam" ];
};
};
}Import the Home Manager module to generate the config file:
# home.nix
{ inputs, ... }:
{
imports = [ inputs.nirinit.homeModules.nirinit ];
}Note: Settings are defined in the NixOS module. The Home Manager module reads
from osConfig and generates $XDG_CONFIG_HOME/nirinit/config.toml.
cargo install --path .
# Run as systemd user service or manually
nirinit --save-interval 300The config file is located at $XDG_CONFIG_HOME/nirinit/config.toml
(typically ~/.config/nirinit/config.toml).
[skip]
apps = ["steam"]
[launch]
# Map app_id to the actual command to spawn
"chromium-example.com__-Default" = "example-web-app"The session file is located at $XDG_DATA_HOME/nirinit/session.json
(typically ~/.local/share/nirinit/session.json).
You shouldn't need to touch this. However, if session restore is acting up, deleting it is a safe way to start fresh and might fix issues.
MPL-2.0