Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nirvana Daemon

A high-performance Rust daemon that provides system services for Nirvana Shell.

Features

  • Niri IPC - Real-time workspace and window events via niri's event stream
  • Audio Control - PulseAudio/PipeWire volume and mute control
  • Notifications - D-Bus notification daemon (org.freedesktop.Notifications)
  • Clipboard - Wayland clipboard read/write via wl-clipboard

Building

cargo build --release

Binary will be at target/release/nirvana-daemon (~2.7MB stripped).

Installation

./install.sh

This will:

  1. Build the release binary
  2. Install systemd user service
  3. Enable on graphical session start

Usage

Start manually

systemctl --user start nirvana-daemon

Enable on login

systemctl --user enable nirvana-daemon

Check status

systemctl --user status nirvana-daemon

View logs

journalctl --user -u nirvana-daemon -f

Socket Protocol

The daemon exposes a Unix socket at /tmp/nirvana-daemon.sock.

Request Format (JSON-RPC style)

{"method": "GetState"}
{"method": "SetVolume", "params": {"volume": 50}}
{"method": "ToggleMute"}
{"method": "FocusWorkspace", "params": {"id": 1}}
{"method": "Subscribe"}

Response Format

{"type": "Ok"}
{"type": "Error", "data": {"message": "..."}}
{"type": "State", "data": {...}}
{"type": "Event", "data": {...}}

Events (after Subscribe)

{"type": "Event", "data": {"type": "WorkspacesChanged", "data": [...]}}
{"type": "Event", "data": {"type": "VolumeChanged", "data": {"volume": 50, "muted": false}}}
{"type": "Event", "data": {"type": "NotificationAdded", "data": {...}}}

Architecture

nirvana-daemon
├── main.rs          # Entry point, service orchestration
├── state.rs         # Shared state (workspaces, windows, audio, notifications)
├── server.rs        # Unix socket server for QML clients
├── niri.rs          # Niri IPC event streaming
├── audio.rs         # PulseAudio/PipeWire integration
├── notifications.rs # D-Bus notification service
└── clipboard.rs     # wl-clipboard wrapper

Dependencies

  • niri-ipc - Niri IPC types and protocol
  • tokio - Async runtime
  • zbus - D-Bus for notifications
  • libpulse-binding - PulseAudio control
  • serde_json - JSON serialization
  • tracing - Structured logging

QML Integration

Connect from Quickshell QML:

import QtQuick
import Quickshell.Io

PersistentProcess {
    running: true
    stdinEnabled: true
    
    onStarted: {
        write('{"method": "Subscribe"}\n');
    }
    
    stdout: SplitParser {
        onRead: data => {
            const event = JSON.parse(data);
            if (event.type === "Event") {
                handleEvent(event.data);
            }
        }
    }
}

License

MIT

About

Rust daemon for Nirvana Shell (Niri + Quickshell) - Audio, Network, Power, Notifications, Clipboard

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages