darkhz / invidtui

A TUI based Invidious client
MIT License
191 stars 6 forks source link

Create ipc socket for mpv correctly with mkstemp #43

Open paulie-g opened 6 months ago

paulie-g commented 6 months ago

Enhancement: Creating a socket with a fixed filename for mpv control, in $HOME/.config/invidtui no less, doesn't make sense. (If you wanted to do single instance enforcement, the way to do it would be with the standard PID file idiom.) Create the socket in env(TMPDIR) | '/tmp' + whatever you get back from the golang equivalent of mkdtemp. For bonus points, include the current PID in template. This way a crash doesn't require the user to manually remove the socket.

darkhz commented 6 months ago

Very good, this will be implemented.

Initially I did put the socket in /tmp, but later I put it in the config dir supposedly to better manage socket creation/detection/deletion, and also due to this https://github.com/darkhz/invidtui/issues/16#issuecomment-1319447396.

Maybe multiple instances of invidtui could be allowed to run, each with its own socket.