// The polychromatic module's Go tools bundle (novox/hq ADR 0188, ADR 0193, ADR 0208): the Razer // peripherals' tray in the operator's session, served by the node's runtime as the operator account. // The module holds no seat, so every tool is its own. The driver and the daemon the tray drives are // the openrazer module's tools. package main import ( "fmt" "os" stdio "git.novox.be/novox/mesh-sdk/go" ) func main() { if err := stdio.Serve("", tools()); err != nil { fmt.Fprintln(os.Stderr, err) os.Exit(1) } } var machine = NewMachine() func tools() []stdio.Tool { return []stdio.Tool{ { Name: "polychromatic_status", Description: "The Razer peripherals' tray: whether it runs (pid, since, and the unit or session " + "scope it runs in), the installed version and whether it came from outside the official " + "repositories, what starts it at login, the package's login helper and the application's own " + "tray setting, and whether the openrazer daemon behind it answers, with how many devices. " + "Never starts the tray or the daemon. (r)", Run: func(map[string]any) (any, error) { return machine.Status() }, }, { Name: "polychromatic_restart", Description: "End the tray (asked first, then forced after 5 s) and start it again in the operator's " + "desktop session, under the account's service manager. Answers the pids ended and the new one. " + "Needs someone logged in to the desktop. (a)", Run: func(map[string]any) (any, error) { return machine.Restart() }, }, { Name: "polychromatic_check", Description: "Check what the module promises and relies on: the package is installed (by hand: it is " + "outside the official repositories); the tray has exactly one start (the module's line in the " + "window manager's configuration; the package's login helper must not start it too); it runs " + "once in a desktop session; and the openrazer daemon answers. Answers ok and each finding with " + "what to do. (r)", Run: func(map[string]any) (any, error) { return machine.Check() }, }, } }