From 261ba9dfe5cfa1893368eff0547f445cb214cb02 Mon Sep 17 00:00:00 2001 From: Oliver Blanthorn Date: Sun, 19 Jun 2022 15:48:15 +0200 Subject: [PATCH] Fix #4256: add mode indicator to title --- src/content.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/content.ts b/src/content.ts index ce728c68..e8b9f28f 100644 --- a/src/content.ts +++ b/src/content.ts @@ -323,15 +323,23 @@ config.getAsync("modeindicator").then(mode => { window.addEventListener("mousemove", onMouseOut) }) + async function setWindowModePrefix(mode) { + webext.browserBg.windows.update(await webext.activeWindowId(), { + titlePreface: "[ " + mode + " ] ", + }) + } + try { // On quick loading pages, the document is already loaded statusIndicator.textContent = contentState.mode || "normal" + setWindowModePrefix(contentState.mode || "normal") document.body.appendChild(statusIndicator) document.head.appendChild(style) } catch (e) { // But on slower pages we wait for the document to load window.addEventListener("DOMContentLoaded", () => { statusIndicator.textContent = contentState.mode || "normal" + setWindowModePrefix(contentState.mode || "normal") document.body.appendChild(statusIndicator) document.head.appendChild(style) }) @@ -350,6 +358,8 @@ config.getAsync("modeindicator").then(mode => { } } + setWindowModePrefix(mode) + const privateMode = browser.extension.inIncognitoContext ? "TridactylPrivate" : ""