diff options
Diffstat (limited to 'backend')
| -rw-r--r-- | backend/browser.py | 20 | ||||
| -rw-r--r-- | backend/injector.py | 3 | ||||
| -rw-r--r-- | backend/locales/en-US.json | 9 | ||||
| -rw-r--r-- | backend/settings.py | 2 |
4 files changed, 28 insertions, 6 deletions
diff --git a/backend/browser.py b/backend/browser.py index 388a01e3..ab71a89d 100644 --- a/backend/browser.py +++ b/backend/browser.py @@ -122,10 +122,7 @@ class PluginBrowser: logger.debug("Plugin %s was stopped", name) del self.plugins[name] logger.debug("Plugin %s was removed from the dictionary", name) - current_plugin_order = self.settings.getSetting("pluginOrder") - current_plugin_order.remove(name) - self.settings.setSetting("pluginOrder", current_plugin_order) - logger.debug("Plugin %s was removed from the pluginOrder setting", name) + self.cleanup_plugin_settings(name) logger.debug("removing files %s" % str(name)) rmtree(plugin_dir) except FileNotFoundError: @@ -234,3 +231,18 @@ class PluginBrowser: def cancel_plugin_install(self, request_id): self.install_requests.pop(request_id) + + def cleanup_plugin_settings(self, name): + """Removes any settings related to a plugin. Propably called when a plugin is uninstalled. + + Args: + name (string): The name of the plugin + """ + hidden_plugins = self.settings.getSetting("hiddenPlugins", []) + hidden_plugins.remove(name) + self.settings.setSetting("hiddenPlugins", hidden_plugins) + + plugin_order = self.settings.getSetting("pluginOrder") + plugin_order.remove(name) + self.settings.setSetting("pluginOrder", plugin_order) + logger.debug("Removed any settings for plugin %s", name) diff --git a/backend/injector.py b/backend/injector.py index b28a0349..e3414fee 100644 --- a/backend/injector.py +++ b/backend/injector.py @@ -395,6 +395,7 @@ async def get_tab_lambda(test) -> Tab: return tab SHARED_CTX_NAMES = ["SharedJSContext", "Steam Shared Context presented by Valveā¢", "Steam", "SP"] +CLOSEABLE_URLS = ["about:blank", "data:text/html,%3Cbody%3E%3C%2Fbody%3E"] # Closing anything other than these *really* likes to crash Steam DO_NOT_CLOSE_URL = "Valve Steam Gamepad/default" # Steam Big Picture Mode tab def tab_is_gamepadui(t: Tab) -> bool: @@ -415,7 +416,7 @@ async def inject_to_tab(tab_name, js, run_async=False): async def close_old_tabs(): tabs = await get_tabs() for t in tabs: - if not t.title or (t.title not in SHARED_CTX_NAMES and DO_NOT_CLOSE_URL not in t.url): + if not t.title or (t.title not in SHARED_CTX_NAMES and any(url in t.url for url in CLOSEABLE_URLS) and DO_NOT_CLOSE_URL not in t.url): logger.debug("Closing tab: " + getattr(t, "title", "Untitled")) await t.close() await sleep(0.5) diff --git a/backend/locales/en-US.json b/backend/locales/en-US.json index a347351b..b5c32957 100644 --- a/backend/locales/en-US.json +++ b/backend/locales/en-US.json @@ -17,6 +17,13 @@ "select": "Use this folder" } }, + "PluginView": { + "hidden_one": "1 plugin is hidden from this list", + "hidden_other": "{{count}} plugins are hidden from this list" + }, + "PluginListLabel": { + "hidden": "Hidden from the quick access menu" + }, "PluginCard": { "plugin_full_access": "This plugin has full access to your Steam Deck.", "plugin_install": "Install", @@ -73,6 +80,8 @@ "reload": "Reload", "uninstall": "Uninstall", "update_to": "Update to {{name}}", + "show": "Quick access: Show", + "hide": "Quick access: Hide", "update_all_one": "Update 1 plugin", "update_all_other": "Update {{count}} plugins" }, diff --git a/backend/settings.py b/backend/settings.py index d54ff2b5..c00e6a82 100644 --- a/backend/settings.py +++ b/backend/settings.py @@ -22,7 +22,7 @@ class SettingsManager: for file in listdir(wrong_dir): if file.endswith(".json"): rename(path.join(wrong_dir,file), - path.join(settings_directory, file)) + path.join(settings_directory, file)) self.path = path.join(settings_directory, name + ".json") |
