()
| 138 | } |
| 139 | |
| 140 | function AppSettingsUpdater() { |
| 141 | const windowSettingsAtom = getSettingsPrefixAtom("window"); |
| 142 | const windowSettings = useAtomValue(windowSettingsAtom); |
| 143 | useEffect(() => { |
| 144 | const isTransparentOrBlur = |
| 145 | (windowSettings?.["window:transparent"] || windowSettings?.["window:blur"]) ?? false; |
| 146 | const opacity = util.boundNumber(windowSettings?.["window:opacity"] ?? 0.8, 0, 1); |
| 147 | const baseBgColor = windowSettings?.["window:bgcolor"]; |
| 148 | const mainDiv = document.getElementById("main"); |
| 149 | // console.log("window settings", windowSettings, isTransparentOrBlur, opacity, baseBgColor, mainDiv); |
| 150 | if (isTransparentOrBlur) { |
| 151 | mainDiv.classList.add("is-transparent"); |
| 152 | if (opacity != null) { |
| 153 | document.body.style.setProperty("--window-opacity", `${opacity}`); |
| 154 | } else { |
| 155 | document.body.style.removeProperty("--window-opacity"); |
| 156 | } |
| 157 | } else { |
| 158 | mainDiv.classList.remove("is-transparent"); |
| 159 | document.body.style.removeProperty("--window-opacity"); |
| 160 | } |
| 161 | if (baseBgColor != null) { |
| 162 | document.body.style.setProperty("--main-bg-color", baseBgColor); |
| 163 | } else { |
| 164 | document.body.style.removeProperty("--main-bg-color"); |
| 165 | } |
| 166 | }, [windowSettings]); |
| 167 | return null; |
| 168 | } |
| 169 | |
| 170 | function appFocusIn(e: FocusEvent) { |
| 171 | focusLog("focusin", getElemAsStr(e.target), "<=", getElemAsStr(e.relatedTarget)); |
nothing calls this directly
no test coverage detected