parent
f046884f23
commit
5ff1dadf0d
@ -763,8 +763,11 @@ class Boss:
|
|||||||
args.args = rest
|
args.args = rest
|
||||||
opts = create_opts(args)
|
opts = create_opts(args)
|
||||||
if data['session_data']:
|
if data['session_data']:
|
||||||
from .session import PreReadSession
|
if data['session_data'] == 'none':
|
||||||
args.session = PreReadSession(data['session_data'], data['environ'])
|
args.session = 'none'
|
||||||
|
else:
|
||||||
|
from .session import PreReadSession
|
||||||
|
args.session = PreReadSession(data['session_data'], data['environ'])
|
||||||
else:
|
else:
|
||||||
args.session = ''
|
args.session = ''
|
||||||
if not os.path.isabs(args.directory):
|
if not os.path.isabs(args.directory):
|
||||||
|
|||||||
@ -898,6 +898,8 @@ Path to a file containing the startup :italic:`session` (tabs, windows, layout,
|
|||||||
programs). Use - to read from STDIN. See the :file:`README` file for details and
|
programs). Use - to read from STDIN. See the :file:`README` file for details and
|
||||||
an example. Environment variables in the file name are expanded,
|
an example. Environment variables in the file name are expanded,
|
||||||
relative paths are resolved relative to the kitty configuration directory.
|
relative paths are resolved relative to the kitty configuration directory.
|
||||||
|
The special value :code:`none` means no session will be used, even if
|
||||||
|
the :opt:`startup_session` option has been specified in kitty.conf.
|
||||||
|
|
||||||
|
|
||||||
--hold
|
--hold
|
||||||
|
|||||||
@ -85,6 +85,8 @@ def talk_to_instance(args: CLIOptions) -> None:
|
|||||||
session_data = ''
|
session_data = ''
|
||||||
if args.session == '-':
|
if args.session == '-':
|
||||||
session_data = sys.stdin.read()
|
session_data = sys.stdin.read()
|
||||||
|
elif args.session == 'none':
|
||||||
|
session_data = 'none'
|
||||||
elif args.session:
|
elif args.session:
|
||||||
with open(args.session) as f:
|
with open(args.session) as f:
|
||||||
session_data = f.read()
|
session_data = f.read()
|
||||||
|
|||||||
@ -2938,7 +2938,7 @@ opt('startup_session', 'none',
|
|||||||
option_type='config_or_absolute_path',
|
option_type='config_or_absolute_path',
|
||||||
long_text='''
|
long_text='''
|
||||||
Path to a session file to use for all kitty instances. Can be overridden by
|
Path to a session file to use for all kitty instances. Can be overridden by
|
||||||
using the :option:`kitty --session` command line option for individual
|
using the :option:`kitty --session` :code:`=none` command line option for individual
|
||||||
instances. See :ref:`sessions` in the kitty documentation for details. Note that
|
instances. See :ref:`sessions` in the kitty documentation for details. Note that
|
||||||
relative paths are interpreted with respect to the kitty config directory.
|
relative paths are interpreted with respect to the kitty config directory.
|
||||||
Environment variables in the path are expanded. Changing this option by
|
Environment variables in the path are expanded. Changing this option by
|
||||||
|
|||||||
@ -205,19 +205,22 @@ def create_sessions(
|
|||||||
default_session: Optional[str] = None,
|
default_session: Optional[str] = None,
|
||||||
) -> Iterator[Session]:
|
) -> Iterator[Session]:
|
||||||
if args and args.session:
|
if args and args.session:
|
||||||
environ: Optional[Mapping[str, str]] = None
|
if args.session == "none":
|
||||||
if isinstance(args.session, PreReadSession):
|
default_session = "none"
|
||||||
session_data = '' + str(args.session)
|
|
||||||
environ = args.session.associated_environ # type: ignore
|
|
||||||
else:
|
else:
|
||||||
if args.session == '-':
|
environ: Optional[Mapping[str, str]] = None
|
||||||
f = sys.stdin
|
if isinstance(args.session, PreReadSession):
|
||||||
|
session_data = '' + str(args.session)
|
||||||
|
environ = args.session.associated_environ # type: ignore
|
||||||
else:
|
else:
|
||||||
f = open(resolve_custom_file(args.session))
|
if args.session == '-':
|
||||||
with f:
|
f = sys.stdin
|
||||||
session_data = f.read()
|
else:
|
||||||
yield from parse_session(session_data, opts, environ=environ)
|
f = open(resolve_custom_file(args.session))
|
||||||
return
|
with f:
|
||||||
|
session_data = f.read()
|
||||||
|
yield from parse_session(session_data, opts, environ=environ)
|
||||||
|
return
|
||||||
if default_session and default_session != 'none':
|
if default_session and default_session != 'none':
|
||||||
try:
|
try:
|
||||||
with open(default_session) as f:
|
with open(default_session) as f:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user