refactor of ssh-notify

This commit is contained in:
ari committed 2026-09-18 16:34:31 -04:00
1 parent 466080ead9
commit a781b759f4
8 files changed
+341 -58

No files matched your search

@@ -0,0 +1,22 @@
#!/usr/bin/env nu
# Invoked by `socat EXEC:` once per accepted connection on the listener
# socket, with stdin/stdout wired to that connection. Reads the JSON payload
# written by notify-send.nu and shows a real desktop notification.
#
# @real_notify_send@ is substituted at build time with the libnotify binary's
# store path.
def main [] {
let raw = (^cat | str trim)
if ($raw | is-empty) {
return
}
try {
let payload = ($raw | from json)
^@real_notify_send@ $"[($payload.host)] ($payload.title)" $payload.body
} catch {
# Malformed/partial payload (e.g. a stray connection) -- ignore.
}
}