From 77f651cb5dda70682f84e6ebd785e6e0206be294 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 16 Jun 2018 10:18:48 +0530 Subject: [PATCH] Expand env vars for the start_session config variable --- kitty/config_data.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/kitty/config_data.py b/kitty/config_data.py index 715338e16..3d575b5f7 100644 --- a/kitty/config_data.py +++ b/kitty/config_data.py @@ -3,6 +3,7 @@ # License: GPL v3 Copyright: 2018, Kovid Goyal # Utils {{{ +import os from gettext import gettext as _ from . import fast_data_types as defines @@ -616,10 +617,20 @@ opening new windows, closing windows, reading the content of windows, etc. Note that this even works over ssh connections. ''')) -o('startup_session', 'none', option_type=lambda x: (None if x.lower() == 'none' else x), long_text=_(''' + +def startup_session(x): + if x.lower() == 'none': + return + x = os.path.expanduser(x) + return os.path.expandvars(x) + + +o('startup_session', 'none', option_type=startup_session, long_text=_(''' 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 -instances. See :ref:`sessions` in the kitty documentation for details. +instances. See :ref:`sessions` in the kitty documentation for details. Note +that relative paths are interpreted with respect to the working directory +of the kitty process. Environment variables in the path are expanded. ''')) o('clipboard_control', 'write-clipboard write-primary', option_type=lambda x: frozenset(x.lower().split()), long_text=_('''