🤔 emm
This commit is contained in:
@@ -112,11 +112,13 @@ 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):
|
||||||
global editing
|
try:
|
||||||
editing = True
|
global editing
|
||||||
edit_screenshot(filepath)
|
editing = True
|
||||||
n.close()
|
edit_screenshot(filepath)
|
||||||
loop.quit()
|
finally:
|
||||||
|
n.close()
|
||||||
|
loop.quit()
|
||||||
|
|
||||||
# callback on close
|
# callback on close
|
||||||
def close_callback(n):
|
def close_callback(n):
|
||||||
@@ -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()
|
||||||
|
|||||||
Reference in New Issue
Block a user