mirror of
https://github.com/vale981/tridactyl
synced 2025-03-04 17:11:40 -05:00
Fix #4256: add mode indicator to title
This commit is contained in:
parent
01a5cbfba7
commit
261ba9dfe5
1 changed files with 10 additions and 0 deletions
|
@ -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"
|
||||
: ""
|
||||
|
|
Loading…
Add table
Reference in a new issue