diff --git a/css_browserhook.py b/css_browserhook.py index 2c2dec2..c945536 100644 --- a/css_browserhook.py +++ b/css_browserhook.py @@ -20,7 +20,7 @@ def __init__(self, browserHook, sessionId : str, targetInfo : dict): asyncio.create_task(self._init()) async def _init(self): - res = await self.evaluate_js("(function(){ return {\"title\": document.title, \"classes\": Array.from(document.documentElement.classList)} })()") + res = await self.evaluate_js("(function(){ return {\"title\": document.title, \"classes\": Array.from(document.documentElement.classList).concat(Array.from(document.body.classList)).concat(Array.from(document.head.classList))} })()") if res != None: self.title = res["title"] @@ -472,8 +472,8 @@ async def remove(tab_name : str, css_id : str) -> Result: return Result(True) -async def commit_all(): - await asyncio.gather(*[x.commit_css_transaction() for x in HOOK.connected_tabs]) +async def commit_all(remove_all_first : bool = False): + await asyncio.gather(*[x.commit_css_transaction(remove_all_first=remove_all_first) for x in HOOK.connected_tabs]) async def remove_all(): await asyncio.gather(*[x.remove_all_css() for x in HOOK.connected_tabs]) \ No newline at end of file diff --git a/css_loader.py b/css_loader.py index 4730fc7..6c0b8be 100644 --- a/css_loader.py +++ b/css_loader.py @@ -107,12 +107,16 @@ async def set_component_of_theme_patch(self, themeName : str, patchName : str, c await commit_all() return Result(True) - async def reset(self) -> dict: + async def reset(self, silent : bool = False) -> dict: await self.lock() try: - await remove_all() - await self.load() - await commit_all() + if silent: + await self.load() + await commit_all(remove_all_first=True) + else: + await remove_all() + await self.load() + await commit_all() except Exception as e: await self.unlock() Result(False, str(e)) diff --git a/main.py b/main.py index f978b5c..207848e 100644 --- a/main.py +++ b/main.py @@ -42,7 +42,7 @@ def on_modified(self, event): if ((self.last + self.delay) < time.time() and not self.loader.busy): self.last = time.time() Log("Reloading themes due to FS event") - self.loop.create_task(self.loader.reset()) + self.loop.create_task(self.loader.reset(silent=True)) class Plugin: diff --git a/package.json b/package.json index bd8f588..1f5f463 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "SDH-CssLoader", - "version": "2.0.0", + "version": "2.0.1", "description": "A css loader", "scripts": { "build": "shx rm -rf dist && rollup -c", diff --git a/src/components/Modals/ThemeSettingsModal/ThemeSettingsModalButtons.tsx b/src/components/Modals/ThemeSettingsModal/ThemeSettingsModalButtons.tsx index 165c895..e657a18 100644 --- a/src/components/Modals/ThemeSettingsModal/ThemeSettingsModalButtons.tsx +++ b/src/components/Modals/ThemeSettingsModal/ThemeSettingsModalButtons.tsx @@ -64,7 +64,6 @@ export function ThemeSettingsModalButtons({ starred: boolean; }; if (data) { - console.log("DATA", data); setStarFetchLoaded(true); setStarred(data.starred); } diff --git a/src/components/TitleView.tsx b/src/components/TitleView.tsx index 2e13c7e..3c4fbb7 100644 --- a/src/components/TitleView.tsx +++ b/src/components/TitleView.tsx @@ -13,8 +13,6 @@ export function TitleView({ onDocsClick }: { onDocsClick?: () => {} }) { Navigation.Navigate("/cssloader/theme-manager"); }; - console.log("HEELO WUMPUS", onDocsClick); - return ( ); -} \ No newline at end of file +} diff --git a/src/pages/settings/PluginSettings.tsx b/src/pages/settings/PluginSettings.tsx index 47f1ce5..4056839 100644 --- a/src/pages/settings/PluginSettings.tsx +++ b/src/pages/settings/PluginSettings.tsx @@ -2,7 +2,7 @@ import { Focusable, ToggleField } from "decky-frontend-lib"; import { useMemo, useState, useEffect } from "react"; import { useCssLoaderState } from "../../state"; import { storeWrite } from "../../python"; -import { disableNavPatch, enableNavPatch } from "../../deckyPatches/NavPatch"; +import { setNavPatch } from "../../deckyPatches/NavPatch"; import { getWatchState, getServerState, @@ -17,11 +17,6 @@ export function PluginSettings() { const navPatchEnabled = useMemo(() => !!navPatchInstance, [navPatchInstance]); - function setNavPatch(value: boolean) { - value ? enableNavPatch() : disableNavPatch(); - storeWrite("enableNavPatch", value + ""); - } - useEffect(() => { getServerState().then((res) => { if (res.success) { @@ -40,11 +35,8 @@ export function PluginSettings() { }, []); async function setWatch(enabled: boolean) { - console.log("VALUE", enabled); await toggleWatchState(enabled, false); - console.log("TOGGLED"); const res = await getWatchState(); - console.log("RES FETCHED", res); if (res.success && res.result) setWatchOn(res.result); }