Files
nixos-config/docs/desktop.md
T
kiskaadee 6b845b68fc feat(niri): add monitor navigation and relocate workspace movement bindings
- Add Mod+` and Mod+Shift+` for next monitor focus and column transfer
- Add Mod+Ctrl+Down/Up for directional monitor switching
- Relocate workspace movement bindings to Mod+Ctrl+Page_Down/Page_Up
- Update docs/desktop.md with Monitor & Workspace Navigation reference table
2026-10-14 20:33:02 -05:00

7.8 KiB

🎨 Desktop Environment: Niri & DankMaterialShell (DMS)

This document describes the architecture of the workstation's graphical desktop environment, the boundary between declarative configuration and runtime state, and the master shortcut reference.


1. Desktop Architecture & Components

The graphical workstation stack is built from modern Wayland components:

graph TD
    GREETD["greetd + dank-greeter<br/><i>(Display Manager Login)</i>"] -->|Launches Session| NIRI["niri<br/><i>(Scrollable-Tiling Wayland Compositor)</i>"]

    subgraph "Compositor Configuration (Home Manager)"
        NIRI --> CFG["~/.config/niri/config.kdl<br/><i>(Layout, gestures, input, includes)</i>"]
        NIRI --> CUST["~/.config/niri/custom.kdl<br/><i>(Operator custom keybindings)</i>"]
    end

    subgraph "Desktop Shell (DMS Daemon)"
        DMS["dms run (systemd --user)<br/><i>(Quickshell panel, widgets, launcher)</i>"]
        DMS --> SPOTLIGHT["Spotlight App Launcher (Alt+Space / Mod+Space)"]
        DMS --> CLIPBOARD["Clipboard Manager (Mod+V)"]
        DMS --> TASKMGR["Task Manager (Mod+M)"]
        DMS --> POWERMENU["Power Menu (Super+X)"]
    end

    subgraph "DMS Runtime State (Mutable)"
        DMS --> BINDS["~/.config/niri/dms/binds.kdl<br/><i>(DMS-managed Niri IPC bindings)</i>"]
        DMS --> SETTINGS["~/.config/DankMaterialShell/settings.json<br/><i>(Panels, widgets, themes)</i>"]
        DMS --> DYN["~/.config/niri/dms/outputs.kdl & colors.kdl<br/><i>(Monitors, Matugen theme)</i>"]
    end

    CFG -.->|include optional=true| BINDS

2. The Ownership & Mutability Boundary

A critical architectural invariant is respecting the distinction between declarative specification and runtime-mutable state:

Layer Files Managed By Git? Mutability Rationale
Declarative Core home/config/niri/config.kdl
home/config/niri/custom.kdl
Yes Immutable store symlinks Governs compositor rules, gesture bindings, and personal shortcuts.
System Daemon system/desktop.nix Yes Immutable NixOS module Enables Niri, DMS package, Greetd greeter, fonts.
DMS Niri IPC Bindings ~/.config/niri/dms/binds.kdl No (Bootstrap-owned) Mutable (0644) Initialized via dms setup binds. Bridges Niri to DMS runtime controls; editable via GUI/CLI.
DMS UI Preferences ~/.config/DankMaterialShell/settings.json No Mutable Stores user's bar widget selections, padding, and corner radius.
Display Outputs ~/.config/niri/dms/outputs.kdl No Dynamic runtime Generated by DMS when external displays are connected/repositioned.
Color Schemes ~/.config/niri/dms/colors.kdl No Dynamic runtime Extracted by Matugen from the active wallpaper.

Important

binds.kdl is not part of the declarative workstation configuration. It is a bootstrap-owned artifact whose initial contents are established by dms setup binds. It serves as the bridge between Niri and DMS's runtime controls (the DMS-managed Niri IPC integration bindings). An empty or missing file disconnects a substantial portion of the desktop's control surface.

Caution

Do not attempt to manage ~/.config/niri/dms/ or ~/.config/DankMaterialShell/settings.json via Home Manager store symlinks. Doing so breaks DMS's runtime ability to persist display changes, theme updates, and interactive settings.


3. Desktop Initialization (Fresh User Profile)

On a fresh user profile (or after recreating $HOME), initialize the mutable baseline keybindings with:

dms setup binds

This ensures ~/.config/niri/dms/binds.kdl is created with proper user write permissions (0644) before Niri loads.


4. Master Shortcut Reference

Note

