#window-manager #niri #session-manager #wayland #session #wayland-session

app nirinit

A session manager for Niri, a scrollable-tiling Wayland compositor

8 releases

Uses new Rust 2024

0.3.1 Oct 30, 2026
0.2.2 Feb 25, 2026
0.1.4 Jan 2, 2026
0.1.3 Oct 2, 2025

#254 in Configuration

24 downloads per month

MPL-2.0 and GPL-3.0-or-later

32KB
590 lines

nirinit

Session manager for Niri that automatically saves and restores your window layout.

Features

  • Auto-saves session every 5 minutes (configurable)
  • Restores windows to their workspaces on startup
  • Preserves workspace names, indices, outputs, and window sizes
  • Finds launch commands from installed .desktop entries (flatpaks, PWAs, etc.)
  • Map app_id to custom launch commands
  • Skip specific apps from being restored

Installation

NixOS + Home Manager

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 = {
        "chrome-discord.com__app-Default" = "discord-web-app";
      };
      # Apps to skip during restore
      skip.apps = [ "steam" ];
    };
  };
}

The config file will live in the nix store and its path is specified using the --config flag in the systemd service.

Prebuilt Binaries

Each release has statically linked nirinit-linux-amd64 and nirinit-linux-arm64 binaries that run on any distro.

Manual

cargo install --path .

# Run as systemd user service or manually
nirinit --save-interval 300

Configuration

The config file is located at $XDG_CONFIG_HOME/nirinit/config.toml (typically ~/.config/nirinit/config.toml).

# Prepended to every launch command
wrapper = "uwsm app --"

[skip]
apps = ["steam"]

[launch]
# Map app_id to the actual command to spawn, run through the shell. This is only
# needed when no installed .desktop entry has a matching file name or StartupWMClass.
"chrome-discord.com__app-Default" = "discord-web-app"

Session File

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.

License

MPL-2.0

Dependencies

~3–4.5MB
~100K SLoC