[F] Fix backslashes escape in HyFetch
https://github.com/hykilpikonna/hyfetch/issues/19
This commit is contained in:
parent
f54c45fbd0
commit
881534987b
1 changed files with 9 additions and 1 deletions
|
@ -238,7 +238,12 @@ def get_distro_ascii(distro: str | None = None) -> str:
|
||||||
os.environ['CUSTOM_DISTRO'] = distro
|
os.environ['CUSTOM_DISTRO'] = distro
|
||||||
cmd = 'print_custom_ascii'
|
cmd = 'print_custom_ascii'
|
||||||
|
|
||||||
return normalize_ascii(run_command(cmd, True))
|
asc = run_command(cmd, True)
|
||||||
|
|
||||||
|
# Unescape backslashes here because backslashes are escaped in neofetch for printf
|
||||||
|
asc = asc.replace('\\\\', '\\')
|
||||||
|
|
||||||
|
return normalize_ascii(asc)
|
||||||
|
|
||||||
|
|
||||||
def get_distro_name():
|
def get_distro_name():
|
||||||
|
@ -256,6 +261,9 @@ def run_neofetch(preset: ColorProfile, alignment: ColorAlignment):
|
||||||
w, h = ascii_size(asc)
|
w, h = ascii_size(asc)
|
||||||
asc = alignment.recolor_ascii(asc, preset)
|
asc = alignment.recolor_ascii(asc, preset)
|
||||||
|
|
||||||
|
# Escape backslashes here because backslashes are escaped in neofetch for printf
|
||||||
|
asc = asc.replace('\\', '\\\\')
|
||||||
|
|
||||||
# Write temp file
|
# Write temp file
|
||||||
with TemporaryDirectory() as tmp_dir:
|
with TemporaryDirectory() as tmp_dir:
|
||||||
tmp_dir = Path(tmp_dir)
|
tmp_dir = Path(tmp_dir)
|
||||||
|
|
Loading…
Reference in a new issue