Show the current theme name in kitty.conf as well
This commit is contained in:
parent
5a47e0d2e4
commit
e376c79dda
@ -28,8 +28,8 @@ MARK_BEFORE = '\033[33m'
|
|||||||
MARK_AFTER = '\033[39m'
|
MARK_AFTER = '\033[39m'
|
||||||
|
|
||||||
|
|
||||||
def patch_conf(raw: str) -> str:
|
def patch_conf(raw: str, theme_name: str) -> str:
|
||||||
addition = '# BEGIN_KITTY_THEME\ninclude current-theme.conf\n# END_KITTY_THEME'
|
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)
|
nraw, num = re.subn(r'^# BEGIN_KITTY_THEME.+?# END_KITTY_THEME', addition, raw, flags=re.MULTILINE | re.DOTALL)
|
||||||
if not num:
|
if not num:
|
||||||
if raw:
|
if raw:
|
||||||
@ -263,7 +263,7 @@ class Theme:
|
|||||||
raw = f.read()
|
raw = f.read()
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
raw = ''
|
raw = ''
|
||||||
nraw = patch_conf(raw)
|
nraw = patch_conf(raw, self.name)
|
||||||
if raw:
|
if raw:
|
||||||
with open(confpath + '.bak', 'w') as f:
|
with open(confpath + '.bak', 'w') as f:
|
||||||
f.write(raw)
|
f.write(raw)
|
||||||
|
|||||||
@ -565,7 +565,7 @@ def main(args: List[str]) -> None:
|
|||||||
input(_('Press Enter to quit'))
|
input(_('Press Enter to quit'))
|
||||||
return None
|
return None
|
||||||
if len(items) > 1:
|
if len(items) > 1:
|
||||||
items = [' '.join(items[1:])]
|
items = [' '.join(items)]
|
||||||
if len(items) == 1:
|
if len(items) == 1:
|
||||||
return non_interactive(cli_opts, items[0])
|
return non_interactive(cli_opts, items[0])
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user