File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # PyFetch
2+ The neofetch alternative that is python-based. Displays information about your desktop.
3+
4+ ## What it does
5+
6+ - Detects your distro and uses python-pyfiglet to display text in ASCII art.
7+ - CPU, RAM, and hostname information.
8+ - If your distro fails to be detected, python-pyfiglet will use the "PyFetch" fallback text.
9+
10+ ## How to install PyFetch
11+
12+ ### From AUR (Arch-only)
13+ ``` bash
14+ yay -S pyfetch
15+ ```
16+
17+ ### Other ways
18+ Unfortunately, there is no other way to install PyFetch (yet).
19+ The only way to do it outside of Arch is by copying the AUR version of it then completely move the pyfetch file to /usr/bin/.
20+ If you don't want to do that, that is your only choice sadly.
21+
22+ ## Dependencies
23+ These are the Dependencies you will need to have in order to use PyFetch:
24+
25+ - python3
26+ - python-pyfiglet
27+
28+ Install python-pyfiglet with:
29+ ``` bash
30+ pip install pyfiglet
31+ ```
32+
33+ ## License
34+ MIT License - see [ LICENSE] ( LICENSE )
35+
36+ ## Credits
37+ Inspired by [ Neofetch] ( https://github.com/dylanaraps/neofetch )
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python3
2+
3+ import platform
4+ import getpass
5+ import socket
6+ import psutil
7+ import pyfiglet
8+ import os
9+
10+ def get_distro_name ():
11+ try :
12+ with open ("/etc/os-release" ) as f :
13+ for line in f :
14+ if line .startswith ("PRETTY_NAME=" ):
15+ return line .strip ().split ("=" )[1 ].strip ('"' )
16+ except FileNotFoundError :
17+ return None
18+
19+ distro = get_distro_name ()
20+ logo_text = distro if distro else "PyFetch"
21+
22+ # Optional: ASCII logo
23+ import pyfiglet
24+ print (pyfiglet .figlet_format (logo_text ))
25+ print (f"User: { getpass .getuser ()} " )
26+ print (f"Hostname: { socket .gethostname ()} " )
27+ print (f"OS: { platform .system ()} { platform .release ()} " )
28+ print (f"CPU: { os .uname ().machine } " )
29+ print (f"RAM: { round (psutil .virtual_memory ().total / (1024 ** 3 ), 2 )} GB" )
You can’t perform that action at this time.
0 commit comments