Skip to content
This repository was archived by the owner on May 25, 2025. It is now read-only.

Commit 9037be4

Browse files
committed
feat(identity-icon): hide Firefox label and set to Floorp in identity icon
1 parent 257e3af commit 9037be4

File tree

2 files changed

+36
-11
lines changed

2 files changed

+36
-11
lines changed

src/apps/main/core/common/designs/browser.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,3 +156,7 @@ browser[type="content"] > html {
156156
#QRCodeGeneratePageAction-image {
157157
list-style-image: url("chrome://floorp/skin/icons/floorp-share.svg");
158158
}
159+
160+
#identity-icon-label[value="Firefox"] {
161+
display: none !important;
162+
}

src/apps/main/core/static/overrides/modules/designs/index.ts

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,38 @@
55

66
export const overrides = [
77
() => {
8-
// Override the identity-icon value for replace "Firefox" with "Floorp"
9-
window.SessionStore.promiseAllWindowsRestored.then(() => {
10-
const IdentityIconLabel = document?.getElementById(
11-
"identity-icon-label",
12-
) as XULElement;
8+
const progressListener = {
9+
onLocationChange(
10+
webProgress: nsIWebProgress,
11+
request: nsIRequest,
12+
location: nsIURI,
13+
flags: number,
14+
) {
15+
window.setTimeout(() => {
16+
const IdentityIconLabel = document?.getElementById(
17+
"identity-icon-label",
18+
) as XULElement;
1319

14-
if (IdentityIconLabel) {
15-
IdentityIconLabel.setAttribute("value", "Floorp");
16-
IdentityIconLabel.textContent = "Floorp";
17-
IdentityIconLabel.setAttribute("collapsed", "false");
18-
}
19-
});
20+
if (IdentityIconLabel) {
21+
IdentityIconLabel.setAttribute("value", "Floorp");
22+
IdentityIconLabel.value = "Floorp";
23+
IdentityIconLabel.textContent = "Floorp";
24+
IdentityIconLabel.setAttribute("collapsed", "false");
25+
} else {
26+
console.log("Floorp: identity-icon label not found");
27+
}
28+
}, 20);
29+
},
30+
};
31+
32+
const filter = Cc[
33+
"@mozilla.org/appshell/component/browser-status-filter;1"
34+
].createInstance(Ci.nsIWebProgress);
35+
36+
filter.addProgressListener(progressListener, Ci.nsIWebProgress.NOTIFY_ALL);
37+
const webProgress =
38+
globalThis?.docShell?.QueryInterface?.(Ci.nsIInterfaceRequestor)
39+
?.getInterface?.(Ci.nsIWebProgress) || null;
40+
webProgress?.addProgressListener(filter, Ci.nsIWebProgress.NOTIFY_ALL);
2041
},
2142
];

0 commit comments

Comments
 (0)