nuscripts/plugins/plugin_desktop_notification.nu
2024-01-13 13:50:06 +03:00

33 lines
804 B
Plaintext

# https://github.com/FMotalleb/nu_plugin_desktop_notifications
cargo install nu_plugin_desktop_notifications
register ~/.cargo/bin/nu_plugin_desktop_notifications
notify -t "test notification body" --summary "test title"
# OTHER IMPLEMENTATION
def "notify_on_done" [
task: closure
] {
let start = date now
let result = do $task
let end = date now
let total = $end - $start | format duration sec
let body = $"given task finished in ($total)"
notify "task is done" $body
return $result
}
def notify [title message] {
# ^osascript -e 'display notification "' + $message + '" with title "' + $title + '"'
let msg = 'display notification "' + $message + '" with title "' + $title + '"'
$msg
^osascript -e $msg
}
notify_on_done { port scan 8.8.8.8 53 }