kovidgoyal / kitty

Cross-platform, fast, feature-rich, GPU based terminal
https://sw.kovidgoyal.net/kitty/
GNU General Public License v3.0
24.66k stars 989 forks source link

br can't be launched in a kitty startup session #6826

Closed Schweber closed 1 year ago

Schweber commented 1 year ago

Describe the bug I would like to define a kitty startup session that launches br (launches broot with improved shell capabilities) on startup. However, if i add launch br then kitty fails with

Failed to launch child: br
With error: No such file or directory
Press Enter or Esc to exit

If i add launch broot it works but then i can't use :cd etc. After the window is open i can run br and it works as usual but that's not what i'm trying to achieve.

To Reproduce Steps to reproduce the behavior:

  1. install broot and its br shell improvement
  2. add launch br to a kitty startup session and execute it
  3. See error

Environment details I can't press Ctrl+Shift+F6 on my current keyboard setup and kitty --debug-config yields Unknown option: --debug-config.

Additional context Same error occurs with kitty --config NONE. I am using kitty 0.31.0 on NixOS. https://github.com/Canop/broot/issues/797

kovidgoyal commented 1 year ago

launch runs programs not shell aliases. If you want to run a shell alias, run something like

launch bash -il -c "br"

You will need to adjust the options to bash or whatever shell you use to make sure it sources whatever files the alias is defined in.

Schweber commented 1 year ago

I see, thank you!

Schweber commented 1 year ago

With launch fish -c br it is started as intended but if i close broot, the kitty window is closed as well (it should return to the shell).

However, if i create a new_window in this kitty startup session, broot works fine in the new window. So the window created by the startup session will still close when i close broot but the one i created with new_window in this startup session can run broot fine and will stay open when i close broot in it. So i can have two kitty windows in the same OS window that behave differently.

Using launch fish -ic br or launch fish -ilc br leads to the same behaviour. Using bash instead also shows the same behaviour.

@kovidgoyal Do you have an idea why that happens?

kovidgoyal commented 1 year ago

Yes, a window closes when the program you run in it exits. If you want a shell prompt after that program finishes use the --hold argument to launch.

Schweber commented 1 year ago

@kovidgoyal I tried that but it makes no difference. I launch kitty with kitty -1 --class kitty_code --hold --session ~/Programmieren/kitty-session.conf. In kitty-session.conf there is only

cd ~/Programmieren
launch fish -ilc br

I then get a kitty window with broot running in ~/Programmieren. So far so good.

But if i then exit broot, the kitty window is closed as well. This is not what i want/expect because if i run br manually from a shell (bash or fish or nushell, doesn't matter) and then close broot, i'm back at the shell prompt and i don't have to use --hold for that.

The strange thing is the part that i described in my previous post:

However, if i create a new_window in this kitty startup session, broot works fine in the new window. So the window created by the startup session will still close when i close broot but the one i created with new_window in this startup session can run broot fine and will stay open when i close broot in it. So i can have two kitty windows in the same OS window that behave differently.

So this new window stays open and --hold is not needed. I don't understand this behaviour.

kovidgoyal commented 1 year ago

launch --hold fish -ilc br

Schweber commented 1 year ago

That works, thank you for helping me!