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:
fluxlay.yaml
shell:
hostname:
run: hostname
reason: Displays the computer name.
required:
- hostnameDisplay in a Terminal
Use useShell with useTerminal for styled terminal output:
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:
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:
fluxlay.yaml
network:
- origin: https://api.example.com
reason: Fetches data for display.See the useShell Reference and Manifest Reference for full details.