hykilpikonna / hyfetch

🏳️‍🌈 🏳️‍⚧️ Neofetch with LGBTQ+ pride flags!
MIT License
1.18k stars 93 forks source link

Doesn't work with WSL installed #179

Open RuiNtD opened 10 months ago

RuiNtD commented 10 months ago

Describe the bug

Trying to run hyfetch with WSL installed causes it to launch WSL's bash instead of Git Bash

Expected behavior

Git Bash is run instead of WSL Bash

Screenshots

Config file

I don't have a config file

Additional context

/bin/bash: line 1: /c/Users/ethan/scoop/apps/python/current/Lib/site-packages/hyfetch/scripts/neowofetch: No such file or directory
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\ethan\scoop\apps\python\current\Scripts\hyfetch.exe\__main__.py", line 7, in <module>
  File "C:\Users\ethan\scoop\apps\python\current\Lib\site-packages\hyfetch\main.py", line 375, in run
    config = create_config() if args.config else check_config(args.config_file)
                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ethan\scoop\apps\python\current\Lib\site-packages\hyfetch\main.py", line 34, in check_config
    return create_config()
           ^^^^^^^^^^^^^^^
  File "C:\Users\ethan\scoop\apps\python\current\Lib\site-packages\hyfetch\main.py", line 47, in create_config
    asc = get_distro_ascii()
          ^^^^^^^^^^^^^^^^^^
  File "C:\Users\ethan\scoop\apps\python\current\Lib\site-packages\hyfetch\neofetch_util.py", line 317, in get_distro_ascii
    det = distro_detector.detect(distro or get_distro_name())
                                           ^^^^^^^^^^^^^^^^^
  File "C:\Users\ethan\scoop\apps\python\current\Lib\site-packages\hyfetch\neofetch_util.py", line 338, in get_distro_name
    return run_neofetch_cmd('ascii_distro_name', True)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ethan\scoop\apps\python\current\Lib\site-packages\hyfetch\neofetch_util.py", line 298, in run_neofetch_cmd
    return check_output(full_cmd).decode().strip()
           ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ethan\scoop\apps\python\current\Lib\subprocess.py", line 466, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ethan\scoop\apps\python\current\Lib\subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '[WindowsPath('C:/WINDOWS/system32/bash.exe'), '-c', "'/c/Users/ethan/scoop/apps/python/current/Lib/site-packages/hyfetch/scripts/neowofetch' ascii_distro_name"]' returned non-zero exit status 127.
RuiNtD commented 10 months ago

I'm realizing that if you did try to run it in WSL, it would just give info on WSL instead of Windows. Maybe you could detect if the location of bash.exe is either %windir%\system32\bash.exe or %LocalAppData%\Microsoft\WindowsApps\bash.exe and search the PATH for a bash.exe sitting next to git.exe?

CarterLi commented 10 months ago

Does scoop install fastfetch hyfetch -b fastfetch works for you?

RuiNtD commented 10 months ago

Nope.

> hyfetch -b fastfetch
/bin/bash: line 1: /c/Users/ethan/scoop/apps/python/current/Lib/site-packages/hyfetch/scripts/neowofetch: No such file or directory
Error: Command '[WindowsPath('C:/WINDOWS/system32/bash.exe'), '-c', "'/c/Users/ethan/scoop/apps/python/current/Lib/site-packages/hyfetch/scripts/neowofetch' ascii_distro_name"]' returned non-zero exit status 127.
Traceback (most recent call last):
  File "C:\Users\ethan\scoop\apps\python\current\Lib\site-packages\hyfetch\main.py", line 422, in run
    asc = get_distro_ascii() if not args.ascii_file else Path(args.ascii_file).read_text("utf-8")
          ^^^^^^^^^^^^^^^^^^
  File "C:\Users\ethan\scoop\apps\python\current\Lib\site-packages\hyfetch\neofetch_util.py", line 317, in get_distro_ascii
    det = distro_detector.detect(distro or get_distro_name())
                                           ^^^^^^^^^^^^^^^^^
  File "C:\Users\ethan\scoop\apps\python\current\Lib\site-packages\hyfetch\neofetch_util.py", line 338, in get_distro_name
    return run_neofetch_cmd('ascii_distro_name', True)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ethan\scoop\apps\python\current\Lib\site-packages\hyfetch\neofetch_util.py", line 298, in run_neofetch_cmd
    return check_output(full_cmd).decode().strip()
           ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ethan\scoop\apps\python\current\Lib\subprocess.py", line 466, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ethan\scoop\apps\python\current\Lib\subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '[WindowsPath('C:/WINDOWS/system32/bash.exe'), '-c', "'/c/Users/ethan/scoop/apps/python/current/Lib/site-packages/hyfetch/scripts/neowofetch' ascii_distro_name"]' returned non-zero exit status 127.
CarterLi commented 10 months ago

Strange. Does running fastfetch directly work?

RuiNtD commented 10 months ago

Yep. I'm pretty sure it's still calling neowofetch for the distro ASCII art, because I've noticed that if I call hyfetch directly from Git Bash, it replaces fastfetch's ASCII art for Windows 11 with neowofetch's ASCII art (which is different).

CarterLi commented 10 months ago

fastfetch is using / while neofetch is using #

CarterLi commented 10 months ago

Just tried it myself. Hyfetch forces me installing Git Windows (while fastfetch doesn't use bash and I do have Git Windows installed). If I run hyfetch in Git Bash, it stacks with

Welcome to hyfetch Let's set up some colors first.
1. Detected color mode:           rgb

2. Is your terminal in light mode or dark mode? (light|dark)
>

Even Ctrl+C doesn't work

RuiNtD commented 10 months ago

The issue only occurs if you have WSL, since it adds a bash.exe to PATH. As for the config with Git Bash, I had to copy my config from WSL after setting it up there. The setup not working on Windows is a separate issue.

CarterLi commented 10 months ago

Because of the bad experience, I prefer using fastfetch directly. I customised the logo with

fastfetch --logo-color-1 blue --logo-color-2 green --logo-color-3 cyan --logo-color-4 magenta --logo-padding-top 2

I think it's good-looking enough

image

hykilpikonna commented 10 months ago

Maybe it would be better to make fastfetch the default backend on Windows and somehow install fastfetch as a dependency, since Windows doesn't have a proper built-in bash environment and different third-party implementations come with different quirks...

hykilpikonna commented 10 months ago

Maybe it would be better to make fastfetch the default backend on Windows and somehow install fastfetch as a dependency, since Windows doesn't have a proper built-in bash environment and different third-party implementations come with different quirks...

...but even then the Windows terminal (or CMD on older versions of Windows) wouldn't support outputting ANSI RGB colors with a simple ascii file replacement on the fastfetch backend. So I guess the best bet is still to embed a specific version of git bash into hyfetch packaging.