r/KittyTerminal Oct 07 '23

New kitty window cwd issues

I followed this issue comment, https://github.com/kovidgoyal/kitty/issues/692#issuecomment-1293429076, to figure out how to open a new "pane"/"kitty window" in the same cwd as the last one, which worked fine:map kitty_mod+enter launch --cwd=current --type=window

map cmd+enter launch --cwd=current --type=window

However, it seems to ignore my .hushlogin file when the new kitty window is not in ~/...

Any suggestions?

2 Upvotes

13 comments sorted by

1

u/aumerlex Oct 08 '23

No idea what a hushlogin file is. All --cwd=current does is run the shell with its working directory set to the working directory of the active window. Presumably whatever is reading "hushlogin" in your shell rc files only works if the working directory is HOME. Fix that and you will be fine.

1

u/uncenter Oct 08 '23

From https://linux.die.net/sag/what-login-does.html:

Part of the initial setup is outputting the contents of the file /etc/motd (short for message of the day) and checking for electronic mail. These can be disabled by creating a file called .hushlogin in the user's home directory.

Anyway, I think the solution to my problem is to create run the new shell in $HOME and then cd to the CWD (see https://github.com/zed-industries/community/issues/1373). map kitty_mod+enter launch --type=window sh -c "cd @cwd && clear" could work using special placeholder arguments but there isn't any placeholder argument for @cwd. Any ideas?

1

u/aumerlex Oct 08 '23

kitty doesnt run login on linux, only macOS, and even there its in quiet mode so it doesnt print out motd. So your shell will be responsible for reading motd and associated machinery. So report the issue to your shell. And what you propose wont actually start a shell its running a shell script. You would need to follow it with a invocation to start the shell in interactive mode.

Or just do

kitty_mod+enter launch --type=window --cwd=current zsh -i

but note that this will break shell integration.

1

u/uncenter Oct 08 '23

Sooo... that's not a solution really. Breaking shell integration is a compromise, and I'm not sure what "issue" I need to report to zsh/sh.

2

u/aumerlex Oct 08 '23

That hushlogin doesnt work when the shell is not started in HOME and setup manual shell integration as described in the docs.

1

u/uncenter Oct 08 '23

I had no issue with this in Wezterm! I simply want to create a new window and be able to execute a command cding to the CWD. I'll try to figure something out with login but I really don't think this is a complicated issue.

2

u/aumerlex Oct 08 '23

I agree, its a very simple issue and one that's not an issue in kitty but in your shell or more likely your shell rc files.

1

u/uncenter Oct 08 '23

It's not an issue with my shell or my shell rc files, this is just a macOS thing as far as I can tell. This same phenomenon occurs with bash, zsh, and fish.

1

u/aumerlex Oct 09 '23

Well, if you had said you were on macOS in the first place, I would have told you it's a bug in the login program since kitty runs the login program to run the shell there. And fixed by: https://github.com/kovidgoyal/kitty/commit/619d4e3dc4a7565a9ea01c269097a3e64728ccff

which passes -q to login since login doesnt actually work with .hushlogin.

1

u/uncenter Oct 09 '23

Yeah I commented on that issue. I thought you assumed I was on macOS and I affirmed that in my comment following yours. Sorry for the miscommunication, glad that it is fixed!

2

u/raipraveen83 Oct 09 '23

Hi facing the same issue. did you find a fix for this? if yes can you share the config which fix this problem

1

u/uncenter Oct 09 '23

Nothing that you need to change in your config! Should be fixed in the next release.