21 lines
719 B
Nim
21 lines
719 B
Nim
# SPDX-FileCopyrightText: ☭ 2022 Emery Hemingway
|
|
# SPDX-License-Identifier: Unlicense
|
|
|
|
import std/[asyncdispatch, strutils]
|
|
import preserves, syndicate, libnotify
|
|
import ./schema/notifications
|
|
|
|
proc render(a: Assertion): string =
|
|
if a.isString: a.string
|
|
else: $a
|
|
|
|
bootDataspace("main") do (ds: Ref; turn: var Turn):
|
|
connectStdio(ds, turn)
|
|
let nc = newNotifyClient("syndicate")
|
|
onPublish(turn, ds, ?Notify[Ref]) do (s: string, b: Assertion, t: int, u: Urgency):
|
|
nc.send_new_notification(s, render(b), "", t, NotificationUrgency u)
|
|
onMessage(turn, ds, ?Notify[Ref]) do (s: string, b: Assertion, t: int, u: Urgency):
|
|
nc.send_new_notification(s, render(b), "", t, NotificationUrgency u)
|
|
|
|
runForever()
|