55 Commits

Author SHA1 Message Date
Kovid Goyal
f91a0f6986 When saving session add option to save the foreground process running in the shell so that it is also restarted
Useful if user builds up session to save by running programs via
the shell.

Note that the serialization format for session files has changed
slightly, becoming more robust and allowing us to add more types
of saved data in the future, without overloading user_vars and thus
risking name conflicts.
2025-08-16 16:50:45 +05:30
Kovid Goyal
da1626090a Update codebase to Python 3.10 using pyupgrade 2025-02-03 10:56:50 +05:30
Kovid Goyal
f1d0d0949b Run pyupgrade to update the codebase to python 3.9
Gets rid of a lot of typing ugliness by using type annotations on
builtin types
2024-07-31 07:55:27 +05:30
Kovid Goyal
fbbfb25702 Better fix for kitten not being in PATH
Add it to PATH just as we add the kitty dir to PATH. Ensures the correct
kitten is in PATH, corresponding to the correct kitty.
2023-02-01 10:16:50 +05:30
Kovid Goyal
47641456da Ensure edit-in-kitty works even if kitten is not in PATH
Still needs to be implemented for fish shell
2023-01-31 20:41:39 +05:30
Kovid Goyal
291f9e9a5e Make cloning safer
Now env vars are set after shell rc files are sourced. And the clone
request cannot specify the cmdline to execute.
2022-04-17 07:49:58 +05:30
Kovid Goyal
b45fedd794 Infrastructure for serializing env blocks 2022-04-16 22:16:20 +05:30
Kovid Goyal
d0c0b01724 Get clone-in-kitty working for bash as well 2022-04-13 20:38:04 +05:30
Kovid Goyal
d36f6b39c7 Fix previous PR 2022-03-08 21:29:09 +05:30
pagedown
46889a3a32 Fix shell integration being disabled with one invalid option 2022-03-08 23:42:41 +08:00
pagedown
d236b34fd4 Shell integration: Fix running bash non-interactively
In POSIX mode, bash does not perform ENV with non-interactive shell, so
the mode cannot be recovered. Check the arguments and do not change the
execution environment.
2022-03-04 19:47:44 +08:00
Kovid Goyal
02a68e7541 Pass the value of shell_integration in the tarfile
Allows per host overrides and also avoids needing to read kitty.conf in
the ssh kitten
2022-03-03 21:24:44 +05:30
Kovid Goyal
8c7ffc90f3 Fix the default bash HISTFILE changing to .sh_history instead of .bash_history
Fixes #4765
2022-02-28 20:06:48 +05:30
Kovid Goyal
2619db0e58 Cleanup previous PR 2022-02-27 21:31:39 +05:30
pagedown
1c88c13fc2 Shell integration: Try to get ZDOTDIR from /etc/zshenv when no RC files 2022-02-27 23:25:26 +08:00
Kovid Goyal
88091b4ab3 BASH integration: No longer modify .bashrc to load shell integration
I think I have things setup robustly so that the shell integration
is loaded transparently via env vars and the normal bash startup files
are sourced, in the same way that vanilla bash does it. Let's hope I
haven't overlooked something.
2022-02-22 21:24:51 +05:30
Kovid Goyal
e25b90c1b6 Add bash integration tests 2022-02-22 12:23:19 +05:30
Kovid Goyal
c9cc832875 Add basic tests for zsh shell integration 2022-02-21 17:57:25 +05:30
Kovid Goyal
9f2be8b696 Fix #4573 2022-01-27 11:29:33 +05:30
Roman Perepelitsa
09d025d88f Minor robustness improvements to zsh shell integration 2021-12-20 13:20:38 +01:00
Kovid Goyal
cdb1138465 ... 2021-11-29 12:42:02 +05:30
Kovid Goyal
c8c6f8691f Store the shell_integration option as a set 2021-11-29 12:41:25 +05:30
Kovid Goyal
9441cf15c3 Move the bash integration script into its own dir
This matches the other shells and might be useful someday
if bash ever gets a way for the invoking process to inject code
into it.

