Expand description
The Mochi protocol: messages exchanged over the daemon’s Unix socket.
Every message is one JSON object on one line. Clients send a
ClientMessage, the daemon sends a DaemonMessage. Each object has a
type field naming the variant in snake_case. docs/protocol.md describes
the conversation in full.
The protocol only grows: new message types and new fields with defaults.
Removing or renaming anything means a new API version.
Modules§
- plugin
- The conversation between mochid and a plugin backend.
- spec
- What modules hand the daemon: activities for the island, bubbles, and the parsed arguments of their actions. Builtin modules use these types directly; plugin backends send them as JSON, so they serialize too.
- version
- Mochi’s version, and the oldest one a theme, bento or plugin says it works with.
Structs§
- Action
Spec - Activity
- The activity the island shows.
- Activity
Id - Identifies one activity for its whole life, across the daemon and the UI.
- Area
Arrangement - An area that doesn’t lay its bubbles apart.
- ArgSpec
- Bubble
- A bubble as the UI draws it. Snapshots list bubbles in drawing order:
area by area, each from left to right. Consecutive bubbles with the same
groupshare one pill. - Bubble
Id - Identifies one bubble for its whole life, across the daemon and the UI.
- Click
- A click outside the island, where it happened, to pass on.
- Color
- A color in the form QML accepts:
#rrggbbor#aarrggbb. - Color
Error - Colors
- Color roles. The defaults are “Obsidian”: a black island that blends into the bezel, graphite layers on it, and one accent used sparingly.
- Compositor
Status - What the daemon knows about the compositor.
- Contribution
- One thing a module offers another.
- Layout
- Where the island sits and what shape it takes. Sizes in logical pixels.
- Module
Actions - Motion
- Animation constants. The spring values feed QML’s
SpringAnimation. - Notch
- Settings for notch and bar modes.
- Overflow
- How many bubbles an area has beyond its maximum.
- Plugin
Status - One plugin from plugins.toml, as the daemon sees it.
- Scroll
- A wheel or touchpad scroll, as Qt reports it.
- Stacking
- How stacked areas behave, when any area stacks.
- Status
- Text
- The type scale, in pixels: four sizes and one for big numbers. An empty
familyuses Inter, which Mochi’s packages bring, or the system font without it; an emptydisplay_familykeepsfamily. - Theme
Enums§
- Anchor
- The screen edge everything sits against.
- Appearance
- Which of a preset’s palettes to use.
- Area
- One of the five places along the edge, from left to right. The island sits in one of them too.
- ArgKind
- Arrangement
- How an area draws its bubbles:
[bubbles] left = "merged". - Client
Message - Sent to the daemon.
- Daemon
Message - Sent by the daemon.
- Error
Code - Event
Kind - Mode
- Plugin
State - Role
- Who is on the other end of a connection. It decides which messages the daemon accepts from it.
Constants§
- API
- The protocol version both sides announce in
hello. - MAX_
LINE - The longest line a reader should accept, in bytes. Anything longer is a broken or hostile peer.
- RENAMED_
MODULES - Module ids that changed, old first. The old id still works in
config.toml, in commands and in plugin manifests, with a warning. - SOCKET_
ENV - Overrides where clients look for the daemon’s socket. The daemon also sets it for the Quickshell process it starts.
Functions§
- decode
- Parses one line, with or without its trailing newline.
- encode
- Serializes a message as one line, including the trailing newline.
- module_
id - The current id of a module, for one named by its old id.
- socket_
path $MOCHI_SOCKET, or else$XDG_RUNTIME_DIR/mochi/mochi.sock.