Add an option to override the default shell
This commit is contained in:
parent
5d082d8d5a
commit
6ad49bd7fb
@ -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
|
||||
|
||||
@ -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):
|
||||
|
||||
@ -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:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user