Reads ~/.claude/projects/*.jsonl transcripts from the open WSL panes'
distros and shows per-session token counts + estimated USD cost, with a
running total in the titlebar.
Backend (src-tauri/src/usage.rs): new get_claude_usage command. For each
distro it probes $HOME once via wsl.exe, reaches the transcripts over the
\\wsl.localhost UNC share, and tallies message.usage per model per
session (summed by each line's model, since a session can switch models).
Results cached by (path,size,mtime) so polling only re-parses the file
that grew; recency-capped (30d / 50 sessions) to bound scan cost.
Windows-only; returns [] elsewhere. quiet_command made pub(crate).
Frontend: src/lib/usage.ts holds the pricing table (per-MTok rates,
matched by model-family substring) + cost/format helpers, so rates are
editable without recompiling Rust. UsagePanel.tsx mirrors the MCP panel
modal; rows whose transcript cwd matches an open pane are highlighted
with a [pane: label] tag. App polls every 20s (visible windows) for the
titlebar 💰 total and every 5s while the panel is open. Ctrl+Shift+U
opens it; added to shortcuts.ts + regenerated README.
tsc clean. Rust builds on the Windows host; needs runtime verification.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
187 lines
6.8 KiB
TypeScript
187 lines
6.8 KiB
TypeScript
/**
|
|
* Single source of truth for the keyboard shortcuts and inline tips shown
|
|
* in the help overlay. README has a hand-maintained shortcut table that
|
|
* mirrors this — keep them in sync until/unless we generate one from the
|
|
* other.
|
|
*/
|
|
|
|
export interface ShortcutSpec {
|
|
/** Display string for the key combo, e.g. "Ctrl+Shift+E". */
|
|
keys: string;
|
|
description: string;
|
|
}
|
|
|
|
export interface ShortcutSection {
|
|
title: string;
|
|
items: ShortcutSpec[];
|
|
}
|
|
|
|
export const SHORTCUT_SECTIONS: ShortcutSection[] = [
|
|
{
|
|
title: "Layout",
|
|
items: [
|
|
{ keys: "Ctrl+Shift+E", description: "Split active pane to the right" },
|
|
{ keys: "Ctrl+Shift+O", description: "Split active pane downward" },
|
|
{ keys: "Ctrl+Shift+W", description: "Close active pane" },
|
|
{
|
|
keys: "Ctrl+Shift+P",
|
|
description:
|
|
"Promote active pane out one level (turns a nested pane into a full row/column; self-inverse)",
|
|
},
|
|
],
|
|
},
|
|
{
|
|
title: "Tabs",
|
|
items: [
|
|
{ keys: "Ctrl+T", description: "New tab (blank workspace, one pane)" },
|
|
{
|
|
keys: "Ctrl+Shift+T",
|
|
description: "Close current tab (confirms when the tab has live panes)",
|
|
},
|
|
{
|
|
keys: "Ctrl+PageDown / Ctrl+PageUp",
|
|
description: "Switch to next / previous tab",
|
|
},
|
|
{ keys: "Ctrl+1 … Ctrl+9", description: "Switch to tab 1 … 9" },
|
|
],
|
|
},
|
|
{
|
|
title: "Multi-window",
|
|
items: [
|
|
{
|
|
keys: "Right-click pane toolbar → Move to new window",
|
|
description:
|
|
"Pop the active pane into a fresh tiletopia window (PTY survives the move; scrollback ring replays)",
|
|
},
|
|
{
|
|
keys: "Drag pane toolbar past the window edge",
|
|
description:
|
|
"Same as the right-click action — release the drag well outside the window to detach into a new window",
|
|
},
|
|
],
|
|
},
|
|
{
|
|
title: "Navigation",
|
|
items: [
|
|
{ keys: "Ctrl+K", description: "Open jump-to-pane palette" },
|
|
{
|
|
keys: "Ctrl+Shift+← / → / ↑ / ↓",
|
|
description:
|
|
"Focus neighbour pane in that direction (window-level — works even when no terminal is focused)",
|
|
},
|
|
{
|
|
keys: "Ctrl+Alt+← / → / ↑ / ↓",
|
|
description:
|
|
"Focus neighbour pane in that direction (from inside the terminal — intercepted before the PTY sees it)",
|
|
},
|
|
{
|
|
keys: "Ctrl+Alt+H / J / K / L",
|
|
description:
|
|
"Same as Ctrl+Alt+Arrow but in Vim-style HJKL order (left / down / up / right)",
|
|
},
|
|
{
|
|
keys: "Alt+1 … Alt+9",
|
|
description:
|
|
"Focus the Nth pane in layout order (DFS: left-to-right, top-to-bottom); clamped to pane count. Note: swallows bare Alt+digit — shells using readline digit-argument or vim buffer-jump may conflict.",
|
|
},
|
|
],
|
|
},
|
|
{
|
|
title: "Broadcast",
|
|
items: [
|
|
{ keys: "Ctrl+Shift+B", description: "Toggle broadcast on active pane" },
|
|
{
|
|
keys: "Ctrl+Shift+Alt+B",
|
|
description: "Toggle broadcast on ALL panes (same as titlebar 📡)",
|
|
},
|
|
],
|
|
},
|
|
{
|
|
title: "Font size",
|
|
items: [
|
|
{
|
|
keys: "Ctrl+= / Ctrl+- / Ctrl+0",
|
|
description: "Zoom active pane in / out / reset",
|
|
},
|
|
{
|
|
keys: "Ctrl+Shift+= / Ctrl+Shift+- / Ctrl+Shift+0",
|
|
description: "Same, applied to every pane",
|
|
},
|
|
],
|
|
},
|
|
{
|
|
title: "Terminal",
|
|
items: [
|
|
{
|
|
keys: "Ctrl+Shift+C / Ctrl+Shift+V",
|
|
description: "Copy selection / paste in terminal",
|
|
},
|
|
{
|
|
keys: "Ctrl+Shift+F",
|
|
description: "Open find-in-scrollback bar for the focused pane",
|
|
},
|
|
{
|
|
keys: "Enter / Shift+Enter",
|
|
description: "Next / previous match (while search bar is focused)",
|
|
},
|
|
{
|
|
keys: "Escape",
|
|
description: "Close find bar and return focus to terminal",
|
|
},
|
|
],
|
|
},
|
|
{
|
|
title: "Panels",
|
|
items: [
|
|
{
|
|
keys: "Ctrl+Shift+U",
|
|
description:
|
|
"Open the usage panel — per-session claude token counts + estimated cost for the open WSL panes",
|
|
},
|
|
],
|
|
},
|
|
{
|
|
title: "Help",
|
|
items: [{ keys: "F1", description: "Show this help overlay" }],
|
|
},
|
|
];
|
|
|
|
export interface TipSpec {
|
|
title: string;
|
|
body: string;
|
|
}
|
|
|
|
export const TIPS: TipSpec[] = [
|
|
{
|
|
title: "Per-pane shell picker",
|
|
body: "Click the distro chip in any pane's toolbar to switch between WSL distros, PowerShell, or a saved SSH host. The pane respawns with the new shell.",
|
|
},
|
|
{
|
|
title: "SSH host manager",
|
|
body: "Titlebar 🔑 SSH hosts opens the manager. Add hostname / user / port / identity file / jump host / extra ssh args. Saved hosts appear in every pane's dropdown.",
|
|
},
|
|
{
|
|
title: "Saved passwords",
|
|
body: "Optionally save a host's password — stored in Windows Credential Manager (DPAPI-encrypted), never written to hosts.json. When ssh prompts on connect it's typed automatically. Hosts with a saved password show 🔒 in the list.",
|
|
},
|
|
{
|
|
title: "Clickable links",
|
|
body: "http and https URLs in terminal output get underlined and open in your default browser on click.",
|
|
},
|
|
{
|
|
title: "Drag pane headers to swap or detach",
|
|
body: "Grab a pane's title bar and drag onto another pane to swap their tree positions. Drag well outside the window edge (more than ~60px past) and release to detach the pane into a new window — same mechanism as the right-click 'Move to new window' action, PTY stays alive.",
|
|
},
|
|
{
|
|
title: "Workspace persistence",
|
|
body: "Layout, labels, distro choices, and SSH hosts auto-save to %APPDATA%/com.megaproxy.tiletopia (debounced 500ms). Closed panes don't come back — only the structure is restored, shells spawn fresh on next launch.",
|
|
},
|
|
{
|
|
title: "Tabs (workspaces)",
|
|
body: "Each tab is an independent tile layout — useful for keeping one tab per project. PTYs in non-active tabs keep running (a Claude session in tab A keeps going while you work in tab B). New tab starts with one default-shell pane; close confirms when the tab has live panes. Tabs auto-save to the same workspace.json.",
|
|
},
|
|
{
|
|
title: "MCP server (let Claude drive the workspace)",
|
|
body: "Titlebar 🤖 opens the MCP control panel. Start the server, then for Claude Desktop click 'Download .mcpb' and drag the file into Settings → Extensions — zero-config because the bundle reads your bearer token from %APPDATA% at launch (no copy-paste, survives token rotation). For Claude Code (terminal CLI) use the fallback snippet in the panel: it wires npx mcp-remote as a stdio shim because Claude Code's HTTP-MCP client ignores static bearer auth and tries OAuth instead. URL + token persist across restarts; Regenerate the token in the panel if it leaks. Default-deny per pane: toggle 🤖 on each pane's toolbar to expose it to MCP.",
|
|
},
|
|
];
|