This commit is contained in:
2025-11-06 21:31:22 +01:00
parent 1345e8b3c9
commit 165873dec0

View File

@@ -112,9 +112,11 @@ if __name__ == "__main__":
# callback on default action (edit) # callback on default action (edit)
def edit_callback(n, action, user_data): def edit_callback(n, action, user_data):
try:
global editing global editing
editing = True editing = True
edit_screenshot(filepath) edit_screenshot(filepath)
finally:
n.close() n.close()
loop.quit() loop.quit()
@@ -128,14 +130,20 @@ if __name__ == "__main__":
Notify.init("Screenshot Utility") Notify.init("Screenshot Utility")
n = Notify.Notification.new( n = Notify.Notification.new(
"Screenshot taken", "Screenshot taken",
# Mako doesn't have action buttons displayed with notification cards,
"Click to edit" "Click to edit"
) )
n.add_action( n.add_action(
# so default action is used here, which will be triggered on clicking the notification card
"default", "default",
# But for my (or to be precise, Noctalia's) quickshell config, buttons will be displayed with label
"Open in Editor", "Open in Editor",
edit_callback, edit_callback,
None None
) )
n.connect("closed", close_callback)
# set timeout for close_callback
GLib.timeout_add_seconds(10, close_callback, n)
n.show() n.show()
loop.run() loop.run()