# Run Shell Commands

Fluxlay wallpapers can execute shell commands declared in `fluxlay.yaml` and display their output.

## Declare Commands

First, add commands to `fluxlay.yaml`:

```yaml title="fluxlay.yaml"
shell:
  hostname:
    run: hostname
    reason: Displays the computer name.
    required:
      - hostname
```

## Display in a Terminal

Use `useShell` with `useTerminal` for styled terminal output:

```tsx
import { useTerminal, useShell, TerminalThemes } from "@fluxlay/react";

function Monitor() {
  const { terminalRef, instance } = useTerminal({
    theme: TerminalThemes.nord
  });

  useShell("hostname", {
    terminal: instance,
    refreshInterval: 10000
  });

  return <div ref={terminalRef} style={{ height: "100%", width: "100%" }} />;
}
```

## Display as Text

Use `runShell` for raw text output:

```tsx
import { useEffect, useState } from "react";
import { runShell } from "@fluxlay/react";

function Hostname() {
  const [name, setName] = useState("");

  useEffect(() => {
    runShell("hostname").then(result => {
      if (result.success) setName(result.stdout.trim());
    });
  }, []);

  return <p>{name}</p>;
}
```

## Network Access

If a command needs network access, declare it in the `network` section:

```yaml title="fluxlay.yaml"
network:
  - origin: https://api.example.com
    reason: Fetches data for display.
```

See the [useShell Reference](/en/studio/developer/reference/sdk/use-shell.md) and [Manifest Reference](/en/studio/developer/reference/cli/manifest.md) for full details.
