Files
mesh-catalog/modules/openrazer/cmd/openrazer-tools/main.go
T
jochen d0d5546088 Give the remaining tray applets their modules, each with one start
openrazer (the official driver, daemon and library), polychromatic (the
AUR tray, kept as found; its i3 line moves out of the i3 module into its
own node-display-session contribution), forticlient (the AUR VPN client:
its service declared, its configuration never read) and nm-applet (the
desktop half of NetworkManager, apart from the server-side module).

The openrazer daemon fails on both workstations because the account is
not in the openrazer group; openrazer_check names it and the README
carries the one-off step, since the account's user resource is zsh's.

desktop.go learns to tell a program from another sharing its 15-character
command name, so polychromatic's tools never count or end themselves, and
a copies test holds the six carriers to one text.
2026-10-05 15:10:30 +02:00

51 lines
1.9 KiB
Go

// The openrazer module's Go tools bundle (novox/hq ADR 0188, ADR 0193, ADR 0208): the Razer
// peripherals' kernel driver and the account's daemon that speaks to it, served by the node's runtime
// as the operator account. The module holds no seat, so every tool is its own. The tray that drives
// the daemon is the polychromatic module's.
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: "openrazer_status",
Description: "The Razer stack: the installed versions, the driver (built by DKMS for the running " +
"kernel or not, its kernel modules loaded, the devices bound to it), the account's openrazer " +
"group (in the group file, and in its running service manager), the daemon (its unit's state, " +
"its process, its version) and each device the daemon sees: name, type, firmware, battery. " +
"Asks the daemon without starting it. (r)",
Run: func(map[string]any) (any, error) { return machine.Status() },
},
{
Name: "openrazer_restart",
Description: "Restart the daemon through its unit in the account's service manager (the unit D-Bus " +
"activation starts), and answer its state and the devices it then sees. Needs the account " +
"logged in. (a)",
Run: func(map[string]any) (any, error) { return machine.Restart() },
},
{
Name: "openrazer_check",
Description: "Check what the module promises and relies on: the packages are installed; the driver " +
"is built for the running kernel and loaded; the account is in the openrazer group, and its " +
"service manager has it; the daemon runs once, from its unit, and sees the devices the driver " +
"has. Answers ok and each finding with what to do. (r)",
Run: func(map[string]any) (any, error) { return machine.Check() },
},
}
}