mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-13 04:03:16 +02:00
Fix reloading of config not working when kitty.conf does not exist when kitty is launched
Fixes #5071
This commit is contained in:
@@ -1964,8 +1964,10 @@ class Boss:
|
||||
''')
|
||||
def load_config_file(self, *paths: str, apply_overrides: bool = True) -> None:
|
||||
from .config import load_config
|
||||
from .cli import default_config_paths
|
||||
old_opts = get_options()
|
||||
paths = paths or old_opts.config_paths
|
||||
prev_paths = old_opts.config_paths or default_config_paths(self.args.config)
|
||||
paths = paths or prev_paths
|
||||
bad_lines: List[BadLine] = []
|
||||
opts = load_config(*paths, overrides=old_opts.config_overrides if apply_overrides else None, accumulate_bad_lines=bad_lines)
|
||||
if bad_lines:
|
||||
|
||||
@@ -787,9 +787,13 @@ def parse_args(
|
||||
SYSTEM_CONF = f'/etc/xdg/{appname}/{appname}.conf'
|
||||
|
||||
|
||||
def default_config_paths(conf_paths: Sequence[str]) -> Tuple[str, ...]:
|
||||
return tuple(resolve_config(SYSTEM_CONF, defconf, conf_paths))
|
||||
|
||||
|
||||
def create_opts(args: CLIOptions, accumulate_bad_lines: Optional[List[BadLineType]] = None) -> KittyOpts:
|
||||
from .config import load_config
|
||||
config = tuple(resolve_config(SYSTEM_CONF, defconf, args.config))
|
||||
config = default_config_paths(args.config)
|
||||
# Does not cover the case where `name =` when `=` is the value.
|
||||
pat = re.compile(r'^([a-zA-Z0-9_]+)[ \t]*=')
|
||||
overrides = (pat.sub(r'\1 ', a.lstrip()) for a in args.override or ())
|
||||
@@ -799,6 +803,6 @@ def create_opts(args: CLIOptions, accumulate_bad_lines: Optional[List[BadLineTyp
|
||||
|
||||
def create_default_opts() -> KittyOpts:
|
||||
from .config import load_config
|
||||
config = tuple(resolve_config(SYSTEM_CONF, defconf, ()))
|
||||
config = default_config_paths(())
|
||||
opts = load_config(*config)
|
||||
return opts
|
||||
|
||||
Reference in New Issue
Block a user