Thanks to visit codestin.com
Credit goes to github.com

Skip to content
/ nirinit Public

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

License

Notifications You must be signed in to change notification settings

amaanq/nirinit

Repository files navigation

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
  • 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 = {
        "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.

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).

[skip]
apps = ["steam"]

[launch]
# Map app_id to the actual command to spawn
"chromium-example.com__-Default" = "example-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

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published