Build panels
Extras
Give a panel a row in the Extras popover: a state line, a progress ring, a countdown Deska keeps running, a round control, and a compact page of its own that stays linked to the panel and can keep playing after Extras closes.
What the row is
Extras is the popover on the canvas that holds Notes, Focus and Music. A panel that declares contributes.extras gets a row there, drawn by Deska like the built-in ones: the package’s icon, its title, one state line and one round control. The panel fills them; Deska draws them, so the row looks native and stays readable whatever the panel sends.
The row is a glance and a remote control. It shows what the panel is doing while its panel sits off screen or in another project, and it plays, pauses, starts or stops without the person going there. The closed Extras button never shows a package’s state, and the person can hide any package’s row with Hide from Extras on its card in Installed.
Declaring it
"sdk": 3,
"contributes": {
"panel": { "entry": "index.html", "scope": "global" },
"extras": { "title": "Net Radio", "view": "extras.html", "keepAlive": true }
}titlenames the row, up to 40 characters, and cannot read as Deska’s own.viewis optional: a page that opens inside the popover when the row is opened. Without it, the popover shows the panel’s entry page.keepAliveis optional and needs"sdk": 3.truelets the Extras page keep running after Extras closes, for as long as the page asks. See Keep playing after Extras closes.sizesis optional and needs"sdk": 5: a list of"compact","regular"and"large". Compact is the row Deska draws. At regular or large, a tile popped out of Extras showsviewinside it, in the same sandbox and with the same bridge as the popover. Withoutsizesthe row stays compact and its tile cannot be resized taller than one row.- Declaring Extras needs no permission. The panel’s page tells people it shows in Extras before they install.
What the row shows
Fill the row with deska.extras.set. Fields you leave out keep their value, null clears one, and anything else refuses the whole call with invalid_args.
| Field | Value | Shows |
|---|---|---|
state | string up to 60 characters, or null | The state line under the title, as untrusted text. |
progress | 0 to 1, or null | A ring around the icon. |
until | milliseconds since 1970, or null | The time left, counted by Deska. |
control | play, pause, start, stop or null | The round button, with that icon. |
What you set stays after every frame of the package closes, so the row keeps saying the last thing the panel knew. Clear what is no longer true.
A countdown that runs without the panel
Send the target time, not a string of minutes. Deska draws the time left from until and keeps counting with no frame of the package alive, so the panel never has to stay open or tick every second to keep the row right.
deska.extras.set({
state: 'Public beta',
until: Date.parse('2026-10-09T17:00:00'),
progress: elapsed / total,
control: null,
})Ship Countdown sends the soonest countdown this way, with the elapsed run up as the ring, and Noise Machine uses until for its sleep timer.
The control
A press on the round button sends extras.control with the control’s name to every open frame of the package, in any of Deska’s windows. Your handler decides what the press means, then sets the next control.
When no frame of the package is open, the press waits for the next one. For a package that declares keepAlive, Deska’s main window starts the Extras page hidden, and the page takes the press once it is ready; it ends unless it asks to keep running within 10 seconds. Otherwise Deska brings the package’s panel forward (or opens one when the project has none) and delivers the press once it is ready.
let sent = ''
function syncExtras(station, playing) {
const fields = {
state: playing ? station.title.slice(0, 60) : 'Stopped',
control: playing ? 'pause' : 'play',
}
const key = JSON.stringify(fields)
if (key === sent) return // nothing changed, no call
sent = key
deska.extras.set(fields).catch((err) => console.warn('extras.set:', err.code))
}
deska.on('extras.control', ({ control }) => {
if (control === 'play') play()
if (control === 'pause') stop()
})- Send only what changed. A page that ticks every second should call
extras.setonly when the row would change; calls count against the frame’s 20 a second. - Every frame hears the press. When the action must happen once (sound from one speaker, one write), agree through storage which frame acts, as Noise Machine does with a short lease, or let only the frame that plays act, as in One player in two places.
- On another computer’s desk, where community panels do not run, a press waits for the package’s next frame on this computer.
The Extras page
Opening the row shows view (or the entry page) inside the popover, sized to it. It is a page of the same package: same SDK, same storage, same permissions. It knows where it is from init.place and deska.place:
const init = await deska.ready()
document.body.dataset.place = init.place // 'panel' or 'extras'- Keep it compact: the popover is narrow. Hide search fields and descriptions, as Net Radio does with one page and a
data-placeattribute. - The page ends when Extras closes or the person goes back from it, unless the package keeps it running (Keep playing after Extras closes). Without that, anything that must keep going (sound, a timer) belongs to the panel on the desk or to
until. - The page and the package’s panels are linked: they hear each other’s storage writes and can send each other messages (One player in two places). Two frames writing the same key still settle on the last write, so read, change and write in one step (Ship Countdown).
- The view’s head holds Open as panel. It brings forward the package’s panel in this project, and opens one only when there is none, so the package never runs twice by accident.
One player in two places
Since SDK 3, the open frames of one package on a computer are linked: its panels (on the desk, in a dock or in a window of their own) and its Extras page, across Deska’s windows. That is how a package shows one player in two places, the way Deska’s own Music does: start it in the panel, and Extras shows the same player, live.
deska.framessays how many other frames of the package are open, as{ panel, extras }, and aframesevent follows every change.deska.send(data)hands any JSON value to every other open frame as amessageevent{ data, from }, wherefromis'panel'or'extras'. It answerstruewhen at least one was open. Nothing is kept: a frame that opens later learns the state from storage.- A frame’s
storage.setandstorage.removereach the other frames as astorageevent{ key, value }, withvaluenullonce removed: at once in the same window, and in under half a second in another one. - The frame that sends or writes does not hear it itself. Nothing crosses to another package or another computer.
Deska never decides which frame plays; your package does. The frame that plays (the panel, when one is open) keeps what it plays in storage and sets the row. Every other frame draws from storage, follows storage events and sends its presses with send. When the player closes, a frame left open sees frames drop and takes over from what storage says. One page used in both places:
// app.js, the same page in the panel and in Extras
const audio = new Audio()
let now = { station: null, playing: false }
// The panel plays when one is open; the Extras page only when it is alone
function plays() {
return deska.place === 'panel' || deska.frames.panel === 0
}
// Only the frame that plays runs this
async function apply(action, station) {
if (action === 'play') {
audio.src = station.url
await audio.play()
} else {
audio.pause()
}
now = { station: station, playing: action === 'play' }
draw(now)
await deska.storage.set('now', now)
await deska.extras.set({
state: station.title.slice(0, 60),
control: now.playing ? 'pause' : 'play',
})
}
// Every button in the page calls this, in either place
function press(action, station) {
if (plays()) return apply(action, station)
return deska.send({ action: action, station: station })
}
deska.on('message', ({ data }) => {
if (plays()) apply(data.action, data.station)
})
deska.on('extras.control', ({ control }) => {
if (plays()) apply(control, now.station)
})
// Another frame changed what plays: draw it
deska.on('storage', ({ key, value }) => {
if (key !== 'now' || !value) return
now = value
draw(now)
})
// A panel opened or closed: hand the sound over
deska.on('frames', () => {
if (!plays()) audio.pause()
else if (now.playing && audio.paused) apply('play', now.station)
})
deska.ready().then(async () => {
now = (await deska.storage.get('now')) || now
draw(now)
if (plays() && now.playing) apply('play', now.station)
})With no view, the panel and the Extras page are this same page, told apart by deska.place. A separate view works the same way: it only has to follow the same keys and messages.
A player built on an embed
When the sound comes from an embed (a video, a radio site) and not from your page, the same pattern holds, with one more rule: only the frame that plays shows the embed. Two frames that each show it play it twice, and Deska never mutes an embed by itself: off screen, in another project or in a kept Extras page, it keeps playing.
- The frame that plays shows the embed and keeps what it plays in storage.
- The panel or Extras page that does not play shows no embed. It draws from storage and sends its presses with
send. - The frame that stops being the player hides its embed with
remove(), or mutes it withsetMuted(true)(desktop 1.36.0). An embed hidden by a 0 by 0 slot keeps playing unless it is muted. - Your page cannot script the embed, so playing and pausing mean showing and hiding it, or pointing it at another address.
- A signed-out embed may keep some sound after
setMuted. Hide it to be sure.
// The same pattern with an embed in place of the audio element.
// plays() and now come from the code above; call follow() where it played or paused.
const slot = document.getElementById('player') // a slot with a real size
let player = null
let shown = null
async function follow() {
const url = plays() && now.playing ? now.station.url : null
if (url === shown) return
shown = url
if (player) await player.remove() // paused, another station, or no longer the player
player = url ? await deska.embed.attach(slot, url) : null
}
deska.on('frames', follow)
deska.on('storage', ({ key }) => {
if (key === 'now') follow()
})See deska.embed for the calls, and Filling the panel with an embed for the slot’s size.
Keep playing after Extras closes
By default the Extras page ends when Extras closes. A package that declares keepAlive (with "sdk": 3) can keep it: while the page has called deska.extras.keepRunning(true), closing Extras leaves it running, hidden and told visible: false, and opening the row shows the same page again, not a new one. A player started from Extras plays on with no panel open.
// Keep this page running while it plays; let it go once it stops
function keepWhilePlaying(on) {
if (deska.place !== 'extras') return // a panel runs anyway
deska.extras.keepRunning(on).catch((err) => console.warn('keepRunning:', err.code))
}
audio.addEventListener('playing', () => keepWhilePlaying(true))
audio.addEventListener('pause', () => keepWhilePlaying(false))- Ask only while there is something to keep, and call
keepRunning(false)once it stops. The page then ends with Extras, or at once if Extras is already closed. - It also ends when the person hides the package’s row, when the package is removed, and when Deska quits. Nothing comes back by itself after a restart.
- Since desktop 1.36.0, a kept page whose frame restarts (a save in a loaded folder, a permission change, an update) starts again hidden and has 10 seconds to ask to keep running again. Rebuild from storage and ask once it plays, as the code above does.
- At most three pages keep running at once, across every package. When a fourth asks, the one kept longest ends; its row stays.
- A press on the row with no frame open starts the page hidden (see The control). It ends unless it asks to keep running within 10 seconds.
- Deska’s main window keeps these pages.
keepRunninganswersfalsewhere there is nothing to keep: in a panel, which runs while it is on the desk anyway, and in the Extras of another window, where the page ends with the popover. A package that did not declarekeepAlivegetspermission_denied.
Examples with a row
- Ship Countdown: a view page,
until, the ring,stopandstart. - Net Radio: play and pause from the row, a compact layout for
place: 'extras'. - Noise Machine: a sleep timer, and one speaker across many frames.
- Service Status: a one line summary in
state. - SDK Playground: every field by hand, and the control answered from every frame.