diff --git a/.goreleaser.yml b/.goreleaser.yml index d0cc958f..d30b177b 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -59,6 +59,8 @@ nfpms: dst: /lib/systemd/system/ntfy-client.service - dst: /var/cache/ntfy type: dir + - dst: /usr/share/ntfy/logo.png + src: server/static/img/ntfy.png scripts: preinstall: "scripts/preinst.sh" postinstall: "scripts/postinst.sh" diff --git a/cmd/subscribe.go b/cmd/subscribe.go index 0ba247fc..7ba21520 100644 --- a/cmd/subscribe.go +++ b/cmd/subscribe.go @@ -210,7 +210,7 @@ func envVars(m *client.Message) []string { env = append(env, envVar(m.Message, "NTFY_MESSAGE", "message", "m")...) env = append(env, envVar(m.Title, "NTFY_TITLE", "title", "t")...) env = append(env, envVar(fmt.Sprintf("%d", m.Priority), "NTFY_PRIORITY", "priority", "prio", "p")...) - env = append(env, envVar(strings.Join(m.Tags, ","), "NTFY_TAGS", "tags", "ta")...) + env = append(env, envVar(strings.Join(m.Tags, ","), "NTFY_TAGS", "tags", "tag", "ta")...) return env } diff --git a/docs/subscribe/cli.md b/docs/subscribe/cli.md index 29416c31..07e6f281 100644 --- a/docs/subscribe/cli.md +++ b/docs/subscribe/cli.md @@ -73,6 +73,7 @@ stays open forever. $ ntfy sub mytopic {"id":"nZ8PjH5oox","time":1639971913,"event":"message","topic":"mytopic","message":"hi there"} {"id":"sekSLWTujn","time":1639972063,"event":"message","topic":"mytopic",priority:5,"message":"Oh no!"} +... ```
@@ -84,8 +85,8 @@ $ ntfy sub mytopic ``` ntfy subscribe TOPIC COMMAND ``` -If you run it like this, a COMMAND is executed for every incoming messages. Here are a few -examples: +If you run it like this, a COMMAND is executed for every incoming messages. Scroll down to see a list of available +environment variables. Here are a few examples: ``` ntfy sub mytopic 'notify-send "$m"' @@ -109,10 +110,10 @@ in double-quotes, you should be fine: | `$NTFY_TOPIC` | `$topic` | Topic name | | `$NTFY_MESSAGE` | `$message`, `$m` | Message body | | `$NTFY_TITLE` | `$title`, `$t` | Message title | -| `$NTFY_PRIORITY` | `$priority`, `$p` | Message priority (1=min, 5=max) | -| `$NTFY_TAGS` | `$tags`, `$ta` | Message tags (comma separated list) | +| `$NTFY_PRIORITY` | `$priority`, `$prio`, `$p` | Message priority (1=min, 5=max) | +| `$NTFY_TAGS` | `$tags`, `$tag`, `$ta` | Message tags (comma separated list) | -### Subscribing to multiple topics +### Subscribe to multiple topics ``` ntfy subscribe --from-config ``` @@ -160,18 +161,19 @@ if you install the deb/rpm package. To configure it, simply edit `/etc/ntfy/clie The `ntfy-client.service` runs as user `ntfy`, meaning that typical Linux permission restrictions apply. See below for how to fix this. -If it runs on your personal desktop machine, you may want to override the service user/group (`User=` and `Group=`), and -adjust the `DISPLAY` and DBUS environment variables. This will allow you to run commands in your X session as the primary -machine user. +If the service runs on your personal desktop machine, you may want to override the service user/group (`User=` and `Group=`), and +adjust the `DISPLAY` and `DBUS_SESSION_BUS_ADDRESS` environment variables. This will allow you to run commands in your X session +as the primary machine user. You can either manually override these systemd service entries with `sudo systemctl edit ntfy-client`, and add this -(assuming your user is `pheckel`): +(assuming your user is `phil`). Don't forget to run `sudo systemctl daemon-reload` and `sudo systemctl restart ntfy-client` +after editing the service file: === "/etc/systemd/system/ntfy-client.service.d/override.conf" ``` [Service] - User=pheckel - Group=pheckel + User=phil + Group=phil Environment="DISPLAY=:0" "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus" ``` Or you can run the following script that creates this override config for you: