Skip to content

Commit 8b837b6

Browse files
committed
Fix button order
1 parent dabc7fe commit 8b837b6

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

modules/notification_proc.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,12 @@ def notify(
8686
attachment: desktop_notifier.Attachment = None,
8787
timeout=5,
8888
):
89-
button_callbacks = {"View": 0}
89+
button_callbacks = []
9090
for button in buttons:
91-
button_callbacks[button.title] = hash(button.on_pressed)
91+
button_callbacks.append((button.title, hash(button.on_pressed)))
9292
callbacks[hash(button.on_pressed)] = button.on_pressed
93+
button_callbacks.append(("View", 0))
94+
9395
kwargs = dict(
9496
title=title,
9597
msg=msg,
@@ -113,7 +115,7 @@ async def _notify(
113115
msg: str,
114116
urgency: str,
115117
icon: str | None,
116-
button_callbacks: dict[str, int],
118+
button_callbacks: list[tuple[str, int]],
117119
on_clicked_callback: int,
118120
attachment: str | None,
119121
timeout: int,
@@ -128,7 +130,7 @@ async def _notify(
128130
title=button,
129131
on_pressed=functools.partial(_callback, callback),
130132
)
131-
for button, callback in button_callbacks.items()
133+
for button, callback in button_callbacks
132134
],
133135
on_clicked=functools.partial(_callback, on_clicked_callback),
134136
attachment=desktop_notifier.Attachment(uri=attachment) if attachment else None,

0 commit comments

Comments
 (0)