diff --git a/kitty/kitty.conf b/kitty/kitty.conf index e7ee06f18..4a8ba7320 100644 --- a/kitty/kitty.conf +++ b/kitty/kitty.conf @@ -104,6 +104,10 @@ click_interval 0.5 # database will be matched. select_by_word_characters :@-./_~?&=%+# +# The shell program to execute. The default value of . means +# to use whatever shell is set as the default shell for the current user. +shell . + # Hide mouse cursor after the specified number of seconds of the mouse not being used. Set to # zero to disable mouse cursor hiding. mouse_hide_wait 3.0 diff --git a/kitty/session.py b/kitty/session.py index 545834ee1..75da65a0d 100644 --- a/kitty/session.py +++ b/kitty/session.py @@ -64,6 +64,15 @@ class Session: self.tabs[-1].cwd = val +def resolved_shell(opts): + ans = opts.shell + if ans == '.': + ans = [shell_path] + else: + ans = shlex.split(ans) + return ans + + def parse_session(raw, opts): ans = Session() ans.add_tab(opts) @@ -90,7 +99,7 @@ def parse_session(raw, opts): raise ValueError('Unknown command in session file: {}'.format(cmd)) for t in ans.tabs: if not t.windows: - t.windows.append([shell_path]) + t.windows.append(resolved_shell(opts)) return ans @@ -108,7 +117,7 @@ def create_session(opts, args=None, special_window=None, cwd_from=None): ans.add_tab(opts) ans.tabs[-1].layout = current_layout if special_window is None: - cmd = args.args if args and args.args else [shell_path] + cmd = args.args if args and args.args else resolved_shell(opts) from kitty.tabs import SpecialWindow k = {'cwd_from': cwd_from} if getattr(args, 'title', None): diff --git a/kitty/tabs.py b/kitty/tabs.py index 0a39182ce..4a66f1316 100644 --- a/kitty/tabs.py +++ b/kitty/tabs.py @@ -9,15 +9,14 @@ from functools import partial from .borders import Borders from .child import Child from .config import build_ansi_color_table -from .constants import ( - WindowGeometry, appname, get_boss, is_macos, is_wayland, shell_path -) +from .constants import WindowGeometry, appname, get_boss, is_macos, is_wayland from .fast_data_types import ( DECAWM, Screen, add_tab, glfw_post_empty_event, remove_tab, remove_window, set_active_tab, set_active_window, set_tab_bar_render_data, swap_tabs, swap_windows, viewport_for_window, x11_window_id ) from .layout import Rect, all_layouts +from .session import resolved_shell from .utils import color_as_int from .window import Window, calculate_gl_geometry @@ -118,9 +117,9 @@ class Tab: # {{{ def launch_child(self, use_shell=False, cmd=None, stdin=None, cwd_from=None, cwd=None): if cmd is None: if use_shell: - cmd = [shell_path] + cmd = resolved_shell(self.opts) else: - cmd = self.args.args or [shell_path] + cmd = self.args.args or resolved_shell(self.opts) env = {} if not is_macos and not is_wayland: try: