Skip to content

Use session's start_directory in session creation #197

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ Here you can find the recent changes to tmuxp

current
-------
- :issue:`197` The `start_directory` toplevel config now sets the session's
`start-directory`. This affects the working directory of newly created
windows in that session.
- :issue:`623` Move docs from RTD to self-serve site
- :issue:`623` Modernize Makefiles
- :issue:`623` New development docs
Expand Down
11 changes: 10 additions & 1 deletion tmuxp/workspacebuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from libtmux.server import Server
from libtmux.session import Session
from libtmux.window import Window
from libtmux.common import has_version

from . import exc
from .util import run_before_script
Expand Down Expand Up @@ -137,8 +138,16 @@ def build(self, session=None):
'Session name %s is already running.' % self.sconf['session_name']
)
else:
if not has_version('1.8'):
self.sconf['start_directory'] = self.sconf.get(
'start_directory', None
)
else:
self.sconf['start_directory'] = None

session = self.server.new_session(
session_name=self.sconf['session_name']
session_name=self.sconf['session_name'],
start_directory=self.sconf['start_directory'],
)

assert self.sconf['session_name'] == session.name
Expand Down