feat: add notify command, modify sidekick with tmux

This commit is contained in:
2026-05-26 16:54:53 +08:00
parent c32e8b4015
commit 4e8e3b7073
5 changed files with 63 additions and 1 deletions
+24
View File
@@ -0,0 +1,24 @@
function notify-done --description '前置包装:运行命令并在完成时发送 OSC 777 通知'
if test (count $argv) -eq 0
echo "Usage: notify-done <command> [args...]" >&2
return 2
end
set -l start (date +%s)
$argv
set -l rc $status
set -l elapsed (math (date +%s) - $start)
set -l human (_notify_human_duration (math $elapsed \* 1000))
set -l label
if test $rc -eq 0
set label "完成: $argv[1]"
else
set label "失败 exit=$rc: $argv[1]"
end
set -l body "$human · "(hostname -s)" · "(string join ' ' $argv)
_notify_emit "$label" "$body"
return $rc
end