Skip to content

Commit

Permalink
Don't apply delay to non-screenshot method
Browse files Browse the repository at this point in the history
  • Loading branch information
luisbocanegra committed Mar 22, 2024
1 parent 4caf11a commit 974e318
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
5 changes: 2 additions & 3 deletions src/kde_material_you_colors/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 8 additions & 4 deletions src/kde_material_you_colors/utils/wallpaper_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit 974e318

Please sign in to comment.