neofetch_util.py 515 B

1234567891011121314151617181920212223
  1. import os
  2. from subprocess import check_output
  3. import pkg_resources
  4. def get_command_path() -> str:
  5. """
  6. Get the absolute path of the neofetch command
  7. :return: Command path
  8. """
  9. return pkg_resources.resource_filename(__name__, 'scripts/neofetch_mod.sh')
  10. def get_distro_ascii_lines() -> int:
  11. """
  12. Get how many lines are in the distro ascii
  13. :return: Number of lines
  14. """
  15. out = check_output([get_command_path(), "print_ascii"])
  16. return len(out.decode().strip().split('\n'))