When shell is set to . respect the SHELL environment variable in the environment in which kitty is launched

Fixes #7714
This commit is contained in:
Kovid Goyal
2024-08-11 21:56:44 +05:30
parent d76767fc89
commit 2bff4af9bf
4 changed files with 9 additions and 1 deletions

View File

@@ -134,6 +134,8 @@ Detailed list of changes
- Wayland GNOME: Fix a small rendering artifact when docking a window at a screen edge or maximizing it (:iss:`7701`)
- When :opt:`shell` is set to ``.`` respect the SHELL environment variable in the environment in which kitty is launched (:pull:`7714`)
0.35.2 [2024-06-22]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@@ -98,6 +98,11 @@ Variables that influence kitty behavior
Same as :envvar:`VISUAL`. Used if :envvar:`VISUAL` is not set.
.. envvar:: SHELL
Specifies the default shell kitty will run when :opt:`shell` is set to
:code:`.`.
.. envvar:: GLFW_IM_MODULE
Set this to ``ibus`` to enable support for IME under X11.

View File

@@ -180,7 +180,7 @@ beam_cursor_data_file = os.path.join(kitty_base_dir, 'logo', 'beam-cursor.png')
shell_integration_dir = os.path.join(kitty_base_dir, 'shell-integration')
fonts_dir = os.path.join(kitty_base_dir, 'fonts')
try:
shell_path = pwd.getpwuid(os.geteuid()).pw_shell or '/bin/sh'
shell_path = os.environ.get('SHELL') or pwd.getpwuid(os.geteuid()).pw_shell or '/bin/sh'
except KeyError:
with suppress(Exception):
print('Failed to read login shell via getpwuid() for current user, falling back to /bin/sh', file=sys.stderr)

View File

@@ -2909,6 +2909,7 @@ agr('advanced', 'Advanced')
opt('shell', '.',
long_text='''
The shell program to execute. The default value of :code:`.` means to use
the value of of the :envvar:`SHELL` environment variable or if unset,
whatever shell is set as the default shell for the current user. Note that on
macOS if you change this, you might need to add :code:`--login` and
:code:`--interactive` to ensure that the shell starts in interactive mode and