fix(notifications): report the parsed exit status of finished commands
A shell that ends a command with a bare OSC 133;D leaves the raw status string empty, so the notification said "finished with status: ." and the command action got an empty %s. Use the status already parsed for the event instead.
This commit is contained in:
1 file changed
+2
-2
+2
-2
@@ -2074,7 +2074,7 @@ class Window:
|
||||
cmd = nm.create_notification_cmd()
|
||||
cmd.title = 'kitty'
|
||||
s = self.last_cmd_cmdline.replace('\\\n', ' ')
|
||||
cmd.body = f'Command {s} finished with status: {exit_status}.\nClick to focus.'
|
||||
cmd.body = f'Command {s} finished with status: {self.last_cmd_exit_status}.\nClick to focus.'
|
||||
cmd.only_when = OnlyWhen(when)
|
||||
if not nm.is_notification_allowed(cmd, self.id):
|
||||
return
|
||||
@@ -2096,7 +2096,7 @@ class Window:
|
||||
notify(self, opts, nm)
|
||||
self.screen.bell()
|
||||
elif action == 'command':
|
||||
open_cmd([x.replace('%c', self.last_cmd_cmdline).replace('%s', exit_status) for x in notify_cmdline])
|
||||
open_cmd([x.replace('%c', self.last_cmd_cmdline).replace('%s', str(self.last_cmd_exit_status)) for x in notify_cmdline])
|
||||
else:
|
||||
raise ValueError(f'Unknown action in option `notify_on_cmd_finish`: {action}')
|
||||
|
||||
|
||||
Reference in new issue
Block a user