x1cp API

x1cp API

o7 to Bryce and all it may concern =)

I hope the Z2 storm ebbed away a bit by now? So i dare to write a dedicated proposal to something i already addressed on side-notes in the past.

The x1cp is by far the most versatile and powerful tool for HID configuration i've seen over the past 30 years. With the linux client running pretty solid for quite a while now and with Bryce's investment keeping it up to date, it doesn't look like Swiftpoint's going to lose this pole position any time soon. Where Wooting leads on keyboards, you guys lead on mice. Kudos and congrats are in order!

But, one little thing's been missing for too long now: a basic API.

This wouldn't only benefit penguins like me (to the oblivious: those running linux), but all other OS applications too. Just think of things like Game Glass and derivatives. If the x1cp would provide a socket or CLI based interface to switch profiles, free developers could provide tools to switch entire input groups using a single command or button press. There's also a few applications and games that provide APIs too, meaning in-app or in-game actions could trigger profile switches, removing the need to program multiple switch actions on different HIDs.

But i admit the above is looking for arguments that benefit everyone, just to strengthen my own agenda. In my case i'm most interested in writing a daemon that subscribes to the IPC socket of Hyperland (a Wayland window manager) and interprets triggered events to perform tasks like profile switching on my input devices. For those interested, check this resource: https://wiki.hyprland.org/IPC/

Background to this being that yes, we got the ForegroundDetector, which does a pretty decent job on X11 based window managers, but on Wayland it's rather oblivious to what's going on and i don't see any chance that there will be one common standard across all display protocols and operating systems any time soon, which Bryce could implement into the x1cp so that foreground detection can work in every environment.

A basic API would solve all of this and extend possibilities vastly.

Start with the most simple task: profile switching. Later it could be extended to set LED color, trigger haptic feedback, or send something to the OLED display. Btw: i may hate the "rumble effect" in games, but for those who love it, such an API extension would mean it's just one virtual driver away from being enabled on the Z*.

So there's not only a solution for penguins, where Wayland slowly takes over Xorg, loosing a few bits and pieces here and there (like exposing every window to everything else), but also a great potential for features we haven't even thought of yet.

But the best part is that x1cp would not need to adapt to hundreds of environments. It could just provide the interface to the communities of those environments, enabling them to build their own solutions. If you give me a CLI/API i can give you a solution for reliably switching profiles on Hyprland. Also that wouldn't be limited to switching profiles on foreground/window change, but even on switching workplaces or anything else the Hyprland IPC offers (see link above). Different profiles for fullscreen mode, floating or tiled windows or haptic feedback on notifications, alerts ("urgent" state).

Even things like a profile for the lock screen or on TTY would be possible (as long as the x1cp is running in the background somewhere - or if there'd be a daemon running without UI, but i'm not sure if that can even be separated easily).

If anyone read to this point: yeah, it's a long text and may look like a lot of work, but assuming there's already methods in the code to trigger profile changes, exposing an interface and listen to commands being sent should be more than achievable. Also most of the work could be done by us, the community, extending functionality beyond what's possible on x1cp's side. Think of Skyrim's modding community, keeping that ancient game alive for over a decade.

Thanks for reading and consideration =)