Expand description
The closed UI vocabulary widgets build their views from.
Every node is semantic: it says what something is (a label, a heading, a button), never how it looks. The host maps nodes to pixels using its theme, so every plugin gets the same style, and the same animations, without being able to break them.
Structs§
- Action
- Something the widget can do, from
Widget::actions, for the dormer: the host’s search dialog. Typing finds it by its title, subtitle and keywords, and picking it sendsmessageto the widget. - Choices
- Options to pick from on a
Notice, like the answers to a question: one, which a click sends, or several, checked and then sent together. - Item
- What a widget shows in the bar.
- Node
- A piece of UI. Build it with the functions in this module.
- Notice
- A notification to show on screen, from
Widget::notices. - Panel
- The contents of a popover. The host draws the surface, its background and its edges, and lays
every popover out at the same width, or at a wider one if it asks (
Panel::wide). - Pixels
- A picture as its pixels, for a
Noticewhose picture came as bytes rather than a file: RGBA, 8 bits a channel, row after row with nothing between them. - Reply
- A field on a
Noticeto type an answer into, like a reply to a message: several lines, Enter sends and Shift+Enter starts a new line. - Shortcut
- A key, with the modifiers held for it:
Ctrl+K. Build it withshortcut.
Enums§
- Change
- What a line of a
diffis. - Icon
- A status symbol. It names what to show and how full it is; the host draws it in the text’s tone, at the text’s size. Fractions are 0.0 to 1.0.
- Key
- A key a
Shortcutnames. There is no Escape: it always closes the popover (D-41). - Mark
- Where a
stepof atimelinestands. The host draws it as the step’s mark on the line. - Tone
- The role of a piece of text. The theme decides the color.
- Urgency
- How much a
Noticematters. The host decides what that looks like.
Functions§
- action
- An action titled
titlethat sendsmessagewhen picked. - alternate
- One of
optionsat a time: the one atcurrent, or the last one if it’s past the end. It’s as big as the biggest option, so it doesn’t change size whencurrentdoes. The host fades from one to the other. Keep the options the same from one view to the next, so the host can tell which one is coming in. - app_
icon - An application’s icon, found by its app id or window class (
firefox,org.gnome.Nautilus) in the user’s icon theme. Sized like anicon, in the app’s own colors: a tone only dims it. Until the host has found it, or if there is none, it shows the id’s first letter. - badge
- A short code in a small outlined box: a keyboard layout’s
US. - button
- center
contentcentered across the panel’s width: a cover, a title, a row of controls. Text in it stays on one line, cut and faded at the edges of its room if it’s too long. In the bar, it’s justcontent.- column
- Children stacked top to bottom.
- counted
- Its content with
countin a red badge at its top right, overlapping it a little: unread notifications on a bell. At 0 there’s no badge. The host grows the badge in and out and counts through the numbers in between; past 99 it shows 99. - counter
- A number from
range, with a unit after it ("%","°", or""), shown like a label. It keeps room for the widest number inrange, so it doesn’t change width as it changes. Whenvaluechanges, the host counts to it through every number in between. - cover
- A picture a program hands over at runtime, by URL: a track’s cover art.
file://andhttps://URLs load; the host fetches, crops it square and rounds it, off the UI thread, and keeps the few latest. Drawn at icon size, or big withNode::large. Until it’s there, or if it can’t be loaded,fallbackshows in its place. A tone only dims it. - detail
- A named value on one line: the name dimmed at the start, the value at the end.
- diff
- A change to a file, titled with its name: lines added, removed, and some unchanged ones around them. The host counts what was added and removed.
- display
- Its text, large: the one number a popover is about, like a battery’s charge.
- divider
- A
separatorwith a short caption in the middle of it, like the time between two turns of a conversation. - empty
- Takes up a grid cell, or nothing elsewhere.
- expand
collapsed, orexpandedonce the pointer rests on this node, fading between them like ahover. Unlikehover, it’s only as big as what it shows, so the item grows to make room and the island springs along, and it reacts to the pointer over it, not the whole item: a workspace that shows every window when you point at it.- fill
- Takes the free space in a popover row, pushing what follows to the end. Nothing in the bar.
- grid
- Cells laid out left to right in rows of
columns, all the same width. A calendar, a keypad. - gulp
- Keeps gulping, like a bottle being poured: the host swells
contentgently and steadily for as long as it’s on screen. For something filling up, like a charging battery’s percent. - header
- The title of a popover page. Sub-pages get a back button with
on_back; aleadingpicture goes before the title, asubtitleunder it (where it is, what it’s about), and atrailingnode sits at the far end (a switch, a count). - heading
- A title, larger than a label. Meant for popovers.
- hover
normal, orhoveredwhile the pointer is over the item, fading between them like analternate: an icon that shows its percent, a time that shows the date.- icon
- A symbol, sized like a label.
- image
- An icon the plugin ships: an SVG or PNG file compiled into it with
include_bytes!, told apart by its first bytes. Sized like anicon, in the file’s own colors: a tone only dims it, as withapp_icon. The host draws it once, off the UI thread, and shows nothing in its place until then. - keys
- A shortcut drawn as keycaps,
[Ctrl] [K], to say which key does something. It only shows the keys; to bind one, give alist_itemashortcut. - label
- list
- Rows stacked closely, usually
list_items. In a popover, a long list scrolls instead of growing past a few rows. - list_
item - A row in a popover list: a network, a device, a window. Give it a
subtitle, aleadingicon, atrailingnode at the far end (a lock, an info button), mark the one in use withselected, and make it clickable withon_press. Ashortcutpresses it from the keyboard. A long title fades out at the end rather than wrapping. - literal
- Text exactly as typed, not prose: a path, a command, a name in code. It doesn’t wrap: when it doesn’t fit, its end fades out.
- mark
- Its content marked with a ring: today in a calendar.
- markdown
- Text written in Markdown, as people and programs write messages: paragraphs, emphasis,
code, lists, quotes, headings, code blocks and tables. The host sets it in its own type and colors, wrapped to the width it has. Links show as links but don’t open: the bar starts no programs. - meter
- A bar filled to
fraction(0.0 to 1.0), in its tone: a charge, a signal. The host eases it to a new value. - row
- Children side by side, vertically centered.
- scroll
- Its content, scrolling in a popover once it’s taller than the host allows a page to grow: a
conversation, a long document. With
Node::bottomit keeps its end in view. In the bar it’s just its content. - section
- A small caption over a group in a popover (“Output”, “Health”), with an optional
trailingnode at the far end. - separator
- A thin horizontal line between groups.
- shortcut
- A key to press, for a
list_item’s or abutton’sshortcut, or to show withkeys:shortcut('1'),shortcut('k').ctrl(). - slider
- A value dragged along
range: a volume. Sendson_changewhile dragging; addon_releaseto act once it’s let go, andstepto snap. - sprite
- A little animation the plugin ships, like a pixel-art mascot:
framesare PNG or SVG files compiled in withinclude_bytes!, all the same size, andorderlists which frame shows when, by index intoframes. The host keeps the frames’ shape and picks the height (a little under a label’s in the bar, taller in a popover), scaling pixels up whole, never blurred: ship pixel art at its own size. The host shows a frame for a quarter of a second. It plays the loop a couple of times when it shows up or changes, then rests on the first frame oforder;Node::loopingkeeps it going. A tone only dims it. - step
- One step of a
timeline:content, marked on the line asmark. Aleadingnode, like a small picture, stands on the line in place of the mark. Outside a timeline it’s just its content. - switcher
- A row of choices, one of them current: workspaces, output devices. Each option sends its
message when clicked. The host marks the current option and moves the mark smoothly when
currentchanges. - symbol
- Like
image, but only the file’s shape counts: it’s drawn in the text’s tone, like anicon. For a monochrome symbol the vocabulary doesn’t have. - tabs
- Pages behind a row of tabs, one page showing at a time: a popover’s Output, Input and Apps. The host draws the tabs, switches pages when one is clicked and starts on the first each time the popover opens, so the plugin keeps no state for it. In the bar, only the first page shows.
- text_
area - A field to type several lines into, showing
value: a message. It grows with its text up to a few lines, then scrolls. Sendson_inputwith the new text on every change, andon_submiton Enter; Shift+Enter starts a new line. In a popover it takes the focus when it appears, like atext_input. One per popover page. - text_
input - A field to type into, showing
value. Sendson_inputwith the new text on every change. It takes the focus when it appears, and while it has it, keys stay in the popover; Esc still closes it.on_submitis sent on Enter. One per popover page. ATone::Criticaltone marks it as wrong. - timeline
- Steps one after another, strung on a line: what someone did, in order. Each child is a
step, whose mark says where it stands; other nodes count as steps markedMark::Note. - toggle
- An on/off switch. Sends
on_togglewhen clicked; the host slides it over.