kakounedotcom / connect.kak

Connect a program to Kakoune clients
https://kakoune.org
The Unlicense
88 stars 18 forks source link

kak-shell: how to create new session? #48

Open basbebe opened 3 years ago

basbebe commented 3 years ago

Hi!

I have two questions about kak-shell.

I don't know if I'm holding it wrong or there's a problem with my setup.

I see that there is a way to create a new session but I don't know how? Whatever I enter when the prompt comes, nothing happens and the prompt never stops…

And: Since kak-shell always opens with a prompt, I assume the desired thing to do in scripts is not to use kak-shell but kak -c $session and maybe kak -c "$session" -e "connect-detach; sh connect.sh?

alexherbo2 commented 3 years ago

kak-shell should prompt you to connect to a session or create a new session. Enter for example kanto. When connected, enter a command like :attach.

basbebe commented 3 years ago

I rebuilt kakoune from source to verify but I keep having this problem:

Bildschirmfoto 2021-02-03 um 08 16 38

In the meantime when I do this with anpther session open, I get this in the debug of the other session, even if I try to create a new one:

Bildschirmfoto 2021-02-03 um 08 24 05
alexherbo2 commented 3 years ago

I have no idea. Can you try to edit connect.kak files to find the problem?

There is kak-shell here. Maybe other files to edit.

basbebe commented 3 years ago

I will as soon as I get into it!

basbebe commented 3 years ago

found the problem: not all Unixes come with setsid – espacially not macOS.

Solution:

or

alexherbo2 commented 3 years ago

I remember without setsid, it kills my programs on Control + d in Elvish.

basbebe commented 3 years ago

I remember without setsid, it kills my programs on Control + d in Elvish.

yep, same with fish.

this seems to work though (invoke subshell):

  ( kak -s "$session" -d < /dev/null > /dev/null 2>&1 ) &

(btw: will need to try out elvish, thanks)

alexherbo2 commented 3 years ago

What is the difference between { ... } and (...)?

basbebe commented 3 years ago

to my understanding, { … } is a brace expansion (https://ss64.com/bash/syntax-expand.html), whereas ( … ) invokes a subshell (https://tldp.org/LDP/abs/html/subshells.html).

basbebe commented 3 years ago

( kak -s "$session" -d < /dev/null > /dev/null 2>&1 ) &

btw. using this ⬆️ seems to get rid of https://github.com/alexherbo2/connect.kak/issues/53 (but produces another bug when callein :new from a connected client which results in a loop and an exit of kak-shell)

basbebe commented 3 years ago

this also works univerally (but creates the same error for me as above):

  env session=$session $SHELL -c 'kak -s "$session" -d < /dev/null > /dev/null 2>&1 &'