Also use KITTY_INSTALLATION_DIR when loading the bash integration code.
2021-11-29 12:30:10 +05:30
Kovid Goyal
276ed7263c Forgot to use env rather than os.environ when checking for ZDOTDIR 2021-11-29 12:22:33 +05:30
Kovid Goyal
3e3744753d DRYer 2021-11-27 11:13:26 +05:30
Kovid Goyal
5bc2fa187c Change the order of file checks since .zshrc is most likely to exist 2021-11-27 10:27:51 +05:30
Kovid Goyal
0a9005f5ce Allow zsh-newuser-install to run
Shell integration wont be turned on for an unconfigured zsh
2021-11-27 10:21:39 +05:30
Kovid Goyal
f6e0eb4005 Shell integration: Dont modify ~/.zshrc
Instead use the ZDOTDIR env var to load the shell integration code
2021-11-27 07:19:59 +05:30
Kovid Goyal
80dbebf0ad Remove unused code 2021-11-08 11:43:14 +05:30
Kovid Goyal
4841502959 Use a single kitty invocation for manual shell integration 2021-11-08 11:27:10 +05:30
Kovid Goyal
8218df82f2 Add function to get path to integration script for the current shell
Makes setting up manual shell integration much easier. Also clean up
integration docs.
2021-11-08 11:11:16 +05:30
Kovid Goyal
b5e8b5a124 Allow users to modify XDG_DATA_DIRS in the fish rc files
The only downside of this new technique is that it is no
longer possible to set XDG_DATA_DIRS to an empty var in kitty.conf
Since an empty XDG_DATA_DIRS breaks lots fo things, I dont think that
is a big concern.
2021-11-07 18:59:50 +05:30
Kovid Goyal
a1eb341817 ... 2021-11-07 10:25:13 +05:30
Kovid Goyal
cc2419911c shell environ modification should only happen for actual shell processes 2021-11-07 10:22:37 +05:30
Kovid Goyal
2f5d3b073d Ignore exceptions in the environment modifier 2021-11-07 10:13:09 +05:30
Kovid Goyal
4c0a7a9566 KSI should be set even when no-rc is specified 2021-11-07 10:10:19 +05:30
Kovid Goyal
35514e0cc3 Dont change XDG_DATA_DIRS for child processes in fish shell integration
Fixes #4199
2021-11-07 10:06:18 +05:30
Kovid Goyal
3ca3c67828 Remove unused code 2021-10-27 17:15:45 +05:30
Kovid Goyal
d3a3f99848 Use an env var for fish shell integration
Less intrusive (in some ways) than adding symlinks to ~/.config/fish
Exploits the fact that fish loads scripts from XDG_DATA_DIRS on startup.
Thanks to @page-down for noticing
2021-10-27 14:59:11 +05:30
Kovid Goyal
4494ddd8ff mypy: Turn on return value checks
Its a shame GvR is married to "return None"
https://github.com/python/mypy/issues/7511
2021-10-26 22:39:14 +05:30
Kovid Goyal
4fb804efc6 ... 2021-10-23 18:55:55 +05:30
Kovid Goyal
5b2ba448b6 Only modify .zshrc to add shell integration if it already exists 2021-10-23 18:54:59 +05:30
Kovid Goyal
6546c1da9b run pyupgrade to upgrade the codebase to python3.6 2021-10-21 12:43:55 +05:30
Kovid Goyal
8397970bf8 Ensure fish config dir exists 2021-08-20 08:54:41 +05:30
Kovid Goyal
929e0c126d rename -> replace 2021-08-18 10:06:09 +05:30
Kovid Goyal
b293e4d516 DRYer 2021-08-18 10:06:09 +05:30
Kovid Goyal
1e0269faa2 Fix sourcing of shell integration changing $? on bash/zsh 2021-08-18 10:06:08 +05:30
Kovid Goyal
a10c19456a Fix completions for fish 2021-08-18 10:06:07 +05:30
Kovid Goyal
23f94b6e67 Get prompt marking working for th fish shell 2021-08-18 10:06:06 +05:30
Kovid Goyal
2fcd57410a Dont fail if rc file dir doesnt exist 2021-08-18 10:06:06 +05:30