Skip to content

Commit 71e7862

Browse files
committed
[frontend] use search icon instead of google.com favicon
1 parent c5ca17d commit 71e7862

File tree

2 files changed

+17
-13
lines changed

2 files changed

+17
-13
lines changed

frontend/src/Browser.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ export class Browser extends StatefulClass {
8787
let tab = this.newTab();
8888
tab.deserialize(detab);
8989
}
90-
this.activetab = this.tabs.find((t) => t.id == de.activetab)!;
90+
this.activetab = this.tabs[0];
91+
// this.activetab = this.tabs.find((t) => t.id == de.activetab)!;
9192
console.log(this.activetab, this.activetab.url);
9293
}
9394

@@ -114,7 +115,8 @@ export class Browser extends StatefulClass {
114115
this.tabs = this.tabs.filter((t) => t !== tab);
115116
console.log(this.tabs);
116117
if (this.activetab === tab) {
117-
this.activetab = this.tabs[0] || this.newTab();
118+
this.activetab =
119+
this.tabs[0] || browser.newTab(new URL("puter://newtab"), true);
118120
}
119121
popTab(tab);
120122
}

frontend/src/components/Omnibox.tsx

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { browser, scramjet } from "../main";
1212
import { IconButton } from "./IconButton";
1313
import { createDelegate, type Delegate } from "dreamland/core";
1414
import type { Tab } from "../Tab";
15+
import { Icon } from "./Icon";
1516

1617
export const focusOmnibox = createDelegate<void>();
1718

@@ -115,7 +116,6 @@ export const UrlInput: Component<
115116
url: new URL(
116117
`https://www.google.com/search?q=${encodeURIComponent(item)}`
117118
),
118-
favicon: scramjet.encodeUrl("https://www.google.com/favicon.ico"),
119119
});
120120
}
121121

@@ -189,11 +189,15 @@ export const UrlInput: Component<
189189
(i) => i - 1 === this.overflowItems.indexOf(item)
190190
)}
191191
>
192-
<img
193-
class="favicon"
194-
src={item.favicon || "/vite.svg"}
195-
alt="favicon"
196-
/>
192+
{item.kind === "search" ? (
193+
<Icon icon={iconSearch}></Icon>
194+
) : (
195+
<img
196+
class="favicon"
197+
src={item.favicon || "/vite.svg"}
198+
alt="favicon"
199+
/>
200+
)}
197201
{(item.title && (
198202
<span class="description">
199203
{item.title.startsWith(this.input.value) ? (
@@ -404,21 +408,19 @@ export const Omnibox: Component<{
404408
{
405409
label: "History",
406410
action: () => {
407-
let t = browser.newTab(new URL("puter://history"));
411+
browser.newTab(new URL("puter://history"));
408412
},
409413
},
410414
{
411415
label: "Settings",
412416
action: () => {
413-
let t = browser.newTab();
414-
t.replaceNavigate(new URL("puter://settings"));
417+
browser.newTab(new URL("puter://settings"));
415418
},
416419
},
417420
{
418421
label: "About",
419422
action: () => {
420-
let t = browser.newTab();
421-
t.replaceNavigate(new URL("puter://version"));
423+
browser.newTab(new URL("puter://version"));
422424
},
423425
},
424426
]);

0 commit comments

Comments
 (0)