Skip to content

Commit 7aad0b1

Browse files
ralyodioclaude
andcommitted
fix(desktop): show the feed on startup, not a blank page
The ai-sidebar extension overrides the New Tab page with the feed (chrome_url_overrides.newtab), but that only applies to newly opened tabs. On a fresh launch the launcher spawned Chromium with no URL, so the first window showed a blank/default page and the feed only appeared after opening a new tab. launch() now defaults the startup URL to chrome://newtab/ (resolveStartUrls) when no URLs are supplied, so the feed shows immediately. Explicit URLs are unchanged. 3 unit tests. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent d4265cb commit 7aad0b1

2 files changed

Lines changed: 35 additions & 1 deletion

File tree

‎apps/desktop/src/launcher.test.ts‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { describe, it, expect } from 'vitest';
2+
import { resolveStartUrls, DEFAULT_START_URL } from './launcher.js';
3+
4+
describe('resolveStartUrls', () => {
5+
it('opens the feed (new tab page) when no URLs are given', () => {
6+
expect(resolveStartUrls()).toEqual([DEFAULT_START_URL]);
7+
expect(resolveStartUrls([])).toEqual([DEFAULT_START_URL]);
8+
});
9+
10+
it('respects explicit URLs when provided', () => {
11+
expect(resolveStartUrls(['https://example.com'])).toEqual(['https://example.com']);
12+
expect(resolveStartUrls(['https://a.com', 'https://b.com'])).toEqual([
13+
'https://a.com',
14+
'https://b.com',
15+
]);
16+
});
17+
18+
it('defaults to the extension-overridden new tab page', () => {
19+
expect(DEFAULT_START_URL).toBe('chrome://newtab/');
20+
});
21+
});

‎apps/desktop/src/launcher.ts‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,23 @@ export interface LaunchConfig extends LaunchOptions {
1515
urls?: string[];
1616
}
1717

18+
/**
19+
* The page shown on a fresh launch when no URLs are given: the extension-
20+
* overridden New Tab page (the TronBrowser feed). Without an explicit startup
21+
* URL, Chromium opens a blank/default page, so the `chrome_url_overrides` newtab
22+
* feed only appears once the user opens a *new* tab — we open it on startup.
23+
*/
24+
export const DEFAULT_START_URL = 'chrome://newtab/';
25+
26+
/** Resolves the URLs to open, defaulting to the feed when none are supplied. */
27+
export function resolveStartUrls(urls?: string[]): string[] {
28+
return urls && urls.length > 0 ? urls : [DEFAULT_START_URL];
29+
}
30+
1831
/** Launches the browser process with privacy flags enforced. */
1932
export function launch(config: LaunchConfig): ChildProcess {
2033
const binary = resolveBinaryPath(config.outDir, config.platform);
2134
const flags = buildLaunchFlags(config);
22-
const args = [...flags, ...(config.urls ?? [])];
35+
const args = [...flags, ...resolveStartUrls(config.urls)];
2336
return spawn(binary, args, { stdio: 'inherit' });
2437
}

0 commit comments

Comments
 (0)