pep-mklive/PepProTools/pfetch

40 lines
1.0 KiB
Plaintext
Raw Permalink Normal View History

2024-10-27 15:16:46 -01:00
#!/usr/bin/python3
"""
* Author: "PeppermintOS Team(peppermintosteam@proton.me)
*
* License: SPDX-License-Identifier: GPL-3.0-or-later
*
* See if neofetch or screenfetch are installen if not run
* our peppermint tool
"""
import subprocess
import os
from pathlib import Path
PMOS_TOOLS = '~/.local/share/pmostools/peptools'
HOME_FOLDER = str(Path(PMOS_TOOLS).expanduser())
PFETCH = HOME_FOLDER + '/pfetch.py'
def check_command_installed(command):
""" See if NEO or SCREEN fetch is installed """
try:
subprocess.check_output(['which', command])
return True
except subprocess.CalledProcessError:
return False
def main():
""" Begin the applicatipon"""
if check_command_installed('neofetch'):
subprocess.run(['neofetch'])
elif check_command_installed('screenfetch'):
subprocess.run(['screenfetch'])
else:
if os.path.exists(PFETCH):
subprocess.run(['python3', PFETCH])
else:
print("Error: pfetch.py not found")
main()