diff --git a/CHANGELOG.md b/CHANGELOG.md index d248cbc3..16074c5d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ - Saves CPU/GPU usage by redrawing less if disabled when unfocused, but still uses same VRAM ### Updated: -- New notification system with buttons and better platform support (#220 by @Willy-JL) +- New notification system with buttons and better platform support, option to include banner image in update notifs (#220 by @Willy-JL) - Updates popup is now cumulative, new updates get grouped with any previous popups and moved to top (#220 by @Willy-JL) - Executable paths in More Info popup wrap after `/` and `\` characters for easier readability (by @Willy-JL) diff --git a/common/structs.py b/common/structs.py index 633b161d..89360970 100644 --- a/common/structs.py +++ b/common/structs.py @@ -814,6 +814,7 @@ class Settings: mark_installed_after_add : bool max_connections : int max_retries : int + notifs_show_update_banner : bool play_gifs : bool play_gifs_unfocused : bool proxy_type : ProxyType diff --git a/modules/db.py b/modules/db.py index a0d1e8ec..ad0c87c2 100644 --- a/modules/db.py +++ b/modules/db.py @@ -205,6 +205,7 @@ async def connect(): "mark_installed_after_add": f'INTEGER DEFAULT {int(False)}', "max_connections": f'INTEGER DEFAULT 10', "max_retries": f'INTEGER DEFAULT 2', + "notifs_show_update_banner": f'INTEGER DEFAULT {int(True)}', "play_gifs": f'INTEGER DEFAULT {int(True)}', "play_gifs_unfocused": f'INTEGER DEFAULT {int(False)}', "proxy_type": f'INTEGER DEFAULT {ProxyType.Disabled}', diff --git a/modules/gui.py b/modules/gui.py index bc2227d4..2d94b2ff 100644 --- a/modules/gui.py +++ b/modules/gui.py @@ -4862,6 +4862,12 @@ def select_callback(selected): draw_settings_label("Check alerts and inbox:") draw_settings_checkbox("check_notifs") + draw_settings_label( + "Banners in update notifs:", + "Whether to include a banner image when sending desktop notifications for updates." + ) + draw_settings_checkbox("notifs_show_update_banner") + draw_settings_label("Refresh if archived:") draw_settings_checkbox("refresh_archived_games") diff --git a/modules/utils.py b/modules/utils.py index d144fb6a..d2c8b8c0 100644 --- a/modules/utils.py +++ b/modules/utils.py @@ -114,11 +114,11 @@ def done_callback(future: asyncio.Future): globals.popup_stack.remove(popup) push_popup(type(globals.gui).draw_updates_popup, globals.gui).uuid = "updates" if globals.gui.hidden or not globals.gui.focused: - image = list(filter(lambda f: f.suffix not in (".zst", ".aastc"), globals.images_path.glob(f"{first}.*"))) - if image: - image = desktop_notifier.Attachment(path=image[0]) - else: - image = None + image = None + if globals.settings.notifs_show_update_banner: + image_paths = list(filter(lambda f: f.suffix not in (".zst", ".aastc"), globals.images_path.glob(f"{first}.*"))) + if image_paths: + image = desktop_notifier.Attachment(path=image_paths[0]) count = len(globals.updated_games) notification_proc.notify( title="Updates",