freedesktop_notifier moved to seperate project

This commit is contained in:
Emery Hemingway 2023-04-10 10:33:22 -05:00
parent 1ce129fd56
commit a26a83c623
6 changed files with 2 additions and 48 deletions

1
.gitignore vendored
View File

@ -3,4 +3,3 @@ http_translator
json_translator
msg
json_socket_translator
freedesktop_notifier

View File

@ -1,9 +1,5 @@
# Syndicate utils
## freedesktop_notifier
Does that desktop notification thing. See [notifications.prs](./notifications.prs) for the message schema.
## http_translator
Dispatches HTTP requests to registered handlers.

View File

@ -1,3 +0,0 @@
version 1 .
Urgency = =Low / =Normal / =Critical .
Notify = <notify @summary string @body any @timeout int @urgency Urgency> .

View File

@ -1,20 +0,0 @@
# 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()

View File

@ -1,18 +0,0 @@
import
std/typetraits, preserves
type
Notify* {.preservesRecord: "notify".} = object
`summary`*: string
`body`*: Preserve[void]
`timeout`*: BiggestInt
`urgency`*: Urgency
`Urgency`* {.preservesOr, pure.} = enum
`Low`, `Normal`, `Critical`
proc `$`*(x: Notify): string =
`$`(toPreserve(x))
proc encode*(x: Notify): seq[byte] =
encode(toPreserve(x))

View File

@ -5,9 +5,9 @@ author = "Emery Hemingway"
description = "Utilites for Syndicated Actors and Synit"
license = "unlicense"
srcDir = "src"
bin = @["http_translator", "json_socket_translator", "json_translator", "msg", "freedesktop_notifier"]
bin = @["http_translator", "json_socket_translator", "json_translator", "msg"]
# Dependencies
requires "nim >= 1.6.6", "syndicate >= 0.3.1", "libnotify"
requires "nim >= 1.6.6", "syndicate >= 0.3.1"