|
91 | 91 | wakeup_main_loop, |
92 | 92 | ) |
93 | 93 | from .keys import keyboard_mode_name, mod_mask |
| 94 | +from .notifications import NotificationManager |
94 | 95 | from .options.types import Options |
95 | 96 | from .progress import Progress |
96 | 97 | from .rgb import to_color |
@@ -1611,16 +1612,23 @@ def handle_cmd_end(self, exit_status: str = '') -> None: |
1611 | 1612 | cmd.only_when = OnlyWhen(when) |
1612 | 1613 | if not nm.is_notification_allowed(cmd, self.id): |
1613 | 1614 | return |
1614 | | - if action == 'notify': |
1615 | | - if self.last_cmd_end_notification is not None: |
| 1615 | + |
| 1616 | + def notify(window: Window, opts: Options, nm: NotificationManager) -> None: |
| 1617 | + if window.last_cmd_end_notification is not None: |
1616 | 1618 | if 'next' in opts.notify_on_cmd_finish.clear_on: |
1617 | | - nm.close_notification(self.last_cmd_end_notification[0]) |
1618 | | - self.last_cmd_end_notification = None |
1619 | | - notification_id = nm.notify_with_command(cmd, self.id) |
| 1619 | + nm.close_notification(window.last_cmd_end_notification[0]) |
| 1620 | + window.last_cmd_end_notification = None |
| 1621 | + notification_id = nm.notify_with_command(cmd, window.id) |
1620 | 1622 | if notification_id is not None: |
1621 | | - self.last_cmd_end_notification = notification_id, cmd.only_when |
| 1623 | + window.last_cmd_end_notification = notification_id, cmd.only_when |
| 1624 | + |
| 1625 | + if action == 'notify': |
| 1626 | + notify(self, opts, nm) |
1622 | 1627 | elif action == 'bell': |
1623 | 1628 | self.screen.bell() |
| 1629 | + elif action == 'notify-bell': |
| 1630 | + notify(self, opts, nm) |
| 1631 | + self.screen.bell() |
1624 | 1632 | elif action == 'command': |
1625 | 1633 | open_cmd([x.replace('%c', self.last_cmd_cmdline).replace('%s', exit_status) for x in notify_cmdline]) |
1626 | 1634 | else: |
|
0 commit comments