Skip to content

An agentic browser harness: an AI side panel & orb in your own logged-in Chrome, Edge, Arc, Brave or even Firefox run by the agent/subscription you already use (Claude Code, Codex, Antigravity). Free, open source, no API key. Also an MCP server.

feat(extension): the settings page's Appearance becomes Extension — the theme, then what belongs to this browser alone: the right-click items, the keyboard shortcuts and hold to talk

Shahriar47597a84d865
diff --git a/src/extension/components/extension-settings.tsx b/src/extension/components/extension-settings.tsx
new file mode 100644
index 0000000..1fb07f1
--- /dev/null
+++ b/src/extension/components/extension-settings.tsx
@@ -0,0 +1,137 @@
+import type { ReactNode } from 'react';
+import { ExternalLink } from 'lucide-react';
+
+import { Button } from '@/extension/components/ui/button';
+import { Switch } from '@/extension/components/ui/switch';
+import { HANDS_FREE_SHORTCUT } from '@/lib/settings/shortcuts';
+import { openShortcutSettings, useContextMenuChoice, usePushToTalk, useShortcuts } from '@/lib/bridge/use-extension-settings';
+import { useHandsFreeSupported } from '@/lib/bridge/use-speech';
+import { cn } from '@/lib/utils';
+
+/** What belongs to this browser alone: where Browsentic shows up in it, and how it is reached from the keyboard. */
+export function ExtensionSettings() {
+ const handsFree = useHandsFreeSupported();
+ return (
+ <>
+ <ContextMenuItems handsFree={handsFree} />
+ <KeyboardShortcuts handsFree={handsFree} />
+ {handsFree && <HandsFree />}
+ </>
+ );
+}
+
+function ContextMenuItems({ handsFree }: { handsFree: boolean }) {
+ const [choice, setChoice] = useContextMenuChoice();
+ return (
+ <SettingsGroup
+ title="Right-click menu"
+ note="What a right-click anywhere on a page offers. With more than one item on, the browser gathers them under Browsentic."
+ >
+ <Row title="Open Browsentic" note="Opens the side panel, or closes it while it is open.">
+ <Switch
+ checked={choice.panel}
+ label="Show Open Browsentic in the right-click menu"
+ onChange={(panel) => setChoice({ ...choice, panel })}
+ />
+ </Row>
+ {handsFree && (
+ <Row
+ title="Open Browsentic (Hands Free)"
+ note="Puts the mic on the page instead of the panel, or takes it away while it is there."
+ >
+ <Switch
+ checked={choice.handsFree}
+ label="Show Open Browsentic (Hands Free) in the right-click menu"
+ onChange={(on) => setChoice({ ...choice, handsFree: on })}
+ />
+ </Row>
+ )}
+ </SettingsGroup>
+ );
+}
+
+function KeyboardShortcuts({ handsFree }: { handsFree: boolean }) {
+ const shortcuts = useShortcuts()?.filter(({ name }) => handsFree || name !== HANDS_FREE_SHORTCUT);
+ return (
+ <SettingsGroup
+ title="Keyboard shortcuts"
+ note="The browser keeps these keys, not Browsentic: it hands out the suggested ones unless something else already has them, and changes them on its own shortcuts page."
+ >
+ {shortcuts === undefined ? (
+ <Row title="Reading the shortcuts…" />
+ ) : (
+ shortcuts.map(({ name, label, keys }) => (
+ <Row key={name} title={label}>
+ {keys.length ? (
+ <span className="flex gap-1">
+ {keys.map((key, index) => (
+ <kbd
+ key={index}
+ className="min-w-6 rounded-md border border-line-strong bg-surface px-1.5 py-0.5 text-center text-xs font-medium text-ink-dim"
+ >
+ {key}
+ </kbd>
+ ))}
+ </span>
+ ) : (
+ <span className="font-mono text-[10px] tracking-[0.1em] text-ink-faint uppercase">Not set</span>
+ )}
+ </Row>
+ ))
+ )}
+ <div className="px-4 py-3">
+ <Button variant="outline" size="sm" onClick={openShortcutSettings}>
+ <ExternalLink /> Change shortcuts
+ </Button>
+ </div>
+ </SettingsGroup>
+ );
+}
+
+function HandsFree() {
+ const [pushToTalk, setPushToTalk] = usePushToTalk();
+ return (
+ <SettingsGroup title="Hands-free" note="How the mic on the page listens. Its own menu switches the same setting.">
+ <Row
+ title="Hold to talk"
+ note="The mic listens only while you hold left Control — control on a Mac — and sends what you said the moment you let go."
+ >
+ <Switch checked={pushToTalk} label="Hold to talk" onChange={setPushToTalk} />
+ </Row>
+ </SettingsGroup>
+ );
+}
+
+export function SettingsGroup({
+ title,
+ note,
+ card = true,
+ children,
+}: {
+ title: string;
+ note?: string;
+ card?: boolean;
+ children: ReactNode;
+}) {
+ return (
+ <section className="space-y-2.5">
+ <header className="space-y-1">
+ <h3 className="font-mono text-[10px] tracking-[0.14em] text-ink-faint uppercase">{title}</h3>
+ {note && <p className="text-xs leading-relaxed text-ink-faint">{note}</p>}
+ </header>
+ {card ? <div className="panel-card divide-y divide-line overflow-hidden rounded-xl">{children}</div> : children}
+ </section>
+ );
+}
+
+function Row({ title, note, children }: { title: string; note?: string; children?: ReactNode }) {
+ return (
+ <div className={cn('flex gap-6 px-4 py-3.5', note ? 'items-start' : 'items-center')}>
+ <div className="min-w-0 flex-1">
+ <p className="text-sm font-medium text-ink">{title}</p>
+ {note && <p className="mt-0.5 text-xs leading-relaxed text-ink-faint">{note}</p>}
+ </div>
+ {children && <div className="flex shrink-0 items-center pt-0.5">{children}</div>}
+ </div>
+ );
+}
diff --git a/src/extension/entrypoints/options/App.tsx b/src/extension/entrypoints/options/App.tsx
index a04d39a..90c60ce 100644
--- a/src/extension/entrypoints/options/App.tsx
+++ b/src/extension/entrypoints/options/App.tsx
@@ -1,10 +1,11 @@
import { useEffect, useState, type ReactNode } from 'react';
-import { Link2, Palette, ShieldCheck, Sparkles, type LucideIcon } from 'lucide-react';
+import { Link2, Puzzle, ShieldCheck, Sparkles, type LucideIcon } from 'lucide-react';
import { browser } from 'wxt/browser';
import { AgentPicker } from '@/extension/components/agent-picker';
import { Wordmark } from '@/extension/components/brand';
import { DaemonLink } from '@/extension/components/daemon-link';
+import { ExtensionSettings, SettingsGroup } from '@/extension/components/extension-settings';
import { GuardrailSettings } from '@/extension/components/guardrail-settings';
import { StatusPill, describeStatus } from '@/extension/components/status-pill';
import { ThemePicker } from '@/extension/components/theme-picker';
@@ -12,14 +13,14 @@ import { useDaemonState } from '@/lib/bridge/use-daemon-state';
import { useTheme } from '@/lib/bridge/use-theme';
import { cn } from '@/lib/utils';
-type SectionId = 'appearance' | 'guardrails' | 'agent' | 'connection';
+type SectionId = 'extension' | 'guardrails' | 'agent' | 'connection';
const SECTIONS: { id: SectionId; label: string; icon: LucideIcon; blurb: string }[] = [
{
- id: 'appearance',
- label: 'Appearance',
- icon: Palette,
- blurb: 'How the side panel, the popup and this page look. Every paired browser follows the same choice, and the desktop app can change it too.',
+ id: 'extension',
+ label: 'Extension',
+ icon: Puzzle,
+ blurb: 'How the extension looks and how you reach it. Every paired browser and the desktop app share the look; the right-click menu, the shortcuts and the rest belong to this browser.',
},
{
id: 'guardrails',
@@ -45,7 +46,7 @@ const isSection = (value: string): value is SectionId => SECTIONS.some((section)
function readSection(): SectionId {
const id = window.location.hash.slice(1);
- return isSection(id) ? id : 'appearance';
+ return isSection(id) ? id : 'extension';
}
function useSection(): SectionId {
@@ -115,8 +116,8 @@ export default function App() {
<p className="text-sm leading-relaxed text-ink-dim">{current.blurb}</p>
</header>
<div key={section} className="enters mt-8">
- {section === 'appearance' ? (
- <Appearance />
+ {section === 'extension' ? (
+ <Extension />
) : section === 'guardrails' ? (
<GuardrailSettings />
) : section === 'agent' ? (
@@ -131,18 +132,24 @@ export default function App() {
);
}
-function Appearance() {
+function Extension() {
const [theme, setTheme] = useTheme();
const daemon = useDaemonState();
return (
- <div className="space-y-4">
- <ThemePicker theme={theme} onSelect={setTheme} />
- <p className="text-xs leading-relaxed text-ink-faint">
- {daemon?.connected
- ? 'Kept in the daemon’s config, so every paired browser and the desktop app see the change at once.'
- : 'Kept in this browser for now, and handed to the daemon the next time it connects.'}
- </p>
+ <div className="space-y-8">
+ <SettingsGroup
+ title="Appearance"
+ card={false}
+ note={
+ daemon?.connected
+ ? 'Kept in the daemon’s config, so every paired browser and the desktop app see the change at once.'
+ : 'Kept in this browser for now, and handed to the daemon the next time it connects.'
+ }
+ >
+ <ThemePicker theme={theme} onSelect={setTheme} />
+ </SettingsGroup>
+ <ExtensionSettings />
</div>
);
}
diff --git a/src/lib/bridge/hands-free.ts b/src/lib/bridge/hands-free.ts
index 4447297..95d0d42 100644
--- a/src/lib/bridge/hands-free.ts
+++ b/src/lib/bridge/hands-free.ts
@@ -20,7 +20,7 @@ import {
import { pickFocusIn } from './aeye';
import { putBytes } from './file-store';
import { openMicPermissionPage } from './mic-permission';
-import { HANDS_FREE_KEY, endHandsFree, readHandsFree, writeHandsFree, type HandsFreeState } from './panel-view';
+import { HANDS_FREE_KEY, PUSH_TO_TALK_KEY, endHandsFree, readHandsFree, writeHandsFree, type HandsFreeState } from './panel-view';
import { attachFile, closePanels, onPanelPresence, onTurnSettled, runCommand } from './run-port';
import { openSidePanel } from './side-panel';
import { TAB_SESSIONS_KEY, readTabSessions, type PendingApproval, type TabAnchor, type TabSession } from './tab-sessions';
@@ -30,7 +30,6 @@ import { showToast } from './toast';
import { DAEMON_STATE_KEY, type DaemonState } from './socket';
export const ORB_POSITION_KEY = 'browsentic/orbPosition';
-export const PUSH_TO_TALK_KEY = 'browsentic/pushToTalk';
const DICTATION_KEY = 'browsentic/dictation';
/** Approvals already announced elsewhere, kept where a revived worker still finds them. */
const ANNOUNCED_KEY = 'browsentic/approvalsAnnounced';
diff --git a/src/lib/bridge/panel-view.ts b/src/lib/bridge/panel-view.ts
index 25b96df..96a531f 100644
--- a/src/lib/bridge/panel-view.ts
+++ b/src/lib/bridge/panel-view.ts
@@ -33,7 +33,10 @@ export function writeHandsFree(state: HandsFreeState | null): Promise<void> {
: browser.storage.session.remove(HANDS_FREE_KEY);
}
-export const startHandsFree = (): Promise<void> => writeHandsFree({ muted: false, since: Date.now() });
+/** Hold to talk: the orb listens only while left Control is held. Kept across restarts, unlike hands-free itself. */
+export const PUSH_TO_TALK_KEY = 'browsentic/pushToTalk';
+
+export const startHandsFree =(): Promise<void> => writeHandsFree({ muted: false, since: Date.now() });
export const endHandsFree = (): Promise<void> => writeHandsFree(null);
diff --git a/src/lib/bridge/use-extension-settings.ts b/src/lib/bridge/use-extension-settings.ts
new file mode 100644
index 0000000..d7da87c
--- /dev/null
+++ b/src/lib/bridge/use-extension-settings.ts
@@ -0,0 +1,75 @@
+import { useCallback, useEffect, useState } from 'react';
+import { browser } from 'wxt/browser';
+import { shortcutsOf, shortcutsPageFor, type Shortcut } from '@/lib/settings/shortcuts';
+import { CONTEXT_MENU_KEY, asContextMenuChoice, type ContextMenuChoice } from './context-menu';
+import { brandFrom } from './identity';
+import { PUSH_TO_TALK_KEY } from './panel-view';
+
+function useLocalSetting<T>(key: string, parse: (value: unknown) => T): [T, (next: T) => void] {
+ const [value, setValue] = useState(() => parse(undefined));
+
+ useEffect(() => {
+ let live = true;
+ void browser.storage.local.get(key).then((stored) => {
+ if (live) setValue(parse(stored[key]));
+ });
+ const listener = (changes: Record<string, { newValue?: unknown }>) => {
+ if (key in changes) setValue(parse(changes[key].newValue));
+ };
+ browser.storage.local.onChanged.addListener(listener);
+ return () => {
+ live = false;
+ browser.storage.local.onChanged.removeListener(listener);
+ };
+ }, [key, parse]);
+
+ const write = useCallback(
+ (next: T) => {
+ setValue(next);
+ void browser.storage.local.set({ [key]: next });
+ },
+ [key],
+ );
+
+ return [value, write];
+}
+
+const isOn = (value: unknown): boolean => value === true;
+
+export const useContextMenuChoice = (): [ContextMenuChoice, (next: ContextMenuChoice) => void] =>
+ useLocalSetting(CONTEXT_MENU_KEY, asContextMenuChoice);
+
+export const usePushToTalk = (): [boolean, (on: boolean) => void] => useLocalSetting(PUSH_TO_TALK_KEY, isOn);
+
+/** Read again whenever this page comes back into view, since the keys are changed on the browser's own page. */
+export function useShortcuts(): Shortcut[] | null {
+ const [shortcuts, setShortcuts] = useState<Shortcut[] | null>(null);
+
+ useEffect(() => {
+ let live = true;
+ const read = () =>
+ void browser.commands
+ .getAll()
+ .then((commands) => live && setShortcuts(shortcutsOf(commands)))
+ .catch(() => live && setShortcuts([]));
+ read();
+ window.addEventListener('focus', read);
+ document.addEventListener('visibilitychange', read);
+ return () => {
+ live = false;
+ window.removeEventListener('focus', read);
+ document.removeEventListener('visibilitychange', read);
+ };
+ }, []);
+
+ return shortcuts;
+}
+
+export function openShortcutSettings(): void {
+ if (import.meta.env.FIREFOX) {
+ void (browser.commands as unknown as { openShortcutSettings: () => Promise<void> }).openShortcutSettings();
+ return;
+ }
+ const agent = navigator as Navigator & { userAgentData?: { brands?: { brand: string }[] } };
+ void browser.tabs.create({ url: shortcutsPageFor(brandFrom(agent.userAgentData?.brands ?? [])) });
+}