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.

fix(desktop): fold the notch island back into the notch

leepokai4a1c043a6639
diff --git a/apps/desktop/src/main/island.ts b/apps/desktop/src/main/island.ts
index 50667bcf..03c0cceb 100644
--- a/apps/desktop/src/main/island.ts
+++ b/apps/desktop/src/main/island.ts
@@ -116,8 +116,12 @@ export class Island {
private open() {
if (this.window) return
const isMac = process.platform === 'darwin'
+ // Top center of the main display until the notch is measured (place() moves it if needed).
+ const main = screen.getPrimaryDisplay().bounds
const win = new BrowserWindow({
...PANEL,
+ x: Math.round(main.x + (main.width - PANEL.width) / 2),
+ y: main.y,
show: false,
frame: false,
transparent: true,
@@ -170,7 +174,11 @@ export class Island {
if (!win) return
win.setFocusable(on)
if (on) win.focus()
- else win.blur()
+ 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()
+ }
}
private setKeys(on: boolean) {
diff --git a/apps/desktop/src/renderer/views/island/IslandViews.tsx b/apps/desktop/src/renderer/views/island/IslandViews.tsx
index e3eb5a08..1d83b394 100644
--- a/apps/desktop/src/renderer/views/island/IslandViews.tsx
+++ b/apps/desktop/src/renderer/views/island/IslandViews.tsx
@@ -20,7 +20,7 @@ export function Wings({ model, peek }: { model: IslandModel; peek: boolean }) {
if (!focus) return null
const label = focus.status === 'needsInput' ? 'Needs you' : `${model.activeCount} working`
return (
- <div className="island-wings">
+ <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">
diff --git a/apps/desktop/src/renderer/views/island/IslandWindow.tsx b/apps/desktop/src/renderer/views/island/IslandWindow.tsx
index 25f627bb..a8831aad 100644
--- a/apps/desktop/src/renderer/views/island/IslandWindow.tsx
+++ b/apps/desktop/src/renderer/views/island/IslandWindow.tsx
@@ -1,17 +1,30 @@
+import { useRef } from 'react'
import { contentTop, isOpenMode, type IslandMode, type IslandTab } from '@shared/island'
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 { Approval, Empty, Message, Notice, Overview, Wings } from './IslandViews'
import { UsageMeter, UsageView } from './IslandUsage'
import './island.css'
-/** The notch island: a black shape that grows out of the notch. */
+/** How long the views stay on screen while the shape folds back into the notch (its 0.34 s close). */
+const FOLD_MS = 340
+
+/** The notch island: a black shape that grows out of the notch and folds back into it. */
export function IslandWindow({ model }: { model: IslandModel }) {
useModel(model)
const { mode, frame } = model
const open = isOpenMode(mode)
- const closed = mode === 'compact' || mode === 'hidden' || mode === 'peek'
+ const winged = mode === 'compact' || mode === 'peek'
+ const closed = winged || mode === 'hidden'
+ // What was on screen stays (fading) while the shape shrinks, so folding away is animated too.
+ const lastOpen = useRef<IslandMode>(mode)
+ const lastWings = useRef<IslandMode>(mode)
+ if (open) lastOpen.current = mode
+ if (winged) lastWings.current = mode
+ const views = usePresence(open, FOLD_MS, false)
+ const wings = usePresence(winged, FOLD_MS, false)
return (
<div
className={`island ${model.growing ? 'growing' : 'shrinking'} ${model.screen.notch ? '' : 'edge'}`}
@@ -24,14 +37,18 @@ export function IslandWindow({ model }: { model: IslandModel }) {
<span className="island-ear left" />
<span className="island-ear right" />
<div className="island-body" style={{ borderBottomLeftRadius: frame.radius, borderBottomRightRadius: frame.radius }}>
- {mode === 'compact' || mode === 'peek' ? <Wings model={model} peek={mode === 'peek'} /> : null}
- {open ? (
- <>
- <Header model={model} mode={mode} />
- <div key={mode} className="island-content" style={{ top: contentTop(model.screen) }}>
- <View model={model} mode={mode} />
+ {wings.mounted ? (
+ <div className={`island-layer ${wings.shown ? '' : 'leaving'}`}>
+ <Wings model={model} peek={lastWings.current === 'peek'} />
+ </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>
) : null}
{open && model.closing ? <span className="island-countdown" style={{ animationDuration: `${PINNED_LEAVE_MS}ms` }} /> : null}
</div>
diff --git a/apps/desktop/src/renderer/views/island/island-model.ts b/apps/desktop/src/renderer/views/island/island-model.ts
index 70c09631..a4a9d564 100644
--- a/apps/desktop/src/renderer/views/island/island-model.ts
+++ b/apps/desktop/src/renderer/views/island/island-model.ts
@@ -106,6 +106,7 @@ 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
@@ -113,7 +114,8 @@ export class IslandModel extends Observable {
this.open = true
this.pinned = true
})
- window.codync.island.setFocusable(tab === 'message')
+ // 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')
this.foldWhenAway()
}
@@ -160,6 +162,7 @@ export class IslandModel extends Observable {
close() {
clearTimeout(this.hoverTimer)
+ const typing = this.tab === 'message'
this.update(() => {
this.open = false
this.pinned = false
@@ -167,7 +170,7 @@ export class IslandModel extends Observable {
this.closing = false
this.tab = 'auto'
})
- window.codync.island.setFocusable(false)
+ if (typing) window.codync.island.setFocusable(false)
}
private answerByKey(answer: 'allow' | 'deny') {
diff --git a/apps/desktop/src/renderer/views/island/island.css b/apps/desktop/src/renderer/views/island/island.css
index 23d5c678..77f4f0c0 100644
--- a/apps/desktop/src/renderer/views/island/island.css
+++ b/apps/desktop/src/renderer/views/island/island.css
@@ -31,10 +31,27 @@ html[data-window='island'] #root {
.island.shrinking {
transition: width 0.34s cubic-bezier(0.45, 0, 0.2, 1), height 0.34s cubic-bezier(0.45, 0, 0.2, 1), opacity 0.2s var(--ease);
}
-/* Resting over the notch (or as a strip at a plain top edge): nothing to see. */
+/* Resting over the notch (or as a strip at a plain top edge): nothing to see. Folding into it,
+ the shape shrinks first and only then fades, so it visibly goes back into the notch. */
.island[data-mode='hidden'] {
opacity: 0;
}
+.island.shrinking[data-mode='hidden'] {
+ transition: width 0.34s cubic-bezier(0.45, 0, 0.2, 1), height 0.34s cubic-bezier(0.45, 0, 0.2, 1), opacity 0.16s var(--ease) 0.3s;
+}
+
+/* The wings or the open views; leaving, they blur away while the shape folds. */
+.island-layer {
+ position: absolute;
+ inset: 0;
+}
+.island-layer.leaving {
+ opacity: 0;
+ filter: blur(8px);
+ transform: scale(0.97);
+ transition: opacity 0.16s var(--ease), filter 0.16s var(--ease), transform 0.16s var(--ease);
+ pointer-events: none;
+}
.island-body {
position: absolute;
@@ -95,9 +112,10 @@ html[data-window='island'] #root {
display: grid;
place-items: center;
}
-.island[data-mode='peek'] .island-wing-left {
- width: 38px;
- justify-items: end;
+/* Peeking, the notch is only 32 pt wider on each side: the whole character sits in that strip,
+ never half behind the camera. */
+.island-wings.peeking .island-wing-left {
+ width: 32px;
}
.island-wings-label {
position: absolute;
@@ -123,6 +141,7 @@ html[data-window='island'] #root {
/* Open: the header beside the notch. */
.island-header {
+ animation: island-in 0.3s 0.3s var(--ease) backwards;
position: absolute;
top: 2px;
left: 14px;
@@ -632,7 +651,11 @@ html[data-window='island'] #root {
.island-body {
transition: none;
}
- .island-content {
+ .island-content,
+ .island-header {
animation: none;
}
+ .island-layer.leaving {
+ transition: none;
+ }
}