diff --git a/docs/changelog.rst b/docs/changelog.rst index 1898ebc08..300fbc019 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -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] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/docs/glossary.rst b/docs/glossary.rst index 786964264..9fec5a5ae 100644 --- a/docs/glossary.rst +++ b/docs/glossary.rst @@ -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. diff --git a/kitty/constants.py b/kitty/constants.py index 1cebea914..d5ff4fca3 100644 --- a/kitty/constants.py +++ b/kitty/constants.py @@ -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) diff --git a/kitty/options/definition.py b/kitty/options/definition.py index 6f428e022..07f9009e8 100644 --- a/kitty/options/definition.py +++ b/kitty/options/definition.py @@ -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