I closed the terminal that had the kak server, now the clients are sad :(

sounds about right. I prefer something similar but with -d so when I close the last client, the server exits

Yeah, it is nice that -d does that for you. For me though, I’m a big fan of suspend-and-resume. If I use -d, then if I suspend the initial client that kicked off the session, then my other clients become unresponsive since the server process has been suspended.

Maybe I need to switch out the suspend-and-resume for just popping a new terminal onto of my existing kakoune client, then I could have the best of both worlds.

sorry I meant without -d

If I use -d, then if I suspend the initial client that kicked off the session, then my other clients become unresponsive since the server process has been suspended.

This is because you didn’t add setsid to your kak -d invocation. Without setsid, kak -d will still have the same process group as the parent shell, and it will be suspended collaterally by SIGSTOP when you press Ctrl-Z.

Either way, usually you don’t need -d; Kakoune will daemonize automatically on Ctrl-Z. So the simple thing is to run something to the effect of kak -s foo "$@" || kak -c foo "$@"

There is one edge case - if you hit Ctrl-Z while there is no other client, new clients will hang. This is tracked in [BUG] ctrl-z does not background the server · Issue #4957 · mawww/kakoune · GitHub
Not sure if we want to fix that, there is a working patch in any case

Interesting, the inner workings of terminals/shells is pretty neat.

I wanted to avoid using setsid because it was something extra I had to install for OSX, and when I saw disown seeming to work, I moved on. But, clearly setsid is the way to go.

Thanks for all the advice, and I’ll be sure to leave that wiki page alone!