Skip to content

First session

Before an agent acts on your desktop, give yourself a key that takes it back. Add a bind to your niri config (~/.config/niri/config.kdl):

binds {
Mod+Shift+Escape allow-inhibiting=false allow-when-locked=true hotkey-overlay-title="Stop the AI agent (niri-computer-use)" { spawn "/home/you/.local/bin/niri-computer-use" "stop"; }
}

Put the line inside your existing binds block, with the binary’s full path: the install script prints this line with yours, and cargo install puts the binary in ~/.cargo/bin. niri reloads its config when you save it; niri validate checks it first. allow-inhibiting=false keeps the key working while an app inhibits shortcuts, and allow-when-locked=true on the lock screen. niri passes NIRI_SOCKET to what it spawns, so the stop reaches this niri instance.

The key cancels the running action, takes the lease back and refuses further actions until you run, with the same full path:

~/.local/bin/niri-computer-use resume

After cargo install it’s ~/.cargo/bin/niri-computer-use resume.

Then check everything at once, with the same full path:

~/.local/bin/niri-computer-use status --check

Each line is a prerequisite with ✓ or ✗ and, under each ✗, how to fix it. The stop key line turns ✓ once niri has loaded your bind and the program it names is there; it says can't tell when niri refused the config, the server couldn’t read it, or the bind runs the program in a form the server doesn’t read, such as through systemd-run. The command exits 1 while something blocks the server.

See Safety for what a stop does and doesn’t undo.

Start your agent and ask it something that only needs looking, for example:

Use the niri-computer-use tools: call status, then tell me which windows are open on my focused workspace.

The agent calls status, then desktop_state. Neither needs the lease, and neither changes anything. Ask about something on screen, and it takes a screenshot, then a region screenshot if the text is small.

Ask for something that changes the desktop:

Focus my browser window, then put focus back where it was.

The agent calls acquire_desktop, which notes the window you were on, then focus, then release_desktop with restore_focus: true. Each action’s result says whether niri accepted it and what niri saw happen.

If acquire_desktop fails, its error says why; the error reference says what to do. The most common first-run refusal is screen_locked while the screen is unlocked; see Troubleshooting.

By default the agent can focus, close and type into windows you open, but not start new ones. The easy start is to let launch take your installed apps by their desktop entry id, such as org.gnome.Nautilus or firefox. Put this line in ~/.config/niri-computer-use/policy.toml, creating the file if needed, and restart the agent’s session:

launch_desktop_entries = true

The server then starts an app’s own Exec line, the command its menu entry runs, without a shell, under the same rules as presets. It takes only apps installed for the whole system, such as those under /usr/share; an app installed in your home directory, as flatpak install --user does, needs a preset. See launch_desktop_entries for what it refuses.

To allow only a few apps, list them as presets instead. unrestricted, or NIRI_COMPUTER_USE_UNRESTRICTED=1 in a client’s server settings, goes further: that client’s agent can then start any program through niri_action’s Spawn.

niri-computer-use 0.2.02026-11-26FIRST-SESSION(7)

SUMMARY OF LESS COMMANDS

The keys this site takes from less. They do nothing while you type in a field, or with Ctrl, Alt or Super held.

Keys and what they do
j eForward one line.
k yBackward one line.
f SPACEForward one window.
bBackward one window.
d uForward or backward half a window.
g <Go to the first line.
G >Go to the last line.
/Search the docs.
?Show this help.
qClose this help, or go back a page.

HELP -- Press q when done