Add new actions to open tabs/windows with the working directory set to the working directory of the current window

Fixes #237
This commit is contained in:
Kovid Goyal
2017-12-21 11:29:21 +05:30
parent 448ffe01c3
commit c5acd94456
6 changed files with 78 additions and 34 deletions

View File

@@ -85,7 +85,7 @@ def parse_session(raw, opts):
return ans
def create_session(opts, args=None, special_window=None):
def create_session(opts, args=None, special_window=None, cwd_from=None):
if args and args.session:
with open(args.session) as f:
return parse_session(f.read(), opts)
@@ -100,11 +100,11 @@ def create_session(opts, args=None, special_window=None):
ans.tabs[-1].layout = current_layout
if special_window is None:
cmd = args.args if args and args.args else [shell_path]
from kitty.tabs import SpecialWindow
if getattr(args, 'title', None):
from kitty.tabs import SpecialWindow
ans.add_window(SpecialWindow(cmd, override_title=args.title))
ans.add_window(SpecialWindow(cmd, override_title=args.title, cwd_from=cwd_from))
else:
ans.add_window(cmd)
ans.add_window(SpecialWindow(cmd, cwd_from=cwd_from))
else:
ans.add_special_window(special_window)
return ans