Merge branch 'hykilpikonna:master' into master

This commit is contained in:
Tilman Holube 2024-05-30 18:29:10 +02:00 committed by GitHub
commit 270334a385
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
27 changed files with 916 additions and 125 deletions

View file

@ -1 +1 @@
VERSION = '1.5.0alpha1'
VERSION = '1.5.0alpha3'

View file

@ -2,7 +2,7 @@
from . import AsciiArt
adélie = AsciiArt(match=r'''"Adélie"* | "Adelie"*''', color='4 7 6', ascii=r"""
adelie = AsciiArt(match=r'''"Adélie"* | "Adelie"*''', color='4 7 6', ascii=r"""
${c1} ${c3} ,-^-___
${c3} /\\\///
${c2}refined.${c1} /\\\\//

View file

@ -1,25 +0,0 @@
# This file is automatically generated. Please do not modify.
from . import AsciiArt
aosc_os_retro = AsciiArt(match=r'''"AOSC OS/Retro"*''', color='4 7 1 3', ascii=r"""
${c2} .........
...................
.....................${c1}################${c2}
.............. ....${c1}################${c2}
.............. ...${c1}################${c2}
............. ..${c1}****************${c2}
............ . .${c1}****************${c2}
........... ... ${c1}................${c2}
.......... ..... ${c1}...............${c2}
......... ....... ...
.${c3}...... ${c2}.
${c3}..... .....${c2}.... ${c4}...........
${c3}.... ......${c2}. ${c4}...........
${c3}... ....... ${c4}...........
${c3}................ ${c4}***********
${c3}................ ${c4}###########
${c3}****************
${c3}################
""")

View file

@ -1,16 +0,0 @@
# This file is automatically generated. Please do not modify.
from . import AsciiArt
aoscosretro_small = AsciiArt(match=r'''"aoscosretro_small"''', color='4 7 1 3', ascii=r"""
${c2} _____ ${c1}_____${c2}
-' '-${c1}| |${c2}
/ ___ ${c1}| |${c2}
| / _ \${c1}|_____|${c2}
' / /_\ \
\ / _____ \${c4}___
${c3}|${c2}/_/ ${c3}| ${c4}| |
${c3}| | ${c4}|___|
${c3}|_____|
""")

View file

@ -1,25 +0,0 @@
# This file is automatically generated. Please do not modify.
from . import AsciiArt
aster = AsciiArt(match=r'''"Aster"*''', color='6 6', ascii=r"""
${c1} ...''...
${c1} .;oOXWMWNXXXNMMN0d:.
${c1} .oXMWOo;.. ..:oO;
${c1} ;KMWx, co,
${c1} 'KMNl dMMW.
${c1} oMMx xMMMMk
${c1} xMM: dMMMMMM;
${c1} cMMl dMMMMMMMW
${c1} NMK xMMMx::dXMx
${c1} ,MMl xMMN' .o.
${c1} cMM; dMMW'
${c1} ;MMc oMMW,
${c1} WMK dMMW, ccccccc.
${c1} lMMl oMMM; ooooooo.
${c1} OMMc ...
${c1} xMMx
${c1} ;XMN:
${c1} ,.
""")

View file

@ -0,0 +1,25 @@
# This file is automatically generated. Please do not modify.
from . import AsciiArt
chimera = AsciiArt(match=r'''"Chimera"*''', color='1 5 4 1', ascii=r"""
${c3}ddddddddddddddc ${c1},cc:
${c3}ddddddddddddddc ${c1},cc:
${c3}ddddddddddddddd ${c1},cc:
${c3}ddddddddddddl:' ${c1},cc:
${c3}dddddddddl' ${c1}..;cc:
${c3}dddddddo. ${c1},:cccccc:
${c3}ddddddl ${c1},ccc:'''''
${c3}dddddo. ${c1};ccc. ............
.ccc. cccccccccccc
${c2}...... ${c1}.ccc. .ccc'''''''''
${c2}OOOOOk. ${c1};ccc. .ccc; ......
${c2}OOOOOOd ${c1}'ccc:,....,:ccc' ${c4}coooooo
${c2}OOOOOOOx. ${c1}':cccccccc:' ${c4}.looooooo
${c2}OOOOOOOOOd, ${c1}`'''` ${c4}.coooooooo
${c2}OOOOOOOOOOOOdc,. ${c4}..,coooooooooooo
${c2}OOOOOOOOOOOOOOOO' ${c4}.oooooooooooooooo
${c2}OOOOOOOOOOOOOOOO' ${c4}.oooooooooooooooo
${c2}OOOOOOOOOOOOOOOO' ${c4}.oooooooooooooooo
""")

View file

@ -9,8 +9,8 @@ def detect(name: str) -> AsciiArt | None:
return None
name = name.lower()
if name.startswith('adélie') or name.startswith('adelie'):
from .adélie import adélie
return adélie
from .adelie import adelie
return adelie
if name.startswith('aix'):
from .aix import aix
@ -304,6 +304,10 @@ def detect(name: str) -> AsciiArt | None:
from .chapeau import chapeau
return chapeau
if name.startswith('chimera'):
from .chimera import chimera
return chimera
if name.startswith('chonkysealos'):
from .chonkysealos import chonkysealos
return chonkysealos
@ -476,6 +480,10 @@ def detect(name: str) -> AsciiArt | None:
from .evolutionos import evolutionos
return evolutionos
if name.startswith('eweos'):
from .eweos import eweos
return eweos
if name.startswith('exherbo'):
from .exherbo import exherbo
return exherbo
@ -1476,6 +1484,10 @@ def detect(name: str) -> AsciiArt | None:
from .xenia import xenia
return xenia
if name.startswith('tatra'):
from .tatra import tatra
return tatra
if name.startswith('zorin'):
from .zorin import zorin
return zorin

22
hyfetch/distros/eweos.py Normal file
View file

@ -0,0 +1,22 @@
# This file is automatically generated. Please do not modify.
from . import AsciiArt
eweos = AsciiArt(match=r'''"eweOS"*''', color='7 11 9 8 1', ascii=r"""
${c2} #####%%%
${c2} ##%%${c3}////${c2}%%%%%${c3}///
${c2} #%%%%${c3}////((((////${c2}%
${c1} *@@@@@@@${c3}/${c5},,,${c3}/////${c5},,,${c2}%${c1}@@@@@@@
${c1} .@@@@@@@@@@@${c3}////////${c2}%%%${c1}@@@@@@@@@@@@
${c1} @@@${c4}...${c1}@@@@@@${c3}////${c2}%%${c3}////${c1}@@@@@@@@@@@@@@@@
${c1} @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
${c1} @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
${c1} @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
${c1} @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
${c1} @@@@@@@@@@@@@@@@@@@@@@@@@@@@@
${c1} @@@@@@@@@@@@@@@@@@@@@@@@@@@
${c1} @@@@@@@@@@@@@@@@@@@@@@@
${c1} @@@@@@ @@@@@@
${c1} @@@ @@@
""")

View file

@ -1,16 +0,0 @@
# This file is automatically generated. Please do not modify.
from . import AsciiArt
openwrt = AsciiArt(match=r'''"OpenWrt"*''', color='4 7 1', ascii=r"""
${c1} _______
| |.-----.-----.-----.
| - || _ | -__| |
|_______|| __|_____|__|__|
|__|
________ __
| | | |.----.| |_
| | | || _|| _|
|________||__| |____|
""")

23
hyfetch/distros/tatra.py Normal file
View file

@ -0,0 +1,23 @@
# This file is automatically generated. Please do not modify.
from . import AsciiArt
tatra = AsciiArt(match=r'''"Tatra"*''', color='4 7', ascii=r"""
${c1}
. .:. . .:.
.^^.!.:::. .^!?J?^
.:^.^!!!~:~^. .7??77!~~^.
.~^.!??77?!.^~: ..:^^7JJJ7~~^.
.^~.^7???7~.~~. .7??????????!
.:^:^^~^^:!^ ^: .......^!:...
.!7~.::.!.::. ~BG~ :^ ^~:
:!!~ ~. ?BBBB! ^?J!. .!~.
:!. .JBY. .Y#BBBY?~!???J7. :^^.
.. :5#B#P~P#BBP?7?55J?J7:
^P#BBBBBBBB5?7J5555J!.....
!BBBBBBGBBGJ77::Y555J?77777^
?BBBBG5JJ5PJ?!: .?Y??????77?~.
.YBGPYJ??????Y?^^^^~7?????????7?!.
.^^:..::::::::.....:::::::::::..:.
""")

View file

@ -3,6 +3,7 @@ from __future__ import annotations
import argparse
import datetime
import importlib.util
import json
import random
import traceback
@ -286,9 +287,33 @@ def create_config() -> Config:
update_title('Color alignment', color_alignment)
##############################
# 6. Select *fetch backend
def select_backend():
clear_screen(title)
print_title_prompt('Select a *fetch backend')
# Check if fastfetch is installed
ff_path = fastfetch_path()
# Check if qwqfetch is installed (if the qwqfetch module can be imported)
has_qwqfetch = importlib.util.find_spec('qwqfetch') is not None
printc('- &bneofetch&r: Written in bash, &nbest compatibility&r on Unix systems')
printc('- &bfastfetch&r: Written in C, &nbest performance&r ' +
('&c(Not installed)' if ff_path is None else f'&a(Installed at {ff_path})'))
printc('- &bqwqfetch&r: Pure python, &nminimal dependencies&r ' +
('&c(Not installed)' if not has_qwqfetch else ''))
print()
return literal_input('Your choice?', ['neofetch', 'fastfetch', 'qwqfetch'], 'neofetch')
backend = select_backend()
update_title('Selected backend', backend)
# Create config
clear_screen(title)
c = Config(preset, color_system, light_dark, lightness, color_alignment)
c = Config(preset, color_system, light_dark, lightness, color_alignment, backend)
# Save config
print()

View file

@ -245,7 +245,8 @@ def run_neofetch_cmd(args: str, pipe: bool = False) -> str | None:
Run neofetch command
"""
if platform.system() != 'Windows':
full_cmd = ['/usr/bin/env', 'bash', get_command_path(), *shlex.split(args)]
bash = ['/usr/bin/env', 'bash'] if Path('/usr/bin/env').is_file() else [shutil.which('bash')]
full_cmd = [*bash, get_command_path(), *shlex.split(args)]
else:
cmd = get_command_path().replace("\\", "/").replace("C:/", "/c/")
@ -343,7 +344,7 @@ def run_neofetch(asc: str, args: str = ''):
with TemporaryDirectory() as tmp_dir:
tmp_dir = Path(tmp_dir)
path = tmp_dir / 'ascii.txt'
path.write_text(asc)
path.write_text(asc, 'utf-8')
# Call neofetch with the temp file
if args:
@ -351,6 +352,13 @@ def run_neofetch(asc: str, args: str = ''):
run_neofetch_cmd(f'--ascii --source {path.absolute()} --ascii-colors' + args)
def fastfetch_path() -> Path | None:
return (shutil.which('fastfetch')
or if_file(SRC / 'fastfetch/usr/bin/fastfetch')
or if_file(SRC / 'fastfetch/fastfetch')
or if_file(SRC / 'fastfetch/fastfetch.exe'))
def run_fastfetch(asc: str, args: str = '', legacy: bool = False):
"""
Run neofetch with colors
@ -360,10 +368,7 @@ def run_fastfetch(asc: str, args: str = '', legacy: bool = False):
:param legacy: Set true when using fastfetch < 1.8.0
"""
# Find fastfetch binary
ff_path = (shutil.which('fastfetch')
or if_file(SRC / 'fastfetch/usr/bin/fastfetch')
or if_file(SRC / 'fastfetch/fastfetch')
or if_file(SRC / 'fastfetch/fastfetch.exe'))
ff_path = fastfetch_path()
if not ff_path:
printc("&cError: fastfetch binary is not found. Please install fastfetch first.")
@ -373,7 +378,7 @@ def run_fastfetch(asc: str, args: str = '', legacy: bool = False):
with TemporaryDirectory() as tmp_dir:
tmp_dir = Path(tmp_dir)
path = tmp_dir / 'ascii.txt'
path.write_text(asc)
path.write_text(asc, 'utf-8')
# Call fastfetch with the temp file
proc = subprocess.run([ff_path, '--raw' if legacy else '--file-raw', path.absolute(), *shlex.split(args)])
@ -410,5 +415,6 @@ fore_back = {
'ubuntu-mate': (2, 1),
'ubuntu-studio': (2, 1),
'ubuntu-sway': (2, 1),
'ultramarine': (2, 1),
}

View file

@ -670,6 +670,14 @@ PRESETS: dict[str, ColorProfile] = {
"#89C7B0",
"#F3EDBD",
]),
# sampled from https://es.m.wikipedia.org/wiki/Archivo:Fraysexual_flag.jpg
'fraysexual': ColorProfile([
'#226CB5',
'#94E7DD',
'#FFFFFF',
'#636363',
]),
# Meme flags
'beiyang': ColorProfile([
@ -687,4 +695,17 @@ PRESETS: dict[str, ColorProfile] = {
'#7D3829',
'#F3A26A',
]),
# colors from Gilbert Baker's original 1978 flag design
# used https://gilbertbaker.com/rainbow-flag-color-meanings/ as source and colorpicked
'baker': ColorProfile([
'#F23D9E',
'#F80A24',
'#F78022',
'#F9E81F',
'#1E972E',
'#1B86BC',
'#243897',
'#6F0A82',
])
}

View file

@ -1,4 +1,7 @@
from typing_extensions import Literal
try:
from typing import Literal
except ImportError:
from typing_extensions import Literal
AnsiMode = Literal['default', 'ansi', '8bit', 'rgb']
LightDark = Literal['light', 'dark']