From 165873dec0141cc64d8fcca2619748c348e118f7 Mon Sep 17 00:00:00 2001 From: Uyanide Date: Thu, 6 Nov 2025 21:31:22 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=94=20emm?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../scripts/.local/scripts/screenshot-script | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/config/scripts/.local/scripts/screenshot-script b/config/scripts/.local/scripts/screenshot-script index fccf409..52e13b2 100755 --- a/config/scripts/.local/scripts/screenshot-script +++ b/config/scripts/.local/scripts/screenshot-script @@ -112,11 +112,13 @@ if __name__ == "__main__": # callback on default action (edit) def edit_callback(n, action, user_data): - global editing - editing = True - edit_screenshot(filepath) - n.close() - loop.quit() + try: + global editing + editing = True + edit_screenshot(filepath) + finally: + n.close() + loop.quit() # callback on close def close_callback(n): @@ -128,14 +130,20 @@ if __name__ == "__main__": Notify.init("Screenshot Utility") n = Notify.Notification.new( "Screenshot taken", + # Mako doesn't have action buttons displayed with notification cards, "Click to edit" ) n.add_action( + # so default action is used here, which will be triggered on clicking the notification card "default", + # But for my (or to be precise, Noctalia's) quickshell config, buttons will be displayed with label "Open in Editor", edit_callback, None ) - n.connect("closed", close_callback) + + # set timeout for close_callback + GLib.timeout_add_seconds(10, close_callback, n) + n.show() loop.run()