pep-mklive/PepProTools/pfetch

40 lines
1.0 KiB
Python
Executable File

#!/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()