Show the current theme name in kitty.conf as well

This commit is contained in:
Kovid Goyal 2021-08-08 09:42:07 +05:30
parent 5a47e0d2e4
commit e376c79dda
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 4 additions and 4 deletions

View File

@ -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)

View File

@ -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])