Writing views
A module’s views are QML files in its qml/ directory. They import the core library with import qs.island, which has the theme, the built-in controls and the connection to the daemon.
Conventions
- Every view declares
property var payload. Island views get their activity’s payload; control center cards and pages get their module’s published state. - Island views size themselves with
implicitWidthandimplicitHeight, and the island follows. Control center cards and pages fill the space the control center gives them. - Colors, sizes and timings come from
Theme, never from literals:Theme.surfacefor a card,Theme.textBodyfor text,Theme.movefor movement. A change totheme.tomlthen restyles every module. - Actions go through
Daemon.command(module, action, args); arguments are strings. - Values that change many times a second, like the audio meters’ levels, come through
Daemon’slive(module, value)signal rather than the published state, fromModuleCtx::publish_live. Listen withConnections { target: Daemon }. Nothing keeps them: a view sees only those sent while it’s open.
Motion that only decorates
An animation that runs on its own, like bars bouncing to music or a wave drifting, draws a frame for every one of the monitor’s: 144 a second on a 144 Hz monitor, and two windows’ worth on two monitors, even hidden behind a fullscreen game. Drive it with a Ticker instead, which moves on 30 times a second, together with every other one, and run it only while the view can be seen:
import Quickshell
import qs.island
Ticker {
id: ticker
running: root.playing && root.visible && Daemon.shows(root.QsWindow.window) && !Theme.reducedMotion
}
// ticker.now, in milliseconds, holds still while it's stopped.
readonly property real swing: 0.5 - 0.5 * Math.cos(ticker.now % 900 / 900 * 2 * Math.PI)
Daemon.shows(window) is false while the window is hidden or a fullscreen window covers its monitor. A short animation that answers something the user did, like a panel opening, can stay an Animation. A view whose size changes on every update makes the island move each time, so keep rows that come and go at a fixed height. Profiling shows how many frames each window draws.
When a view doesn’t load
A view with a QML error, or a missing file, logs the error in mochid’s log as a quickshell warning, with the file and line, and the island keeps what it showed. When the view is a plugin’s override of a builtin view, the island and the bubbles load the builtin view instead and log could not load root:/modules/<module>/<view>.qml, trying root:/builtin/<module>/<view>.qml. The daemon keeps each overridden module’s own files in builtin/<module>/ in the shell tree for this.
Overlays
An activity can bring an overlay: ActivitySpec::overlay("Overlay") draws qml/Overlay.qml over every monitor, under the island and the bubbles, while the activity shows. It’s for picking something on screen, like the capture module’s region. The overlay gets the activity’s payload and a screen property with its monitor, and takes the clicks. Every monitor’s overlay asks for the keyboard, since Hyprland only sends the pointer to surfaces that hold it; the compositor gives it to one of them, so handle keys in each. If it declares property bool ready, the island waits for it to turn true before it changes, so an overlay can freeze the screen first.
Virtual screens
A module can make a monitor of its own through the compositor, named MOCHI-<MODULE>, like the share module’s MOCHI-SHARE. The shell gives it no island or bubbles; it shows the module’s qml/Screen.qml over the whole monitor instead, with the module’s published state as payload, and takes no clicks. Daemon.screens lists the real monitors only, and Daemon.virtualScreens the others; use Daemon.screens wherever you list monitors for the user.
Theme roles
| Role | For |
|---|---|
background | the island and the control center panel |
surface | cards and tiles |
raised | controls, tracks and dividers on those |
highlight | hovered controls |
foreground, muted | main and secondary text and icons |
accent, onAccent | what is active or important, and text on it |
danger, success | destructive actions, good news |
border, shadow | the hairline around the island and bubbles, and the shadow under them; the core draws both |
Theme scales
Views take every size from Theme’s scales, so modules and plugins look like one design:
| Scale | Tokens | For |
|---|---|---|
| Text | textCaption (11), textBody (13), textTitle (15), textHeadline (20), textDisplay (42) | labels and fine print; everything else; card, track and section titles; page titles; big numbers |
| Weight | weightBody, weightLabel, weightTitle | running text; labels; titles |
| Spacing | spaceTiny (4), spaceSmall (8), spaceMedium (12), spaceLarge (16), spaceHuge (24) | inside a group of small things; between an icon and its text or items in a row; between groups; around a card’s content; between sections |
| Corners | radiusSurface, radiusField, radiusControl, or height / 2 for round ends | cards, tiles and panels; rows, fields and buttons; chips, badges and icon buttons |
| Height | controlHeight (32), rowHeight (44), tileHeight (96) | a button, chip or field; a row in a list; a row of the control center’s grid |
Fonts are fontFamily and displayFamily, for clocks: Inter, which Mochi’s packages bring, unless theme.toml names another. Motion: fast for colors and hovers, move with the overshoot curve for things that move. The text sizes and corners follow theme.toml; the rest are fixed. textLabel and textSubtitle, from before the scale, still give textCaption and textBody for now.
A test in mochi-core (tests/design.rs) reads every view and rejects new raw sizes, spacing, corners, margins and colors. A line that needs one anyway says why in a // design: comment, like a badge’s 9 pixel count that has to fit in its dot.
Controls
| Control | What it is | Main properties |
|---|---|---|
Symbol | an icon: Mochi’s name or any Material Symbols name, else the icon theme | name, size, color, filled |
Button | a pill button; round with only an icon | text, icon, tone (neutral, accent, danger, ghost), clicked() |
IconButton | a round icon button sized from its icon | icon, size, tone, clicked() |
ActionButton | a Button the keyboard reaches with Tab and presses with Enter or Space, with a focus ring | text, icon, tone, clicked() |
Slider | a value from 0 to 1; thick with an icon, or thin as a seek bar | value, icon, thickness, reset (where a double click puts it), level (a sound’s level, drawn in the fill like a meter; off below 0), moved(value), released(value) |
ProgressBar | how far along, not interactive | value, fill |
Switch | on or off | checked, toggled(checked) |
Segmented | one choice out of a few; with keyboard, Tab reaches it and Left and Right pick | options ([{value, label, icon}]), current, keyboard, picked(value) |
Tile | a control-center tile, vertical for actions, horizontal for toggles | icon, title, subtitle, checked, tone, vertical, clicked() |
ListRow | a row with something at the start and controls at the end | icon or image or leading, title, subtitle (subtitleFormat: Text.StyledText for markup, with linkActivated(link)), trailing, selected, flat, marker, clicked() |
Badge | a count in an accent circle | count |
SectionLabel | the label above a group of controls | text |
PanelHeader | the top of a page or panel: a back button, an icon, the title, and items put inside on the right | title, back, icon, iconColor, backClicked() |
SwitchRow | a setting that is on or off, as a row whose click flips it | icon, title, subtitle, checked, toggled(checked) |
SliderRow | a level on a tile: an icon to click, a thin slider, the percentage and a chevron | icon, value, maximum (the percentage at 1), reset, level, opens, moved(value), released(value), iconClicked(), opened() |
RollingText | text whose digits roll when they change, for clocks, percentages and timers | text, pixelSize, weight, family, color, animated |
ScrollFade | fading edges on a list where more scrolls past them; put it inside the list | view, horizontal, color |
EdgeLight | a light along the top edge of a panel or tile: faint, toward the pointer on hover, sweeping while working, and flash() when something finishes | radius, working, color, flash() |
WavyProgress | how far along, as a line that waves and drifts forward while playing and lies flat when it stops, like a track’s progress, or stays flat with wavy off; seeks like a thin Slider, or only shows with interactive off | value, playing, wavy, interactive, thickness, fill, trackColor, moved(value), released(value) |
WavyRing | how full, as a ring filling clockwise from the top, wavy or flat, with what’s put inside in its middle | value, size, thickness, wavy, waves, color, trackColor |
ExpressiveShape | a filled shape behind one thing a widget sets apart, like today’s date or a clock, with what’s put inside on top. See the shapes below | shape, size, color, lobes (a cookie’s lobes or a burst’s points), angle (turns the shape, not what’s inside), roomWidth and roomHeight (read-only: the box in its middle where what’s inside fits) |
StackedTime | a big clock’s hour above its minutes in the display font, sized from the box, with a line under them; the digits roll | hours, minutes, date, color, dateColor, weight, horizontalAlignment, pixelSize (read-only) |
ClockTime | the time now in parts, here or in a time zone, for clocks; not drawn. A module reads zones’ offsets with mochi_core::zones and publishes them as zones and unknownZones, which payload takes | payload, zone, seconds, ticking, now, parts, known, unknown, city, half, hour(twelve), time(twelve, seconds), date(short) |
ZonePicker | picks time zones: a search field, then the zones that match, each as “Tokyo, Asia” with “UTC+9 · Japan” under it, the chosen ones checked; before a search, the chosen ones, then suggested, then every zone west to east. Up, Down and Enter move and pick, Escape says closed. zones is what a module publishes from mochi_core::zones::system with Zone::choice; publish it only while the picker shows, since there are a few hundred. Without searchField, the owner’s field sets query and passes keys on with move(step) and accept(). The search itself is Zones.js | zones, chosen, suggested, titles, most, custom, searchField, query, limit, color, fieldColor, picked(value), closed(), focusSearch(), type(text), clear() |
Credit | a credit for the bottom of a module’s settings page: “This module is inspired by the work of” its author, and an underlined See repo that opens link through the settings module’s open-link. Offer it as a section to settings with options.place = "bottom" | author, link |
Controls report what the user did and leave the state to the owner: a Switch sends toggled, and the view sets checked once the module confirms. mochi ipc demo controls shows them all.
WavyProgress, WavyRing and ExpressiveShape are accents. A widget uses one of them, on the thing it sets apart, like the playing track’s progress or today’s date, and draws the rest plainly. The theme’s waves = false in [motion] keeps both wavy pieces flat, whatever their wavy says, so a plugin needs no setting of its own for it.
ExpressiveShape fills the largest square in its box, except the pill, which takes the box’s width and up to 0.62 of it in height. Its shapes:
shape | What it is | Room inside |
|---|---|---|
circle | a circle | 0.7 of the side |
pentagon | a pentagon with round corners, a point up | 0.6 by 0.52 |
cookie | soft lobes all around, 9 by default (lobes) | 0.66 |
clover | four round lobes | 0.56 |
burst | soft points all around, 12 by default (lobes) | 0.6 |
hexagon | a hexagon with round corners, a flat side up | 0.72 by 0.6 |
octagon | an octagon with round corners, a flat side up | 0.74 |
squircle | a square with soft sides, between a square and a circle | 0.8 |
pill | a wide pill with round ends | the width less 0.4 of the height, by 0.72 of the height |
A view sizes what goes inside from roomWidth and roomHeight rather than from the side, so the same text fits whichever shape a setting picks. The clock widget and the clock panel’s Today tab let users pick the shape, or none. mochi ipc demo controls shows every shape.
Icons come from Material Symbols Rounded, which Mochi’s packages bring. Symbol takes Mochi’s names: home, bell, music, clock, grid, moon, search, play, pause, next, previous, note, volume, volume-0 to volume-3, volume-muted, mic, mic-muted, headset, speakers, display, caps-lock, num-lock, keyboard, wifi, wifi-1, wifi-2, wifi-off, ethernet, offline, airplane, bluetooth, power, lock, logout, reboot, snow, chip, memory, gpu, disk, temperature, leaf, bolt, scale, camera, video, record, stop, region, window, copy, clipboard, palette, edit, pin, trash, folder, close, check, chevron, plus, minus, tray, dot. It also takes any Material Symbols name, like timer or wb_sunny. Without the font, Mochi’s names are drawn instead. Any other name, like an app’s, is looked up in the icon theme. filled fills the outlined ones, for an active state.