|
31 | 31 |
|
32 | 32 | class SystemNotifier: |
33 | 33 | @staticmethod |
34 | | - def send_notification(title: str, body: str = "", icon: str = "edit-copy-symbolic", folder_path: str = None): |
| 34 | + def send_notification( |
| 35 | + title: str, |
| 36 | + body: str = "", |
| 37 | + icon: str = "edit-copy-symbolic", |
| 38 | + folder_path: str = None |
| 39 | + ): |
35 | 40 | app = Gio.Application.get_default() |
36 | 41 | notification = Gio.Notification.new(title) |
37 | 42 | notification.set_icon(Gio.ThemedIcon(name=icon)) |
38 | 43 | if body: |
39 | 44 | notification.set_body(body) |
40 | | - app.send_notification(None, notification) |
| 45 | + |
| 46 | + notification_id = "screenshot-notification" |
| 47 | + app.send_notification(notification_id, notification) |
41 | 48 |
|
42 | 49 | class BaseImageExporter: |
43 | 50 | """Base class for image export handlers""" |
@@ -171,9 +178,9 @@ def _on_dialog_response(self, dialog, response_id, suggested_format): |
171 | 178 | try: |
172 | 179 | self._save_image(save_path, format_type) |
173 | 180 | self.window.show_close_confirmation = False |
174 | | - self.window._show_notification(_("Export Failed")) |
175 | | - except Exception as e: |
176 | 181 | self.window._show_notification(_("Image saved successfully")) |
| 182 | + except Exception as e: |
| 183 | + self.window._show_notification(_("Export Failed")) |
177 | 184 | logger.error(f"Failed to save image: {e}") |
178 | 185 |
|
179 | 186 | dialog.destroy() |
@@ -428,16 +435,12 @@ def _finish_close_operation(self, results: dict, callback: callable): |
428 | 435 |
|
429 | 436 | save_folder = results.get('save_folder') |
430 | 437 |
|
431 | | - if saved and copied: |
432 | | - message = _("Screenshot updated and copied to clipboard") |
433 | | - elif saved: |
434 | | - message = _("Screenshot updated") |
435 | | - elif copied: |
436 | | - message = _("Image copied to clipboard") |
437 | | - else: |
438 | | - message = None |
439 | | - if message: |
440 | | - SystemNotifier.send_notification(_("Close Operation Successful"), message, folder_path=save_folder) |
| 438 | + if copied: |
| 439 | + title = _("Image Copied") |
| 440 | + body = _("You can now paste it from the clipboard.") |
| 441 | + icon = "edit-copy-symbolic" |
| 442 | + |
| 443 | + SystemNotifier.send_notification(title, body, icon, folder_path=save_folder) |
441 | 444 | self.window.show_close_confirmation = False |
442 | 445 |
|
443 | 446 | if callback: |
|
0 commit comments