fix!: create IPC socket in user runtime directory (#1313)

Each user has their own runtime directory at `/run/user/<uid>`. Creating
the IPC socket in there makes sure it is cleaned up regardless of
whether `ncspot` exits normally.

BREAKING CHANGE: move IPC socket location
This commit is contained in:
Thomas Frans
2023-10-28 18:43:33 +02:00
committed by GitHub
parent 2c14883f48
commit fcf68995cb
4 changed files with 63 additions and 7 deletions

View File

@@ -180,10 +180,12 @@ Note: \<FOO\> - mandatory arg; [BAR] - optional arg
| `save [current]` | Save selected item, if `current` is passed the currently playing item will be saved |
## Remote control (IPC)
Apart from MPRIS, ncspot will also create a domain socket on UNIX platforms
(Linux, macOS, *BSD) at `~/.cache/ncspot/ncspot.sock`. Applications or scripts
can connect to this socket to send commands or be notified of the currently
playing track, i.e. with `netcat`:
Apart from MPRIS, ncspot will also create a domain socket on UNIX platforms (Linux, macOS, *BSD).
The socket will be created in the platform's runtime directory. If XDG_RUNTIME_DIR is set, it will
be created under `$XDG_RUNTIME_DIR/ncspot`. If XDG_RUNTIME_DIR isn't set, it will be created under
`/run/user/<uid>` for Linux if it exists. In all other cases, it will be created under
`/tmp/ncspot-<uid>`. Applications or scripts can connect to this socket to send commands or be
notified of the currently playing track, i.e. with `netcat`:
```
% nc -U ~/.cache/ncspot/ncspot.sock