Precedence Rule: In config.kdl, include "custom.kdl" is evaluated after include optional=true "dms/binds.kdl". Where key definitions collide, custom.kdl overrides DMS defaults. Specifically:

  • Mod+O launches Obsidian (overriding DMS's secondary overview shortcut; toggle overview via Mod+Tab).
  • Mod+W triggers area screen recording (overriding DMS's column tabbed display toggle).

Core Applications & Session

Shortcut Action Source Precedence Note
Mod+Return Open Alacritty Terminal Custom (custom.kdl) Primary workstation terminal.
Mod+T Open Terminal DMS IPC (binds.kdl) Alternative terminal launcher.
Mod+B Launch Firefox Browser Custom (custom.kdl) Browser shortcut.
Mod+O Launch Obsidian Notes Custom (custom.kdl) Overrides DMS Mod+O overview.
Mod+Tab Toggle Niri Column Overview DMS IPC (binds.kdl) Primary overview trigger.
Mod+Space / Alt+Space Toggle Spotlight Application Launcher DMS IPC (binds.kdl) DMS app launcher modal.
Mod+V Toggle Clipboard Manager DMS IPC (binds.kdl) DMS clipboard history modal.
Mod+M Toggle Task Manager / Process List DMS IPC (binds.kdl) DMS process manager.
Super+X Toggle Power Menu (Lock / Suspend / Shutdown) DMS IPC (binds.kdl) DMS session menu.
Mod+Comma Open DMS Settings Modal DMS IPC (binds.kdl) Interactive desktop settings.
Mod+Shift+E Quit Niri Session Niri Native (binds.kdl) Exits Wayland compositor.

Window Management & Resizing

Shortcut Action Source
Mod+Q Close Active Window DMS IPC (binds.kdl)
Mod+Shift+Q Force Kill Focused Window Process (kill -9) Custom (custom.kdl)
Mod+F Maximize Focused Column DMS IPC (binds.kdl)
Mod+Shift+F Fullscreen Window DMS IPC (binds.kdl)
Mod+Shift+T Toggle Window Floating DMS IPC (binds.kdl)
Mod+Shift+W Create DMS Window Rule DMS IPC (binds.kdl)
Mod+Alt+Right / Left Expand / Shrink Column Width (+/- 100px) Custom (custom.kdl)
Mod+Alt+Down / Up Expand / Shrink Window Height (+/- 100px) Custom (custom.kdl)

Monitor & Workspace Navigation

Shortcut Action Source Precedence Note
`Mod+`` Focus Next Monitor Custom (custom.kdl) Orientation-agnostic toggle between displays.
`Mod+Shift+`` Move Focused Column to Next Monitor Custom (custom.kdl) Orientation-agnostic window transfer across displays.
Mod+Ctrl+Left / Right Focus Monitor Left / Right DMS IPC (binds.kdl) Directional monitor switching.
Mod+Ctrl+Down / Up Focus Monitor Down / Up Custom (custom.kdl) Overrides DMS workspace move to allow vertical monitor switching.
Mod+Shift+Ctrl+Arrow / HJKL Move Column to Monitor (Directional) DMS IPC (binds.kdl) Directional window transfer across displays.
Mod+Ctrl+Page_Down / Page_Up Move Column to Workspace Down / Up Custom (custom.kdl) Relocated from Mod+Ctrl+Down/Up for arrow/page users.
Mod+Ctrl+U / Mod+Ctrl+I Move Column to Workspace Down / Up DMS IPC (binds.kdl) Directional workspace column transfer.

Screenshots, Screen Recording & Utilities

Shortcut Action Source
Mod+S Interactive Area Screenshot Custom (custom.kdl)
Mod+Shift+S Screenshot Active Window Custom (custom.kdl)
Mod+Alt+S Screenshot Full Screen Custom (custom.kdl)
Mod+W Record Selected Screen Area (wf-recorder) Custom (custom.kdl, overrides tabbed column)
Mod+Shift+W Record Focused Monitor Custom (custom.kdl)
Mod+Ctrl+W Record Selected Area + Audio Custom (custom.kdl)
Mod+Ctrl+Shift+W Record Focused Monitor + Audio Custom (custom.kdl)
Mod+Shift+C Eyedropper Color Picker (copies HEX to clipboard) Custom (custom.kdl)
Mod+Ctrl+Shift+R Hot-Reload Niri Configuration Custom (custom.kdl)