From e376c79ddadd65454a40941f553c56503e6c22cb Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 8 Aug 2021 09:42:07 +0530 Subject: [PATCH] Show the current theme name in kitty.conf as well --- kittens/themes/collection.py | 6 +++--- kittens/themes/main.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/kittens/themes/collection.py b/kittens/themes/collection.py index ce7755b9c..ffea42cd8 100644 --- a/kittens/themes/collection.py +++ b/kittens/themes/collection.py @@ -28,8 +28,8 @@ MARK_BEFORE = '\033[33m' MARK_AFTER = '\033[39m' -def patch_conf(raw: str) -> str: - addition = '# BEGIN_KITTY_THEME\ninclude current-theme.conf\n# END_KITTY_THEME' +def patch_conf(raw: str, theme_name: str) -> str: + addition = f'# BEGIN_KITTY_THEME\n# {theme_name}\ninclude current-theme.conf\n# END_KITTY_THEME' nraw, num = re.subn(r'^# BEGIN_KITTY_THEME.+?# END_KITTY_THEME', addition, raw, flags=re.MULTILINE | re.DOTALL) if not num: if raw: @@ -263,7 +263,7 @@ class Theme: raw = f.read() except FileNotFoundError: raw = '' - nraw = patch_conf(raw) + nraw = patch_conf(raw, self.name) if raw: with open(confpath + '.bak', 'w') as f: f.write(raw) diff --git a/kittens/themes/main.py b/kittens/themes/main.py index 8c6ae4ca5..a4bd05712 100644 --- a/kittens/themes/main.py +++ b/kittens/themes/main.py @@ -565,7 +565,7 @@ def main(args: List[str]) -> None: input(_('Press Enter to quit')) return None if len(items) > 1: - items = [' '.join(items[1:])] + items = [' '.join(items)] if len(items) == 1: return non_interactive(cli_opts, items[0])