kakounedotcom / connect.kak

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

:new not working when in kak-shell #53

Closed basbebe closed 3 years ago

basbebe commented 3 years ago

:new command works fine normally.

But when I'm in kak-shell and :attach, then :new does nothing and I get this in debug buffer:

shell stderr: <<<
Traceback (most recent call last):
  File "lib/python3.8/runpy.py", line 282, in run_path
  File "lib/python3.8/runpy.py", line 87, in _run_code
  File "__main__.py", line 127, in <module>
  File "__main__.py", line 123, in main
  File "__main__.py", line 23, in remote_control
  File "kitty/remote_control.py", line 188, in main
  File "kitty/remote_control.py", line 132, in do_io
  File "kitty/utils.py", line 429, in __enter__
OSError: Failed to open controlling terminal: /dev/tty (identified with ctermid()) with error: Device not configured
>>>

I would have thought that this might be a kitty problem but since it works when not in kak-shell

basbebe commented 3 years ago

update:

this is only true if I open the client from kak-shell:

❯ kak-shell
Kakoune sessions:
+ create new session
Kakoune session: kanto

~ 🐈 client0@kanto
❯ 

then:

*debug*

accepting connection failed: socket read failed: Bad file descriptor
remote client connected: 7
remote client disconnected: 7

If I open a new session (without being in kak-shell), I can open new clients, new terminals etc. without problem.

not checked yet if related to https://github.com/alexherbo2/connect.kak/commit/09661989333b07f31c74b8cd3a0ec8db55a28718


update: not related to https://github.com/alexherbo2/connect.kak/commit/09661989333b07f31c74b8cd3a0ec8db55a28718

basbebe commented 3 years ago

tried around a bit more:

I cannot open new kak instances whan in kak-shell. I can only attach.

If the instance was being created by setsid, I get the error above (https://github.com/alexherbo2/connect.kak/issues/53#issue-800619181).

If I create the session by e.g. sh -c 'kak -s test -d < /dev/null > /dev/null 2>&1 &' and then connect via kak-shell, the terminal window becomes unresponsive whenever I try to create a new client.

alexherbo2 commented 3 years ago

I have the impression connect.kak is broken.

Try in other terminals / OSes to see.

basbebe commented 3 years ago

it does work in iterm2 w/ tmux.

So it might be a kitty thing (kitty itself / kakoune / connect ?)

(kakrc: https://github.com/basbebe/.dotfiles/blob/master/.config/kak/kakrc – might look familiar to you 😬)

basbebe commented 3 years ago

funny thing:

If I open kitty from iterm w/tmux and open kak-shell in kitty, :new spawns new windows in iterm2 (tmux).

If I open kitty from apple terminal or iterm2 without tmux and do the same, I get the error.

If I switch terminal-mode to iterm, windows open in iterm again.

alexherbo2 commented 3 years ago

It may be due to the aliasing.

Type in Kakoune :terminal, you will see the terminal command that is used in the info box.

basbebe commented 3 years ago

it's kitty-terminal in all cases

basbebe commented 3 years ago

not quite: when opened through iterm/tmux, it shows tmux-terminal-horizontal, and if I change it manually with terminal-mode, it shows the corresponding setting, of course.

basbebe commented 3 years ago

I thought this was familiar…

https://github.com/mawww/kakoune/issues/3530

🙈