deskbar
A desk for the Claude Code prompt: context weather, Gmail, calendar, tasks across sessions, notes, a music deck and a billable-hours timer
何をするか
- プロンプトの上の帯・欄・トーストを描く
- /desk・/weather・/timer を足す
- ツールの呼び出しを見張る
- prompt.context・prompt.submit・session.start・turn.complete ほか 2 個にフックする
- ターンをまたいで自分の状態を持つ
良いところ
- ネットワークに出ない
- TypeScript で書かれている
- デスクトップ専用の分岐がある
- エラーを扱う
作り始めるためのコード
2 種類あります。上のデザインから modscode が書いた雛形と、その Mod 自身のコードのうち描いている部分です。
雛形(register.tsx)
import type { Register } from 'claude-code'
// Drawn like deskbar by 0NE-C0DEMAN (pane, band, status, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/0ne-c0deman-deskbar/
// Written by modscode from that reading, not copied from the mod: use it as you like.
// Each value below stands for one the mod works out at run time; put in your own.
export const register: Register = on => {
// the band above the prompt; what else goes there is drawn under it
on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
const { Box, Client, Button, Svg, Text } = $.ui.resolve(e)
const source = '…'
const label = '…'
const about = '…'
const meterSvg = '…'
const unbilled = '…'
const money = '…'
const currency = '…'
const expenses = '…'
const dayName = '…'
return (
<Box flexDirection="column" width="100%">
<Box width="100%" justifyContent="space-between" alignItems="center">
92
<Box alignItems="center">
<Box alignItems="center">
<Box marginRight={1} alignItems="center">
<Client module="./pulse.tsx" width={1} height={1} />
</Box>
<Box position="relative" alignItems="center">
<Button label=" ▾" />
<Box position="absolute" top={0} left={1} height="100%" alignItems="center">
<Svg source={`${source}`} alt="timer" width={20} height={20} />
</Box>
</Box>
<Box marginLeft={1} alignItems="center">
<Box position="relative" alignItems="center">
<Button label={` ${label}`} />
<Box position="absolute" top={0} left={1} height="100%" alignItems="center">
<Svg source={`${source}`} alt="stop" width={20} height={20} />
</Box>
</Box>
</Box>
</Box>
</Box>
</Box>
<Box flexDirection="column" width="100%" marginTop={1}>
<Box width="100%" justifyContent="space-between" paddingX={1}>
<Box alignItems="center">
<Text color="#8fa3aa">
{about}
</Text>
<Text color="#8fa3aa">
{" week "}
</Text>
<Client module="./meter.tsx" width={8} height={1} />
<Svg source={`${meterSvg}`} alt="this week against the cap" width={56} height={10} />
</Box>
<Box>
<Text color="#8fa3aa">
{"Unbilled "}
</Text>
<Text bold>
{unbilled}
{" h"}
{money}
</Text>
<Text color="#8fa3aa">
{` · expenses ${currency}${expenses}`}
</Text>
</Box>
</Box>
<Box width="100%" columnGap={1}>
<Box flexDirection="column" flexGrow={1} borderStyle="round" borderColor="#2f4149">
<Box paddingX={1}>
<Text bold>
{`Today, ${dayName}`}
</Text>
</Box>
<Box paddingX={1} backgroundColor="#22333b">
<Box flexGrow={1} justifyContent="flex-end" paddingRight={2}>
<Text color="#1baf7a">
{" "}
</Text>
</Box>
<Box flexGrow={1} justifyContent="flex-end" paddingRight={2}>
<Text color="#1baf7a">
{" "}
</Text>
</Box>
<Box flexGrow={1} justifyContent="flex-end" paddingRight={2}>
<Text color="#1baf7a">
{" "}
</Text>
</Box>
</Box>
<Box paddingX={1}>
<Box flexGrow={1} justifyContent="flex-end" paddingRight={2}>
<Text color="#1baf7a">
{" "}
</Text>
</Box>
<Box flexGrow={1} justifyContent="flex-end" paddingRight={2}>
<Text color="#1baf7a">
{" "}
</Text>
</Box>
<Box flexGrow={1} justifyContent="flex-end" paddingRight={2}>
<Text color="#1baf7a">
{" "}
</Text>
</Box>
</Box>
<Box paddingX={1}>
<Box flexGrow={1} justifyContent="flex-end" paddingRight={2}>
<Text color="#1baf7a">
{" "}
</Text>
</Box>
<Box flexGrow={1} justifyContent="flex-end" paddingRight={2}>
<Text color="#1baf7a">
{" "}
</Text>
</Box>
<Box flexGrow={1} justifyContent="flex-end" paddingRight={2}>
<Text color="#1baf7a">
{" "}
</Text>
</Box>
</Box>
<Box paddingX={1}>
<Box flexGrow={1} justifyContent="flex-end" paddingRight={2}>
<Text color="#1baf7a">
{" "}
</Text>
</Box>
<Box flexGrow={1} justifyContent="flex-end" paddingRight={2}>
<Text color="#1baf7a">
{" "}
</Text>
</Box>
<Box flexGrow={1} justifyContent="flex-end" paddingRight={2}>
<Text color="#1baf7a">
{" "}
</Text>
</Box>
</Box>
</Box>
<Box flexDirection="column" flexGrow={1} borderStyle="round" borderColor="#2f4149">
<Box paddingX={1}>
<Text bold>
This week
</Text>
</Box>
<Box paddingX={1} backgroundColor="#22333b">
<Box flexGrow={1} justifyContent="flex-end" paddingRight={2}>
<Text color="#1baf7a">
{" "}
</Text>
</Box>
<Box flexGrow={1} justifyContent="flex-end" paddingRight={2}>
<Text color="#1baf7a">
{" "}
</Text>
</Box>
<Box flexGrow={1} justifyContent="flex-end" paddingRight={2}>
<Text color="#1baf7a">
{" "}
</Text>
</Box>
</Box>
<Box paddingX={1}>
<Box flexGrow={1} justifyContent="flex-end" paddingRight={2}>
<Text color="#1baf7a">
{" "}
</Text>
</Box>
<Box flexGrow={1} justifyContent="flex-end" paddingRight={2}>
<Text color="#1baf7a">
{" "}
</Text>
</Box>
<Box flexGrow={1} justifyContent="flex-end" paddingRight={2}>
<Text color="#1baf7a">
{" "}
</Text>
</Box>
</Box>
<Box paddingX={1}>
<Box flexGrow={1} justifyContent="flex-end" paddingRight={2}>
<Text color="#1baf7a">
{" "}
</Text>
</Box>
<Box flexGrow={1} justifyContent="flex-end" paddingRight={2}>
<Text color="#1baf7a">
{" "}
</Text>
</Box>
<Box flexGrow={1} justifyContent="flex-end" paddingRight={2}>
<Text color="#1baf7a">
{" "}
</Text>
</Box>
</Box>
<Box paddingX={1}>
<Box flexGrow={1} justifyContent="flex-end" paddingRight={2}>
<Text color="#1baf7a">
{" "}
</Text>
</Box>
<Box flexGrow={1} justifyContent="flex-end" paddingRight={2}>
<Text color="#1baf7a">
{" "}
</Text>
</Box>
<Box flexGrow={1} justifyContent="flex-end" paddingRight={2}>
<Text color="#1baf7a">
{" "}
</Text>
</Box>
</Box>
</Box>
</Box>
</Box>
{await next(e)}
</Box>
)
})
// the pane: open it with $.ui.open({ id: 'my-pane', title: "Timer" })
on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
const { Box, Text, Button, Client, Svg } = $.ui.resolve(e)
const pill = '…'
const hms = '…'
const about = '…'
const meterSvg = '…'
const unbilled = '…'
const money = '…'
const currency = '…'
const expenses = '…'
const dayName = '…'
return (
<Box flexDirection="column">
<Text bold>
{"● "}
{pill}
</Text>
<Text bold>
{hms}
</Text>
<Text>
No timer running
</Text>
<Box>
<Button label="Stop" />
<Button label="Resume last" />
<Text>
{" "}
</Text>
<Button label="Collapse" />
</Box>
<Box flexDirection="column" width="100%" marginTop={1}>
<Box width="100%" justifyContent="space-between" paddingX={1}>
<Box alignItems="center">
<Text color="#8fa3aa">
{about}
</Text>
<Text color="#8fa3aa">
{" week "}
</Text>
<Client module="./meter.tsx" width={8} height={1} />
<Svg source={`${meterSvg}`} alt="this week against the cap" width={56} height={10} />
</Box>
<Box>
<Text color="#8fa3aa">
{"Unbilled "}
</Text>
<Text bold>
{unbilled}
{" h"}
{money}
</Text>
<Text color="#8fa3aa">
{` · expenses ${currency}${expenses}`}
</Text>
</Box>
</Box>
<Box width="100%" columnGap={1}>
<Box flexDirection="column" flexGrow={1} borderStyle="round" borderColor="#2f4149">
<Box paddingX={1}>
<Text bold>
{`Today, ${dayName}`}
</Text>
</Box>
<Box paddingX={1} backgroundColor="#22333b">
<Box flexGrow={1} justifyContent="flex-end" paddingRight={2}>
<Text color="#1baf7a">
{" "}
</Text>
</Box>
<Box flexGrow={1} justifyContent="flex-end" paddingRight={2}>
<Text color="#1baf7a">
{" "}
</Text>
</Box>
<Box flexGrow={1} justifyContent="flex-end" paddingRight={2}>
<Text color="#1baf7a">
{" "}
</Text>
</Box>
</Box>
<Box paddingX={1}>
<Box flexGrow={1} justifyContent="flex-end" paddingRight={2}>
<Text color="#1baf7a">
{" "}
</Text>
</Box>
<Box flexGrow={1} justifyContent="flex-end" paddingRight={2}>
<Text color="#1baf7a">
{" "}
</Text>
</Box>
<Box flexGrow={1} justifyContent="flex-end" paddingRight={2}>
<Text color="#1baf7a">
{" "}
</Text>
</Box>
</Box>
<Box paddingX={1}>
<Box flexGrow={1} justifyContent="flex-end" paddingRight={2}>
<Text color="#1baf7a">
{" "}
</Text>
</Box>
<Box flexGrow={1} justifyContent="flex-end" paddingRight={2}>
<Text color="#1baf7a">
{" "}
</Text>
</Box>
<Box flexGrow={1} justifyContent="flex-end" paddingRight={2}>
<Text color="#1baf7a">
{" "}
</Text>
</Box>
</Box>
<Box paddingX={1}>
<Box flexGrow={1} justifyContent="flex-end" paddingRight={2}>
<Text color="#1baf7a">
{" "}
</Text>
</Box>
<Box flexGrow={1} justifyContent="flex-end" paddingRight={2}>
<Text color="#1baf7a">
{" "}
</Text>
</Box>
<Box flexGrow={1} justifyContent="flex-end" paddingRight={2}>
<Text color="#1baf7a">
{" "}
</Text>
</Box>
</Box>
</Box>
<Box flexDirection="column" flexGrow={1} borderStyle="round" borderColor="#2f4149">
<Box paddingX={1}>
<Text bold>
This week
</Text>
</Box>
<Box paddingX={1} backgroundColor="#22333b">
<Box flexGrow={1} justifyContent="flex-end" paddingRight={2}>
<Text color="#1baf7a">
{" "}
</Text>
</Box>
<Box flexGrow={1} justifyContent="flex-end" paddingRight={2}>
<Text color="#1baf7a">
{" "}
</Text>
</Box>
<Box flexGrow={1} justifyContent="flex-end" paddingRight={2}>
<Text color="#1baf7a">
{" "}
</Text>
</Box>
</Box>
<Box paddingX={1}>
<Box flexGrow={1} justifyContent="flex-end" paddingRight={2}>
<Text color="#1baf7a">
{" "}
</Text>
</Box>
<Box flexGrow={1} justifyContent="flex-end" paddingRight={2}>
<Text color="#1baf7a">
{" "}
</Text>
</Box>
<Box flexGrow={1} justifyContent="flex-end" paddingRight={2}>
<Text color="#1baf7a">
{" "}
</Text>
</Box>
</Box>
<Box paddingX={1}>
<Box flexGrow={1} justifyContent="flex-end" paddingRight={2}>
<Text color="#1baf7a">
{" "}
</Text>
</Box>
<Box flexGrow={1} justifyContent="flex-end" paddingRight={2}>
<Text color="#1baf7a">
{" "}
</Text>
</Box>
<Box flexGrow={1} justifyContent="flex-end" paddingRight={2}>
<Text color="#1baf7a">
{" "}
</Text>
</Box>
</Box>
<Box paddingX={1}>
<Box flexGrow={1} justifyContent="flex-end" paddingRight={2} />
</Box>
</Box>
</Box>
</Box>
</Box>
)
})
on('session.start', async ($, e, next) => {
const title = '…'
const when = '…'
await $.ui.toast(`No time found in that, so Claude will add it`)
await $.ui.toast(`Added: ${title}, ${when}`)
return next(e)
})
}
Mod 自身のコード
Mod のライセンス(MIT)に従って載せています。全文は下にあります。写すときは著作権表示を残してください。
hooks/desk.tsx 2372〜2380 行 · バンド
on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
const below = await next(e)
try {
return await band($, e, below)
} catch {
return below
}
})hooks/timer.tsx 829〜934 行 · バンド
async function band($: EngineInterface, e: any, below: any): Promise<any> {
{
const s = await read($, snap)
if (isUnattended || !deskOn || e.props.hasSurvey || s === null || (await read($, isHidden))) {
return below
}
const table = $.ui.resolve(e)
const { Box, Button, Text } = table
// The terminal cannot paint an SVG: it keeps a dot.
const Svg = e.surface === 'terminal' ? undefined : (table as { Svg?: any }).Svg
// surface modules run in the terminal; elsewhere the motion is an SVG that animates by itself
const Client = e.surface === 'terminal' || hasDesktopModules ? (table as { Client?: any }).Client : undefined
const v = view(s)
const run = s.running
const open = await isShown($)
const clock = run === null ? `${v.today.toFixed(2)}h` : hms(v.net)
// The stopwatch's hand points at the running second, so it ticks round
// the dial once a minute as the band redraws; at rest it points up.
const angle = run === null ? 0 : (Math.floor(v.net) % 60) * 6
const stopwatch = `<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24"><path d="M9.5 2h5M12 2v3M18.5 6.5l1.5-1.5" fill="none" stroke="${v.color}" stroke-width="2.2" stroke-linecap="round"/><circle cx="12" cy="14" r="8.5" fill="${v.color}"/><circle cx="12" cy="14" r="6.2" fill="#10181c"/><path d="M12 14V9.4" fill="none" stroke="#ffffff" stroke-width="2" stroke-linecap="round" transform="rotate(${angle} 12 14)"/><circle cx="12" cy="14" r="1.3" fill="#ffffff"/></svg>`
// Start is a green tile with a play mark, stop a red one with a square.
const tile = (fill: string, mark: string) =>
`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24"><rect x="2" y="2" width="20" height="20" rx="6" fill="${fill}"/>${mark}</svg>`
const playTile = tile('#1baf7a', '<path d="M9.5 7.2v9.6a.6.6 0 0 0 .92.5l7.2-4.8a.6.6 0 0 0 0-1l-7.2-4.8a.6.6 0 0 0-.92.5z" fill="#ffffff"/>')
const stopTile = tile('#e34948', '<rect x="7.5" y="7.5" width="9" height="9" rx="1.8" fill="#ffffff"/>')
// A chip as the desk row draws its own: the icon painted over the left of
// a button, whose label (the part that takes the click) follows it.
const iconChip = (key: string, source: string, alt: string, label: string, onPress: () => unknown) => (
<Box position="relative" alignItems="center">
<Button key={key} label={` ${label}`} onPress={onPress} />
<Box position="absolute" top={0} left={1} height="100%" alignItems="center">
<Svg source={source} alt={alt} width={20} height={20} />
</Box>
</Box>
)
// The chip at the right end of the band: the stopwatch with the arrow that
// opens the table, then start (green) or stop (red) with the clock beside
// it. Nothing appears on hover; the task is in the table the arrow opens.
const chip = (
<Box key="timer-chip" alignItems="center">
{Svg === undefined ? (
<Box alignItems="center">
<Text bold color={v.color}>
● {clock}{' '}
</Text>
{run !== null && <Button key="stop" label="■ Stop" onPress={() => pressStop($)} />}
{run === null && <Button key="resume" label="▶ Start" onPress={() => pressResume($)} />}
<Text> </Text>
<Button key="toggle" label={open ? '▾' : '▸'} onPress={() => pressToggle($)} />
</Box>
) : (
<Box alignItems="center">
{/* a breathing dot while the timer records */}
{run !== null && (
<Box marginRight={1} alignItems="center">
{Client !== undefined ? (
<Client key="timer-pulse" module="./pulse.tsx" props={{ tint: v.color }} width={1} height={1} />
) : (
<Svg source={pulseSvg(v.color, false)} alt="recording" width={12} height={12} />
)}
</Box>
)}
{iconChip('toggle', stopwatch, 'timer', open ? '▾' : '▸', () => pressToggle($))}
<Box marginLeft={1} alignItems="center">
{run !== null
? iconChip('stop', stopTile, 'stop', clock, () => pressStop($))
: iconChip('resume', playTile, 'start', clock, () => pressResume($))}
</Box>
</Box>
)}
</Box>
)
// What sits beneath (the desk row): a row, or a column of its row and a
// dropdown. The chip joins that row at the right; the rest stays below.
const isColumn = below.type !== 'engine' && (below as { props?: { flexDirection?: string } }).props?.flexDirection === 'column'
const kids = isColumn ? ((below as { children?: unknown[] }).children ?? []) : []
const left = below.type === 'engine' ? undefined : isColumn ? kids[0] : below
const rest = kids.slice(1)
const top =
left === undefined ? (
<Box width="100%" justifyContent="flex-end">
{chip}
</Box>
) : (
<Box width="100%" justifyContent="space-between" alignItems="center">
{left}
{chip}
</Box>
)
if (!open && rest.length === 0) {
return top
}
return (
<Box flexDirection="column" width="100%">
{top}
{rest}
{open && details(Box, Text, s, Math.max(3, (Number(e.props.maxRows) || 12) - 8), (Number(e.props.bodyColumns) || 96) < 84, Client, Svg)}
</Box>
)
}
}hooks/timer.tsx 706〜816 行 · バンド
function details(Box: any, Text: any, s: Snap, rows = 20, isNarrow = false, Client?: any, Svg?: any) {
const v = view(s)
const run = s.running
const top = Math.max(...s.week.map(d => d.hours), v.today, 0.01)
const today = localIso(s.nowMs, s.offset).slice(0, 10)
const cost = (hours: number) => (s.rate > 0 ? `${s.currency}${(hours * s.rate).toFixed(2)}` : '')
const todayLines: Line[] = s.today.slice(-Math.max(1, Math.min(8, rows - (s.running === null ? 1 : 2)))).map(e => ({
cells: [e.from === '' ? 'added' : `${e.from} - ${e.to}`, e.hours.toFixed(2), e.billable ? cost(e.hours) : 'call', clip(e.task, 40)],
look: e.billable ? {} : { dimColor: true },
}))
if (run !== null) {
todayLines.push({
cells: [`${run.start.slice(11, 16)} - now`, (v.net / 3600).toFixed(2), run.billable ? cost(v.net / 3600) : 'call', clip(run.task, 40)],
look: { color: v.color, bold: true },
})
}
if (todayLines.length === 0) {
todayLines.push({ cells: ['nothing logged yet', '', '', ''], look: { dimColor: true } })
}
todayLines.push({ cells: ['Total', v.today.toFixed(2), cost(v.today), ''], look: { bold: true }, bg: TOTAL_BG })
const weekLines: Line[] = s.week
// when rows are short, only the days that have hours, the latest kept
.filter(day => rows >= 8 || day.hours > 0 || day.date === today)
.slice(-Math.max(1, rows - 1))
.map(day => {
const hours = day.hours + (day.date === today ? v.live : 0)
const isToday = day.date === today
return {
cells: [dayName(day.date), hours === 0 ? '-' : hours.toFixed(2), hours === 0 ? '' : cost(hours), ''],
look: hours === 0 ? { dimColor: true } : isToday ? { bold: true, color: GREEN } : {},
bar: hours > 0 ? Math.max(1, Math.round((hours / top) * 12)) : 0,
}
})
const left = s.cap > 0 ? (v.isOver ? `over the ${s.cap} h cap` : `${Math.max(0, s.cap - v.week).toFixed(2)} h left of ${s.cap}`) : ''
weekLines.push({
cells: ['Total', v.week.toFixed(2), cost(v.week), left],
look: { bold: true, color: v.isOver ? AMBER : undefined },
bg: TOTAL_BG,
})
const idle = run !== null && run.idle > 0 ? `, idle ${hms(run.idle)} not counted` : ''
const about =
run === null
? s.last === null
? s.client
: `${s.client} · last entry ended ${s.last.end.slice(11, 16)}, ${dayName(s.last.end)}`
: `${s.client} · started ${run.start.slice(11, 16)}${idle}`
const unbilled = s.unbilledHours + v.live
return (
<Box flexDirection="column" width="100%" marginTop={1}>
<Box width="100%" justifyContent="space-between" paddingX={1}>
<Box alignItems="center">
<Text color={MUTED}>{about}</Text>
{/* the week against its cap: a bar that glides, and sweeps while the timer runs */}
{(Client !== undefined || Svg !== undefined) && s.cap > 0 && <Text color={MUTED}>{' week '}</Text>}
{Client !== undefined && s.cap > 0 && (
<Client
key="week-meter"
module="./meter.tsx"
props={{ value: v.week / s.cap, active: run !== null && run.billable, tint: v.isOver ? AMBER : GREEN }}
width={isNarrow ? 8 : 14}
height={1}
/>
)}
{Client === undefined && Svg !== undefined && s.cap > 0 && (
<Svg
source={meterSvg(v.week / s.cap, run !== null && run.billable, v.isOver ? AMBER : GREEN, isNarrow ? 56 : 98)}
alt="this week against the cap"
width={isNarrow ? 56 : 98}
height={10}
/>
)}
</Box>
<Box>
<Text color={MUTED}>Unbilled </Text>
<Text bold>
{unbilled.toFixed(2)} h{money(unbilled, s)}
</Text>
<Text color={MUTED}>
{s.unbilledFrom === '' ? '' : ` since ${dayName(s.unbilledFrom)}`}
{s.expenses > 0 ? ` · expenses ${s.currency}${s.expenses.toFixed(2)}` : ''}
</Text>
</Box>
</Box>
{isNarrow ? (
// too narrow for two cards side by side: today's, and the week as a line
<Box flexDirection="column" width="100%">
{card(Box, Text, `Today, ${dayName(today)}`, ['Time', 'Hours', 'Amount', 'Task'], todayLines.slice(-Math.max(2, rows - 1)), [14, 7, 9])}
<Box paddingX={1}>
<Text bold color={v.isOver ? AMBER : GREEN}>
This week {v.week.toFixed(2)} h{cost(v.week) === '' ? '' : ` ${cost(v.week)}`}
</Text>
<Text color={MUTED}>{left === '' ? '' : ` ${left}`}</Text>
</Box>
</Box>
) : (
<Box width="100%" columnGap={1}>
{card(Box, Text, `Today, ${dayName(today)}`, ['Time', 'Hours', 'Amount', 'Task'], todayLines, [15, 9, 11])}
{card(Box, Text, 'This week', ['Day', 'Hours', 'Amount', left === '' ? '' : 'Share'], weekLines, [13, 9, 11])}
</Box>
)}
</Box>
)
}hooks/timer.tsx 665〜702 行 · バンド
function card(Box: any, Text: any, title: string, head: string[], lines: Line[], widths: number[]) {
const cells = (line: Line, isHead: boolean) =>
line.cells.map((text, c) => {
const isNumber = c === 1 || c === 2
const look = isHead ? { bold: true, color: MUTED } : (line.look ?? {})
return (
<Box
width={widths[c]}
flexGrow={widths[c] === undefined ? 1 : 0}
justifyContent={isNumber ? 'flex-end' : 'flex-start'}
paddingRight={isNumber ? 2 : 0}
>
{line.bar !== undefined && c === line.cells.length - 1 ? (
<Text color={GREEN}>{line.bar === 0 ? ' ' : '▇'.repeat(line.bar)}</Text>
) : (
<Text {...look}>{text === '' ? ' ' : text}</Text>
)}
</Box>
)
})
return (
<Box flexDirection="column" flexGrow={1} borderStyle="round" borderColor={EDGE}>
<Box paddingX={1}>
<Text bold>{title}</Text>
</Box>
<Box paddingX={1} backgroundColor={HEAD_BG}>
{cells({ cells: head }, true)}
</Box>
{lines.map((line, r) => (
<Box paddingX={1} backgroundColor={line.bg ?? (r % 2 === 1 ? STRIPE_BG : undefined)}>
{cells(line, false)}
</Box>
))}
</Box>
)
}hooks/timer.tsx 1024〜1071 行 · ペイン
on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
const { Box, Button, Text } = $.ui.resolve(e)
const s = await read($, snap)
if (s === null) {
return <Text dimColor>No timelog in this project. /timer setup starts one.</Text>
}
const v = view(s)
const run = s.running
const wide = await read($, isOpen)
// Slim: a narrow strip on the edge of the chat. Open: the whole breakdown.
if (!wide) {
return (
<Box flexDirection="column">
<Text bold color={v.color}>
● {run === null ? 'Off' : run.billable ? 'On' : 'Call'}
</Text>
<Text bold>{hms(v.net)}</Text>
<Text dimColor>{v.today.toFixed(2)}h today</Text>
<Text dimColor>
{v.week.toFixed(1)}
{s.cap > 0 ? `/${s.cap}` : ''}h week
</Text>
{run !== null && <Button key="pane-stop" label="Stop" onPress={() => pressStop($)} />}
<Button key="expand" label="Open" onPress={() => setWide($, true)} />
</Box>
)
}
return (
<Box flexDirection="column">
<Text bold color={v.color}>
● {v.pill}
</Text>
<Text bold>{hms(v.net)}</Text>
<Text>{run === null ? 'No timer running' : run.task}</Text>
<Box>
{run !== null && <Button key="pane-stop" label="Stop" onPress={() => pressStop($)} />}
{run === null && s.last !== null && <Button key="pane-resume" label="Resume last" onPress={() => pressResume($)} />}
<Text> </Text>
<Button key="collapse" label="Collapse" onPress={() => setWide($, false)} />
</Box>
{details(Box, Text, s)}
</Box>
)
})ライセンスの全文(MIT)
MIT License Copyright (c) 2026 0NE-C0DEMAN Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
コードが呼ぶもの
プログラム起動ファイル書き込み環境変数Claude を動かすツール呼び出し保存
コードから読み取ったデザイン
読み取ったコミットのソースから描いたもので、動かした結果ではありません。一覧は 3 回描き、条件はデスクトップアプリで描く最初の分岐を取り、動かしたときにだけ決まる値は仮の例(点線の下線)にするか省きます。色と書体はこのサイトのものです。
コードから読めること
2026-10-06 に読んだコミット cd22818a1c91 のソースから。最初のまとまりが載せる条件で、残りは自分で判断するための材料です。後のコミットは、次に読むまで見ていません。
| 載せる条件: 確かめやすいコード | |
|---|---|
| 入口を読んだ | hooks/hooks.json が名指すモジュールをすべて読んだ。hooks/register.tsx |
| 解析できる | すべてのファイルが TypeScript か JavaScript として解析できる。7 ファイルを解析 |
| コードが Mod の中で完結 | import は Mod 自身のファイルかエンジンのモジュールだけ。パッケージも require もない。コードはすべて Mod の中 |
| 読める | 圧縮した行・eval・new Function・計算した道の import()・符号化した塊がない。圧縮・eval・符号化した塊なし |
| 呼び出しが見える | 通信とプログラム起動はその場で $.http.fetch・$.process.run と書き、他へ渡さない。外への呼び出しはすべてその場の $ で |
| 入れる前に自分で判断する材料 | |
| 描く場所 | コードから読んだ、描く先。ターミナル・デスクトップアプリ・両方・何も描かない(フックだけ: 見張りやプロンプトの書き換え)のどれか。出すだけで、外す理由にはしない。ターミナルとデスクトップアプリに同じように描く |
| 入れる手順 | リポジトリ自身の .claude-plugin/marketplace.json にこの Mod が載っていて、ページに書いた手順でそのマーケットプレイスから入れられるか。リポジトリの .claude-plugin/marketplace.json に載っておらず、入れる手順は出せない |
| Windows のプログラム | $.process で起動するプログラムが Windows にあるか(tail・date・open・osascript・/usr/… などは無い)。Windows にないプログラムを使わない |
| 通信 | fetch の送り先(https のホスト)がコードに書いてあるか。通信なし |
| プログラム | 起動するプログラムの名前がコードに書いてあり、シェル・インタプリタ・通信用の道具でないか。hooks/desk.tsx:1029 実行時に決まるプログラム; hooks/desk.tsx:1084 cmd(シェル・インタプリタ); hooks/timer.tsx:457 python(シェル・インタプリタ) |
| 読んで送る | ファイルや環境変数を読み、かつ通信するか。通信しない |
| ソースの鍵 | ソースに API キーや秘密鍵らしきものがあるか。ソースに鍵なし |
| ライセンス | オープンなライセンス(MIT・Apache-2.0・BSD・ISC・Unlicense・0BSD・CC0)で全文があれば、modscode にコードを載せる。違えばリンクだけ。MIT |
コードの文面を読んだだけで、安全の審査ではありません。動かしてはおらず、起動するプログラムの中で何が起きるかも見えません。入れる前の確認はあなたの役目です。 載せる条件
入れる
入れる前に、必ず自分で確かめてください。Mod はサンドボックスなしで、あなたの権限で動きます。modscode はこのコードの安全を保証しません。下のコードを読み(またはフォルダーで claude plugin validate .)、触るものを見て、読んだコミットを入れてください。
リポジトリの .claude-plugin/marketplace.json にこの Mod が載っていないため、入れる手順は出せません。コードとして読むか、作者の README に従ってください。
Claude に聞く
modscode のコネクタを入れると、Claude がこのデザイン・コードが触るもの・コードを読んで、それをもとに作れます。たとえば:
modscode のデザイン「0ne-c0deman-deskbar」をコードごと読んで、同じようなペインを作って似たデザイン
-
Claude に頼む…Notes⚠ A team of Never uses your Claude usage much faster.Showing:buildbuildbuildHide completed:buildbuildbuildSet team size:DefaultDefaultDefaultSet model:NotesNotesNotesWorkflowYour next prompt can hand work to Never Notes helpers.● Fix login · Tool agents42% AllCopy failed2h 10m● Fix login · Tool agents42% AllCopy failed2h 10m● Fix login · Tool agents42% AllCopy failed2h 10m
-
Open a file first: /crit-tui file <path>Reopen this one in the crit browser view.Claude に頼む…
-
spending-effort-with-jev: no TypeSafe API key, so effort tips are off. Set it in /plugin.⚠ effort: long run, fuzzy spec → have Claude interview you, then go maxClaude に頼む…
-
✦ explain as pick how Claude answers×3 ● build3 ● build3 ● build▸ VideoClaude に頼む…
-
Claude に頼む…Agents●●●✻ AgentsEditNo agents yet. They show here while they run.Agent──Fix login────────● build ········━━━━━━━━········2h 10m● build ········━━━━━━━━········2h 10m● build ········━━━━━━━━········2h 10m✗ Grepclick an agent to open it · click "done" to hide finished ones
-
Claude に頼む…superpowersϟ Arc tokens showing buildNot now██ FinalFinal42%:1 ✓██ FinalFinal42%:1 ✓██ FinalFinal42%:1 ✓███ brand gradient (OKLCH)Not now██ FinalFinal42%:1 ✓██ FinalFinal42%:1 ✓██ FinalFinal42%:1 ✓███ brand gradient (OKLCH)Not now██ FinalFinal42%:1 ✓██ FinalFinal42%:1 ✓██ FinalFinal42%:1 ✓███ brand gradient (OKLCH)d darkl lightz daltonizeda ansiu auto