Start Kitty with folowing command from some other terminal to minimize side effects and reduce amount of items in Kitty's environment.
env -i DISPLAY=$DISPLAY TERM=$TERM DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS kitty bash --noprofile --norc
Inside of started Kitty:
env | sort # To see a minimal current environment
cat /proc/$$/environ | tr \\0 \\n | sort # To see that output of above command is a bit differ and it has SHLVL var
kitty @ launch bash --norc # To start new window and see that it has the same environment as the Kitty's main process.
# So the environment isn't inherited from current window.
kitty @ launch --env FOO_BAR=22222 bash --norc # To demonstrate that it's one explisit way to start new window
# with explicitly patched environment
To run Kitty from source with minimal env:
env -i PATH=/usr/sbin:/usr/bin:/sbin:/bin DISPLAY=$DISPLAY TERM=$TERM DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS ./kitty/launcher/kitty bash --noprofile --norc
Without specified PATH
as above ... ./kitty/launcher/kitty --help
raises error because can't locate and call other commands, in this case it can't locate a less
command.