Guest User

Untitled

a guest
Sep 14th, 2020
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. #!/usr/bin/env python
  2. import platform, subprocess, re
  3.  
  4. subprocess.run('clear')
  5.  
  6. uname = platform.uname()
  7. xid = subprocess.getoutput('xprop -root -notype _NET_SUPPORTING_WM_CHECK')
  8. xid=xid[-8:]
  9.  
  10. BOLD = '\033[1m'
  11. END = '\033[0m'
  12.  
  13.  
  14. host = subprocess.getoutput('whoami')+"@"+uname[1]
  15.  
  16. distro = subprocess.getoutput('cat /etc/os-release')
  17. distro = re.findall(r'_NAME=\"(.*)\"', distro)[0].lower()
  18.  
  19. kernel = subprocess.getoutput('uname').lower()+' '+subprocess.getoutput('uname --kernel-release')
  20.  
  21. wm = subprocess.getoutput('xprop -id '+xid+' -notype -len 100 -f _NET_WM_NAME 8t')
  22. wm = re.findall(r'_NET_WM_NAME = \"(\w+)\"', wm)
  23. if len(wm) > 0:
  24. wm = wm[0].lower()
  25. else:
  26. wm = 'none'
  27.  
  28. uptime = subprocess.getoutput('uptime -p').replace('up ','')
  29. if uptime == '':
  30. uptime = 'meow'
  31.  
  32.  
  33. print(''' ┌────────────────────┐''')
  34. print(''' │ >_ │ {}'''.format(BOLD+host+END))
  35. print(''' │ │ {}'''.format('-'*len(host)))
  36. print(''' │ │ {}'''.format(BOLD+'distro: '+END+distro))
  37. print(''' │ │ {}'''.format(BOLD+'kernel: '+END+kernel))
  38. print(''' │ │ {}'''.format(BOLD+'wm: '+END+wm))
  39. print(''' │ │ {}'''.format(BOLD+'uptime: '+END+uptime))
  40. print(''' │ │''')
  41. print(''' └────────────────────┘\n''')
Add Comment
Please, Sign In to add comment