Skip to content

Open source Grok Bot alternative, Bring your own agent and subscription: message Claude Code, Codex, Gemini CLI, Cursor, Copilot and 40+ AI agents as bots on your own computer, from iPhone, Mac, Windows, Linux or terminal. Agent-agnostic and free. Also a Muse and Dots alternative. Built in Rust.

feat(desktop): animate switching tabs and bots in the notch island

leepokaie468750be4b2
diff --git a/apps/desktop/src/main/island.ts b/apps/desktop/src/main/island.ts
index 03c0cceb..ec2d17a5 100644
--- a/apps/desktop/src/main/island.ts
+++ b/apps/desktop/src/main/island.ts
@@ -65,6 +65,7 @@ export class Island {
private inside = false
private timer: NodeJS.Timeout | null = null
private shaped: IslandRect = { x: 0, y: 0, width: 0, height: 0 }
+ private unfocus: NodeJS.Timeout | undefined
constructor(private deps: Deps) {}
@@ -162,6 +163,7 @@ export class Island {
private close() {
this.setKeys(false)
+ clearTimeout(this.unfocus)
if (this.timer) clearTimeout(this.timer)
this.timer = null
this.window?.destroy()
@@ -172,12 +174,18 @@ export class Island {
private setFocusable(on: boolean) {
const win = this.window
if (!win) return
+ clearTimeout(this.unfocus)
win.setFocusable(on)
if (on) win.focus()
else if (win.isFocused()) {
- // Giving the keyboard back sends the window to the back of its level on macOS: bring it forward again.
- win.blur()
- win.moveTop()
+ // Giving the keyboard back takes the window off screen for a moment on macOS (and to the back
+ // of its level): wait until the shape has folded, then bring it forward again.
+ this.unfocus = setTimeout(() => {
+ if (!win.isDestroyed() && win.isFocused()) {
+ win.blur()
+ win.moveTop()
+ }
+ }, SHRINK_MS)
}
}
diff --git a/apps/desktop/src/renderer/views/island/IslandViews.tsx b/apps/desktop/src/renderer/views/island/IslandViews.tsx
index 1d83b394..b4a0da54 100644
--- a/apps/desktop/src/renderer/views/island/IslandViews.tsx
+++ b/apps/desktop/src/renderer/views/island/IslandViews.tsx
@@ -1,4 +1,4 @@
-import { useState } from 'react'
+import { useRef, useState } from 'react'
import type { IslandBot, IslandPermission } from '@shared/island'
import { CharacterAvatar } from '../../components/Avatar'
import { Button, Spinner } from '../../components/Controls'
@@ -6,6 +6,7 @@ import { Icon } from '../../components/Icon'
import { ThinkingOrb } from '../../components/ThinkingOrb'
import { avatarColor, withAlpha } from '../../lib/theme'
import type { IslandModel } from './island-model'
+import { useArrivals, useFlip, useSwap } from './island-motion'
import { AgentRow, AMBER, badgeOf, BigCharacter, GREEN, KeyHint, MiniColumn, moodOf, RED, StateBadge, StatusDot, stepIcon } from './island-parts'
const veil = (color: string, alpha: number) => `radial-gradient(120% 90% at 50% 130%, ${withAlpha(color, alpha)}, ${withAlpha(color, 0)} 70%)`
@@ -17,13 +18,17 @@ const veil = (color: string, alpha: number) => `radial-gradient(120% 90% at 50%
export function Wings({ model, peek }: { model: IslandModel; peek: boolean }) {
const focus = model.focus
const others = model.others(4)
+ const swap = useSwap(focus?.ref)
+ const arrivals = useArrivals(others.map((b) => b.ref))
+ const cluster = useRef<HTMLSpanElement>(null)
+ useFlip(cluster)
if (!focus) return null
const label = focus.status === 'needsInput' ? 'Needs you' : `${model.activeCount} working`
return (
<div className={`island-wings ${peek ? 'peeking' : ''}`}>
{model.screen.notch || peek ? null : <span className="island-wings-label">{label}</span>}
<span className="island-wing-left">
- <span className="island-wing-avatar">
+ <span key={focus.ref} className={`island-wing-avatar ${swap}`}>
<CharacterAvatar shape={focus.shape} color={focus.color} size={peek ? 18 : 20} mood={moodOf(focus)} dark />
{peek ? null : <StateBadge badge={badgeOf(focus)} small />}
</span>
@@ -31,9 +36,9 @@ export function Wings({ model, peek }: { model: IslandModel; peek: boolean }) {
{peek ? null : (
<span className="island-wing-right">
{others.length ? (
- <span className="island-cluster">
+ <span ref={cluster} className="island-cluster">
{others.map((b) => (
- <span key={b.ref} className="island-cluster-bot">
+ <span key={b.ref} data-flip={b.ref} className={`island-cluster-bot ${arrivals.has(b.ref) ? 'island-swap' : ''}`}>
<CharacterAvatar shape={b.shape} color={b.color} size={11} mood={moodOf(b)} dark />
{b.status === 'needsInput' ? <StatusDot bot={b} /> : null}
</span>
@@ -54,28 +59,35 @@ export function Wings({ model, peek }: { model: IslandModel; peek: boolean }) {
export function Overview({ model }: { model: IslandModel }) {
const focus = model.focus
const others = model.others(4)
+ const swap = useSwap(focus?.ref)
+ const arrivals = useArrivals(others.map((b) => b.ref))
+ const pills = useRef<HTMLDivElement>(null)
+ useFlip(pills)
if (!focus) return null
const steps = focus.steps.length ? focus.steps : [{ title: focus.detail, kind: 'other' }]
return (
<div className="island-row-cards">
<button className="island-card island-focus" style={others.length ? { width: 322 } : { flex: 1 }} onClick={() => model.openBot(focus.ref)} title="Open conversation">
- <BigCharacter bot={focus} size={70} mood={moodOf(focus)} badge={badgeOf(focus)} />
- <span className="island-focus-text">
- <AgentRow color={focus.color} name={focus.name} subtitle={focus.backend} />
- {steps.map((step, i) => (
- <span key={`${i}-${step.title}`} className={`island-step ${i === steps.length - 1 ? 'current' : ''}`}>
- <Icon name={stepIcon(step.kind)} size={i === steps.length - 1 ? 13 : 12} scaled={false} />
- <span className="island-ellipsis">{step.title}</span>
- </span>
- ))}
+ <span key={focus.ref} className={`island-swap-slot ${swap}`}>
+ <BigCharacter bot={focus} size={70} mood={moodOf(focus)} badge={badgeOf(focus)} />
+ <span className="island-focus-text">
+ <AgentRow color={focus.color} name={focus.name} subtitle={focus.backend} />
+ {steps.map((step, i) => (
+ <span key={`${i}-${step.title}`} className={`island-step ${i === steps.length - 1 ? 'current' : ''}`}>
+ <Icon name={stepIcon(step.kind)} size={i === steps.length - 1 ? 13 : 12} scaled={false} />
+ <span className="island-ellipsis">{step.title}</span>
+ </span>
+ ))}
+ </span>
</span>
</button>
{others.length ? (
- <div className="island-card island-pills">
+ <div ref={pills} className="island-card island-pills">
{others.map((b) => (
<button
key={b.ref}
- className="island-pill"
+ data-flip={b.ref}
+ className={`island-pill ${arrivals.has(b.ref) ? 'island-swap' : ''}`}
style={{ background: withAlpha(avatarColor(b.color), 0.16), color: `color-mix(in srgb, ${avatarColor(b.color)} 55%, white)` }}
onClick={() => model.openBot(b.ref)}
title={b.detail}
@@ -112,21 +124,24 @@ const optionOrder = (kind: string) => ({ reject_always: 0, reject_once: 1, allow
export function Approval({ model, card }: { model: IslandModel; card: IslandPermission }) {
const options = [...card.options].sort((a, b) => optionOrder(a.kind) - optionOrder(b.kind))
+ const swap = useSwap(card.entryId)
return (
<div className="island-with-minis">
<div className="island-card island-alert" style={{ background: `${veil(AMBER, 0.42)}, var(--island-card)` }}>
- <BigCharacter bot={card.bot} size={56} mood="needsInput" badge="needsInput" onOpen={() => model.openBot(card.ref)} />
- <div className="island-alert-text">
- <AgentRow color={card.bot.color} name={card.bot.name} subtitle={`${card.bot.backend} ${card.headline.charAt(0).toLowerCase()}${card.headline.slice(1)}`} />
- {card.title ? <div className="island-code">{card.title}</div> : null}
- <div className="island-buttons">
- {options.map((o) => (
- <Button key={o.id} kind={o.kind === 'allow_once' ? 'primary' : 'secondary'} disabled={card.answering !== null} onClick={() => model.respond(card, o.id)}>
- {card.answering === o.id ? <Spinner size={12} /> : null}
- {o.label}
- {o.kind === 'allow_once' ? <KeyHint keys="⌥Y" /> : o.kind === 'reject_once' ? <KeyHint keys="⌥N" /> : null}
- </Button>
- ))}
+ <div key={card.entryId} className={`island-swap-slot ${swap}`}>
+ <BigCharacter bot={card.bot} size={56} mood="needsInput" badge="needsInput" onOpen={() => model.openBot(card.ref)} />
+ <div className="island-alert-text">
+ <AgentRow color={card.bot.color} name={card.bot.name} subtitle={`${card.bot.backend} ${card.headline.charAt(0).toLowerCase()}${card.headline.slice(1)}`} />
+ {card.title ? <div className="island-code">{card.title}</div> : null}
+ <div className="island-buttons">
+ {options.map((o) => (
+ <Button key={o.id} kind={o.kind === 'allow_once' ? 'primary' : 'secondary'} disabled={card.answering !== null} onClick={() => model.respond(card, o.id)}>
+ {card.answering === o.id ? <Spinner size={12} /> : null}
+ {o.label}
+ {o.kind === 'allow_once' ? <KeyHint keys="⌥Y" /> : o.kind === 'reject_once' ? <KeyHint keys="⌥N" /> : null}
+ </Button>
+ ))}
+ </div>
</div>
</div>
</div>
@@ -137,23 +152,26 @@ export function Approval({ model, card }: { model: IslandModel; card: IslandPerm
/** A bot that just finished (for a moment) or failed (until dismissed). */
export function Notice({ model, bot, failed }: { model: IslandModel; bot: IslandBot; failed: boolean }) {
+ const swap = useSwap(`${failed}:${bot.ref}`)
return (
<div className="island-with-minis">
<div className="island-card island-alert" style={{ background: `${veil(failed ? RED : GREEN, failed ? 0.5 : 0.42)}, var(--island-card)` }}>
- <BigCharacter bot={bot} size={58} mood="idle" badge={failed ? 'failed' : 'finished'} onOpen={() => model.openBot(bot.ref)} />
- <div className="island-alert-text">
- <AgentRow color={bot.color} name={bot.name} subtitle={failed ? bot.backend : `${bot.backend} is done`} />
- {failed ? (
- <>
- <div className="island-title">{`${bot.name} stopped.`}</div>
- <div className="island-error">{bot.error ?? bot.detail}</div>
- </>
- ) : (
- <div className="island-title island-ellipsis">{bot.detail}</div>
- )}
- <div className="island-buttons start">
- <Button onClick={() => model.openBot(bot.ref)}>Open conversation</Button>
- <Button kind="secondary" onClick={() => model.dismissNotice()}>OK</Button>
+ <div key={`${failed}:${bot.ref}`} className={`island-swap-slot ${swap}`}>
+ <BigCharacter bot={bot} size={58} mood="idle" badge={failed ? 'failed' : 'finished'} onOpen={() => model.openBot(bot.ref)} />
+ <div className="island-alert-text">
+ <AgentRow color={bot.color} name={bot.name} subtitle={failed ? bot.backend : `${bot.backend} is done`} />
+ {failed ? (
+ <>
+ <div className="island-title">{`${bot.name} stopped.`}</div>
+ <div className="island-error">{bot.error ?? bot.detail}</div>
+ </>
+ ) : (
+ <div className="island-title island-ellipsis">{bot.detail}</div>
+ )}
+ <div className="island-buttons start">
+ <Button onClick={() => model.openBot(bot.ref)}>Open conversation</Button>
+ <Button kind="secondary" onClick={() => model.dismissNotice()}>OK</Button>
+ </div>
</div>
</div>
</div>
@@ -166,15 +184,19 @@ export function Notice({ model, bot, failed }: { model: IslandModel; bot: Island
export function Message({ model }: { model: IslandModel }) {
const [text, setText] = useState('')
const bot = model.messageBot
+ const swap = useSwap(bot?.ref)
if (!bot) return null
return (
<div className="island-with-minis">
<div className="island-card island-message">
- <CharacterAvatar shape={bot.shape} color={bot.color} size={44} mood={moodOf(bot)} dark />
+ <span key={bot.ref} className={`island-message-bot ${swap}`}>
+ <CharacterAvatar shape={bot.shape} color={bot.color} size={44} mood={moodOf(bot)} dark />
+ </span>
<div className="island-message-body">
<div className="island-agent">
<button
- className="island-chip"
+ key={bot.ref}
+ className={`island-chip ${swap}`}
style={{ background: withAlpha(avatarColor(bot.color), 0.16), color: `color-mix(in srgb, ${avatarColor(bot.color)} 55%, white)` }}
onClick={() => model.nextMessageBot()}
title="Choose a bot"
diff --git a/apps/desktop/src/renderer/views/island/IslandWindow.tsx b/apps/desktop/src/renderer/views/island/IslandWindow.tsx
index a8831aad..5348266c 100644
--- a/apps/desktop/src/renderer/views/island/IslandWindow.tsx
+++ b/apps/desktop/src/renderer/views/island/IslandWindow.tsx
@@ -4,6 +4,7 @@ import { Icon } from '../../components/Icon'
import { usePresence } from '../../components/Overlay'
import { useModel } from '../../lib/observable'
import { PINNED_LEAVE_MS, type IslandModel } from './island-model'
+import { useCrossFade } from './island-motion'
import { Approval, Empty, Message, Notice, Overview, Wings } from './IslandViews'
import { UsageMeter, UsageView } from './IslandUsage'
import './island.css'
@@ -43,11 +44,8 @@ export function IslandWindow({ model }: { model: IslandModel }) {
</div>
) : null}
{views.mounted ? (
- <div className={`island-layer ${views.shown ? '' : 'leaving'}`}>
- <Header model={model} mode={lastOpen.current} />
- <div key={lastOpen.current} className="island-content" style={{ top: contentTop(model.screen) }}>
- <View model={model} mode={lastOpen.current} />
- </div>
+ <div className={`island-layer island-views ${views.shown ? '' : 'leaving'}`}>
+ <OpenViews model={model} mode={lastOpen.current} />
</div>
) : null}
{open && model.closing ? <span className="island-countdown" style={{ animationDuration: `${PINNED_LEAVE_MS}ms` }} /> : null}
@@ -56,6 +54,27 @@ export function IslandWindow({ model }: { model: IslandModel }) {
)
}
+/** How long the view a tab switch replaced takes to fade while the next one fades in. */
+const SWITCH_MS = 220
+
+/**
+ * The header and the view under it. Switching tabs (or an alert taking over) only cross-fades
+ * the view: the shape keeps its size.
+ */
+function OpenViews({ model, mode }: { model: IslandModel; mode: IslandMode }) {
+ const previous = useCrossFade(mode, SWITCH_MS)
+ return (
+ <>
+ <Header model={model} mode={mode} />
+ {(previous ? [previous, mode] : [mode]).map((m) => (
+ <div key={m} className={`island-content ${m === previous ? 'leaving' : ''}`} style={{ top: contentTop(model.screen) }}>
+ <View model={model} mode={m} />
+ </div>
+ ))}
+ </>
+ )
+}
+
function View({ model, mode }: { model: IslandModel; mode: IslandMode }) {
switch (mode) {
case 'overview':
diff --git a/apps/desktop/src/renderer/views/island/island-model.ts b/apps/desktop/src/renderer/views/island/island-model.ts
index a4a9d564..00a11038 100644
--- a/apps/desktop/src/renderer/views/island/island-model.ts
+++ b/apps/desktop/src/renderer/views/island/island-model.ts
@@ -34,6 +34,8 @@ export class IslandModel extends Observable {
private noticeTimer: ReturnType<typeof setTimeout> | undefined
private shape = { width: 0, height: 0 }
private keys = false
+ /** The window took the keyboard for the message field; it keeps it until the island closes. */
+ private keyboard = false
start() {
const island = window.codync.island
@@ -106,7 +108,6 @@ export class IslandModel extends Observable {
/** The header's tabs. Bots puts the approvals on screen off until another arrives. */
setTab(tab: IslandTab) {
- const typing = this.tab === 'message'
this.update(() => {
if (tab === 'bots') for (const p of this.summary.permissions) this.deferred.add(p.entryId)
if (tab === 'message' && !this.messageRef) this.messageRef = this.focus?.ref ?? null
@@ -114,8 +115,12 @@ export class IslandModel extends Observable {
this.open = true
this.pinned = true
})
- // Only the message field takes the keyboard; giving it back is the only reason to touch focus.
- if (typing !== (tab === 'message')) window.codync.island.setFocusable(tab === 'message')
+ // Only the message field takes the keyboard. It goes back when the island closes, not on the
+ // next tab: giving it back blinks the window on macOS.
+ if (tab === 'message') {
+ this.keyboard = true
+ window.codync.island.setFocusable(true)
+ }
this.foldWhenAway()
}
@@ -162,7 +167,6 @@ export class IslandModel extends Observable {
close() {
clearTimeout(this.hoverTimer)
- const typing = this.tab === 'message'
this.update(() => {
this.open = false
this.pinned = false
@@ -170,7 +174,8 @@ export class IslandModel extends Observable {
this.closing = false
this.tab = 'auto'
})
- if (typing) window.codync.island.setFocusable(false)
+ if (this.keyboard) window.codync.island.setFocusable(false)
+ this.keyboard = false
}
private answerByKey(answer: 'allow' | 'deny') {
diff --git a/apps/desktop/src/renderer/views/island/island-motion.ts b/apps/desktop/src/renderer/views/island/island-motion.ts
new file mode 100644
index 00000000..b1a57aa0
--- /dev/null
+++ b/apps/desktop/src/renderer/views/island/island-motion.ts
@@ -0,0 +1,71 @@
+import { useEffect, useLayoutEffect, useRef, useState, type RefObject } from 'react'
+import { reduceMotion } from '../../lib/theme'
+
+// Switching bots animates: the slot that shows one bot plays `island-swap` when another bot takes
+// it, and a bot joining a row of bots plays it as it arrives. Neither plays when a view first
+// appears (the view's own entrance covers that).
+
+/**
+ * The class for an element keyed by `id` (give it `key={id}` so a new bot mounts a new element):
+ * `island-swap` once the id changed, so each new bot animates in.
+ */
+export function useSwap(id: string | null | undefined) {
+ const last = useRef<{ id: string | null | undefined; animate: boolean } | null>(null)
+ if (!last.current) last.current = { id, animate: false }
+ else if (last.current.id !== id) last.current = { id, animate: true }
+ return last.current.animate ? 'island-swap' : ''
+}
+
+/** The ids that just joined a list of bots (none on its first render), to animate in. */
+export function useArrivals(ids: string[]) {
+ const seen = useRef<Set<string> | null>(null)
+ const arrivals = useRef<ReadonlySet<string>>(new Set())
+ const key = ids.join('\n')
+ const lastKey = useRef<string | null>(null)
+ if (lastKey.current !== key) {
+ const before = seen.current
+ arrivals.current = before ? new Set(ids.filter((id) => !before.has(id))) : new Set()
+ seen.current = new Set(ids)
+ lastKey.current = key
+ }
+ return arrivals.current
+}
+
+/**
+ * The view that `value` just replaced, kept for `ms` so both render and a tab switch
+ * cross-fades instead of cutting. Null when nothing is leaving.
+ */
+export function useCrossFade<T>(value: T, ms: number): T | null {
+ const [state, setState] = useState<{ value: T; previous: T | null }>({ value, previous: null })
+ if (state.value !== value) setState({ value, previous: state.value })
+ useEffect(() => {
+ if (state.previous === null) return
+ const timer = setTimeout(() => setState((s) => ({ ...s, previous: null })), ms)
+ return () => clearTimeout(timer)
+ }, [state.previous, ms])
+ return state.previous !== value ? state.previous : null
+}
+
+/**
+ * Bots that move within a row slide to their new place (FLIP): elements under `container`
+ * marked `data-flip` (their ref) are measured after every render and eased from where they
+ * were. Layout offsets, so the views' own scale animations never read as a move.
+ */
+export function useFlip(container: RefObject<HTMLElement | null>) {
+ const places = useRef(new Map<string, { x: number; y: number }>())
+ useLayoutEffect(() => {
+ const next = new Map<string, { x: number; y: number }>()
+ for (const el of container.current?.querySelectorAll<HTMLElement>('[data-flip]') ?? []) {
+ const id = el.dataset.flip ?? ''
+ const place = { x: el.offsetLeft, y: el.offsetTop }
+ const before = places.current.get(id)
+ next.set(id, place)
+ if (!before || (before.x === place.x && before.y === place.y) || reduceMotion()) continue
+ el.animate([{ transform: `translate(${before.x - place.x}px, ${before.y - place.y}px)` }, { transform: 'none' }], {
+ duration: 420,
+ easing: 'cubic-bezier(0.32, 1.22, 0.42, 1)',
+ })
+ }
+ places.current = next
+ })
+}
diff --git a/apps/desktop/src/renderer/views/island/island-parts.tsx b/apps/desktop/src/renderer/views/island/island-parts.tsx
index 7dde6aab..b938fa80 100644
--- a/apps/desktop/src/renderer/views/island/island-parts.tsx
+++ b/apps/desktop/src/renderer/views/island/island-parts.tsx
@@ -1,7 +1,9 @@
+import { useRef } from 'react'
import type { IslandBot } from '@shared/island'
import { CharacterAvatar, type Mood } from '../../components/Avatar'
import { Icon } from '../../components/Icon'
import { ThinkingOrb } from '../../components/ThinkingOrb'
+import { useArrivals, useFlip } from './island-motion'
import { avatarColor, withAlpha } from '../../lib/theme'
// Pieces the island's views share: the big character with its glow and
@@ -103,10 +105,13 @@ export function AgentRow({ color, name, subtitle }: { color: string; name: strin
/** The other bots down the right edge; each opens its conversation. */
export function MiniColumn({ bots, onOpen }: { bots: IslandBot[]; onOpen: (ref: string) => void }) {
+ const arrivals = useArrivals(bots.map((b) => b.ref))
+ const column = useRef<HTMLDivElement>(null)
+ useFlip(column)
return (
- <div className="island-minis">
+ <div ref={column} className="island-minis">
{bots.map((b) => (
- <button key={b.ref} className="island-mini" title={b.name} aria-label={`Open ${b.name}`} onClick={() => onOpen(b.ref)}>
+ <button key={b.ref} data-flip={b.ref} className={`island-mini ${arrivals.has(b.ref) ? 'island-swap' : ''}`} title={b.name} aria-label={`Open ${b.name}`} onClick={() => onOpen(b.ref)}>
<CharacterAvatar shape={b.shape} color={b.color} size={18} mood={moodOf(b)} dark />
<StatusDot bot={b} />
</button>
diff --git a/apps/desktop/src/renderer/views/island/island.css b/apps/desktop/src/renderer/views/island/island.css
index 77f4f0c0..4cf86fa4 100644
--- a/apps/desktop/src/renderer/views/island/island.css
+++ b/apps/desktop/src/renderer/views/island/island.css
@@ -180,12 +180,54 @@ html[data-window='island'] #root {
margin-right: 4px;
}
+/* Another bot takes a slot (or joins a row): it springs in out of a blur. */
+.island-swap {
+ animation: island-swap 0.38s cubic-bezier(0.32, 1.22, 0.42, 1) both;
+}
+@keyframes island-swap {
+ from {
+ opacity: 0;
+ filter: blur(6px);
+ transform: translateY(6px) scale(0.92);
+ }
+}
+/* The bot's part of a card, as one piece that can swap. */
+.island-swap-slot {
+ flex: 1;
+ min-width: 0;
+ height: 100%;
+ display: flex;
+ align-items: center;
+ gap: inherit;
+}
+.island-message-bot {
+ display: block;
+ flex: none;
+}
+
+/* Opening, the views arrive once the shape has grown; switching tabs, the next view fades in
+ over the one leaving (the shape keeps its size). */
+.island-views {
+ animation: island-in 0.3s 0.16s var(--ease) backwards;
+}
.island-content {
position: absolute;
left: 10px;
right: 10px;
bottom: 10px;
- animation: island-in 0.3s 0.16s var(--ease) backwards;
+ animation: island-switch 0.24s var(--ease) backwards;
+}
+.island-content.leaving {
+ opacity: 0;
+ filter: blur(3px);
+ transition: opacity 0.14s var(--ease), filter 0.14s var(--ease);
+ pointer-events: none;
+}
+@keyframes island-switch {
+ from {
+ opacity: 0;
+ filter: blur(3px);
+ }
}
@keyframes island-in {
from {
@@ -651,11 +693,14 @@ html[data-window='island'] #root {
.island-body {
transition: none;
}
+ .island-views,
.island-content,
- .island-header {
+ .island-header,
+ .island-swap {
animation: none;
}
- .island-layer.leaving {
+ .island-layer.leaving,
+ .island-content.leaving {
transition: none;
}
}
diff --git a/apps/desktop/src/shared/island.test.ts b/apps/desktop/src/shared/island.test.ts
index 07ad0725..6b9b4ac0 100644
--- a/apps/desktop/src/shared/island.test.ts
+++ b/apps/desktop/src/shared/island.test.ts
@@ -70,9 +70,12 @@ test('shapes follow the notch, and a plain top edge keeps a thin strip that wake
assert.deepEqual(islandFrame('hidden', notch), { width: 185, height: 32, radius: 14 })
assert.equal(islandFrame('peek', notch).width, 185 + 64)
assert.equal(islandFrame('compact', notch).width, 185 + 104)
- assert.deepEqual(islandFrame('approval', notch), { width: 640, height: 206, radius: 30 })
+ // Every open view has one size: switching tabs never moves the shape.
+ for (const mode of ['overview', 'empty', 'approval', 'finished', 'failed', 'message', 'usage'] as const) {
+ assert.deepEqual(islandFrame(mode, notch), { width: 640, height: 196, radius: 30 })
+ }
// A taller notch pushes the content down.
- assert.equal(islandFrame('approval', { notch: { width: 200, height: 38 } }).height, 212)
+ assert.equal(islandFrame('approval', { notch: { width: 200, height: 38 } }).height, 202)
const edge = islandRect(islandFrame('hidden', { notch: null }), 720)
assert.equal(hits(edge, 360, 0), true)
assert.equal(hits(edge, 360, 12), false)
diff --git a/apps/desktop/src/shared/island.ts b/apps/desktop/src/shared/island.ts
index ac7a2ef2..01d9e168 100644
--- a/apps/desktop/src/shared/island.ts
+++ b/apps/desktop/src/shared/island.ts
@@ -99,8 +99,11 @@ export const PANEL = { width: 720, height: 300 }
/** The open island's width. */
export const OPEN_WIDTH = 640
-/** Height of each open view for a 32 pt notch (a taller notch adds its extra height). */
-const OPEN_HEIGHT = { overview: 196, empty: 150, approval: 206, finished: 170, failed: 190, message: 156, usage: 196 }
+/**
+ * Every open view has the same height (for a 32 pt notch; a taller one adds its extra), so
+ * switching tabs or alerts never moves the black shape: only what's inside changes.
+ */
+const OPEN_HEIGHT = 196
/** The resting bar at a plain top edge (no notch). */
const BAR = 26
@@ -165,7 +168,7 @@ export function islandFrame(mode: IslandMode, screen: IslandScreen) {
case 'compact':
return { width: notch ? notch.width + 104 : 240, height: bar, radius: closedRadius }
default:
- return { width: OPEN_WIDTH, height: OPEN_HEIGHT[mode] + contentTop(screen) - 36, radius: 30 }
+ return { width: OPEN_WIDTH, height: OPEN_HEIGHT + contentTop(screen) - 36, radius: 30 }
}
}
diff --git a/docs/features/notch-island.md b/docs/features/notch-island.md
index 0d8c5c0f..22a26e7f 100644
--- a/docs/features/notch-island.md
+++ b/docs/features/notch-island.md
@@ -40,6 +40,11 @@ until another arrives. Answers and messages go through the chat window (`respond
`send`), like the chat's own cards and composer. The states, sizes and motion are drawn in the
design canvas the island was built from.
+Every open view is the same size, so switching tabs or an alert taking over never moves the
+black shape: the next view cross-fades over the last. When another bot takes the focus it
+springs in out of a blur, a bot joining the pills or the column does the same, and the others
+slide to their new places.
+
## How it works
- **Window** (`apps/desktop/src/main/island.ts`): a fixed 720 × 300 transparent, frameless,
@@ -62,9 +67,10 @@ design canvas the island was built from.
sends bots and pending permission cards when they change; the island window renders them
(`views/island/`, state in `IslandModel`, pure rules in `shared/island.ts`). Buttons travel back
as `WindowCommand`s (`openBot`, `respondPermission`, `sendMessage`) to the chat window, which
- calls the host. The island has no host connection of its own. It takes the keyboard only while
- the message field is open (`setFocusable`); ⌥Y / ⌥N are global shortcuts only while an
- approval shows.
+ calls the host. The island has no host connection of its own. It takes the keyboard when
+ the message field opens (`setFocusable`) and gives it back once the island has folded
+ (giving it back takes the window off screen for a moment on macOS); ⌥Y / ⌥N are global
+ shortcuts only while an approval shows.
## Platforms and other clients