From 974e318a2405ee8d5afe668690e0193b21359e0d Mon Sep 17 00:00:00 2001 From: Luis Bocanegra Date: Fri, 22 Mar 2024 02:09:41 -0600 Subject: [PATCH] Don't apply delay to non-screenshot method --- src/kde_material_you_colors/main.py | 5 ++--- src/kde_material_you_colors/utils/wallpaper_utils.py | 12 ++++++++---- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/kde_material_you_colors/main.py b/src/kde_material_you_colors/main.py index f2cabc8..4a55abc 100755 --- a/src/kde_material_you_colors/main.py +++ b/src/kde_material_you_colors/main.py @@ -398,9 +398,8 @@ def main(): # # # update wallpaper - if counter == 0: - wallpaper.update(config) - wallpaper_watcher.set_value(wallpaper.current) + wallpaper.update(config, skip_screenshot=counter != 0) + wallpaper_watcher.set_value(wallpaper.current) target_cycles = config.read("screenshot_delay") / ( config.read("main_loop_delay") or 1 diff --git a/src/kde_material_you_colors/utils/wallpaper_utils.py b/src/kde_material_you_colors/utils/wallpaper_utils.py index d21fede..4564735 100644 --- a/src/kde_material_you_colors/utils/wallpaper_utils.py +++ b/src/kde_material_you_colors/utils/wallpaper_utils.py @@ -26,6 +26,7 @@ def __init__(self, config: Configs): self._type = None self._source = None self._error = None + self._skip_screenshot = False self.reload() def __str__(self) -> str: @@ -87,8 +88,10 @@ def current(self): } return o - def screenshot(self): + def screenshot(self, skip_screenshot): self._type = "screenshot" + if skip_screenshot: + return if settings.SCREENSHOT_HELPER_PATH is None: self._error = "Screenshot helper is not installed. Use another wallpaper plugin or install the helper" return @@ -109,7 +112,7 @@ def screenshot(self): def reload(self): """Reload current wallpaper""" if self._screenshot_only_mode: - self.screenshot() + self.screenshot(self._skip_screenshot) return # Validate color @@ -172,12 +175,13 @@ def reload(self): return else: # if everything fails, try taking a screenshot of the desktop - self.screenshot() + self.screenshot(self._skip_screenshot) - def update(self, config: Configs): + def update(self, config: Configs, skip_screenshot=False): """Update from config and reload wallpaper""" self._monitor = self.validate_monitor(config.read("monitor")) self._screenshot_only_mode = config.read("screenshot_only_mode") + self._skip_screenshot = skip_screenshot self._file = config.read("file") self._color = config.read("color") self._light = config.read("light")