Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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 implicitWidth and implicitHeight, 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.surface for a card, Theme.textBody for text, Theme.move for movement. A change to theme.toml then 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’s live(module, value) signal rather than the published state, from ModuleCtx::publish_live. Listen with Connections { 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

RoleFor
backgroundthe island and the control center panel
surfacecards and tiles
raisedcontrols, tracks and dividers on those
highlighthovered controls
foreground, mutedmain and secondary text and icons
accent, onAccentwhat is active or important, and text on it
danger, successdestructive actions, good news
border, shadowthe 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:

ScaleTokensFor
TexttextCaption (11), textBody (13), textTitle (15), textHeadline (20), textDisplay (42)labels and fine print; everything else; card, track and section titles; page titles; big numbers
WeightweightBody, weightLabel, weightTitlerunning text; labels; titles
SpacingspaceTiny (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
CornersradiusSurface, radiusField, radiusControl, or height / 2 for round endscards, tiles and panels; rows, fields and buttons; chips, badges and icon buttons
HeightcontrolHeight (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

ControlWhat it isMain properties
Symbolan icon: Mochi’s name or any Material Symbols name, else the icon themename, size, color, filled
Buttona pill button; round with only an icontext, icon, tone (neutral, accent, danger, ghost), clicked()
IconButtona round icon button sized from its iconicon, size, tone, clicked()
ActionButtona Button the keyboard reaches with Tab and presses with Enter or Space, with a focus ringtext, icon, tone, clicked()
Slidera value from 0 to 1; thick with an icon, or thin as a seek barvalue, 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)
ProgressBarhow far along, not interactivevalue, fill
Switchon or offchecked, toggled(checked)
Segmentedone choice out of a few; with keyboard, Tab reaches it and Left and Right pickoptions ([{value, label, icon}]), current, keyboard, picked(value)
Tilea control-center tile, vertical for actions, horizontal for togglesicon, title, subtitle, checked, tone, vertical, clicked()
ListRowa row with something at the start and controls at the endicon or image or leading, title, subtitle (subtitleFormat: Text.StyledText for markup, with linkActivated(link)), trailing, selected, flat, marker, clicked()
Badgea count in an accent circlecount
SectionLabelthe label above a group of controlstext
PanelHeaderthe top of a page or panel: a back button, an icon, the title, and items put inside on the righttitle, back, icon, iconColor, backClicked()
SwitchRowa setting that is on or off, as a row whose click flips iticon, title, subtitle, checked, toggled(checked)
SliderRowa level on a tile: an icon to click, a thin slider, the percentage and a chevronicon, value, maximum (the percentage at 1), reset, level, opens, moved(value), released(value), iconClicked(), opened()
RollingTexttext whose digits roll when they change, for clocks, percentages and timerstext, pixelSize, weight, family, color, animated
ScrollFadefading edges on a list where more scrolls past them; put it inside the listview, horizontal, color
EdgeLighta light along the top edge of a panel or tile: faint, toward the pointer on hover, sweeping while working, and flash() when something finishesradius, working, color, flash()
WavyProgresshow 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 offvalue, playing, wavy, interactive, thickness, fill, trackColor, moved(value), released(value)
WavyRinghow full, as a ring filling clockwise from the top, wavy or flat, with what’s put inside in its middlevalue, size, thickness, wavy, waves, color, trackColor
ExpressiveShapea 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 belowshape, 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)
StackedTimea big clock’s hour above its minutes in the display font, sized from the box, with a line under them; the digits rollhours, minutes, date, color, dateColor, weight, horizontalAlignment, pixelSize (read-only)
ClockTimethe 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 takespayload, zone, seconds, ticking, now, parts, known, unknown, city, half, hour(twelve), time(twelve, seconds), date(short)
ZonePickerpicks 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.jszones, chosen, suggested, titles, most, custom, searchField, query, limit, color, fieldColor, picked(value), closed(), focusSearch(), type(text), clear()
Credita 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:

shapeWhat it isRoom inside
circlea circle0.7 of the side
pentagona pentagon with round corners, a point up0.6 by 0.52
cookiesoft lobes all around, 9 by default (lobes)0.66
cloverfour round lobes0.56
burstsoft points all around, 12 by default (lobes)0.6
hexagona hexagon with round corners, a flat side up0.72 by 0.6
octagonan octagon with round corners, a flat side up0.74
squirclea square with soft sides, between a square and a circle0.8
pilla wide pill with round endsthe 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.