summaryrefslogtreecommitdiff
path: root/archey
diff options
context:
space:
mode:
authorMelik Manukyan <melik@archlinux.us>2010-01-11 09:59:56 -0800
committerMelik Manukyan <melik@archlinux.us>2010-01-11 09:59:56 -0800
commitc7da02819908540623d2250aeac69838afedec7e (patch)
tree2dfbbc5175218f47a3ef5ac67c0da304a63f8ebe /archey
parent5089612f856cd06ced2c4c4b677a1d24042537bc (diff)
Added support for CPU/RAM and various other WM's
Diffstat (limited to 'archey')
-rw-r--r--archey27
1 files changed, 22 insertions, 5 deletions
diff --git a/archey b/archey
index 9e40915..a3c20e8 100644
--- a/archey
+++ b/archey
@@ -10,7 +10,7 @@
# System information.
# Import libraries
-import subprocess, optparse
+import subprocess, optparse, re
from subprocess import Popen, PIPE
from optparse import OptionParser
@@ -25,6 +25,8 @@ display = [
'wm', # Display WM
'de', # Display DE
'packages', # Display Number of Packages Installed
+ 'ram', # Display RAM usage
+ 'cpu', # Display CPU
# 'fs:/boot', # Display /boot partition
# 'fs:/home', # Display /home partition
# 'fs:/MOUNT/POINT', # Display any partition, edit to your needs
@@ -65,14 +67,16 @@ wm_dict = {'awesome': 'Awesome',
'enlightenment': 'Enlightenment',
'fluxbox': 'Fluxbox',
'fvwm': 'FVWM',
- 'icewm': 'icewm',
+ 'icewm': 'IceWM',
'kwin': 'KWin',
'metacity': 'Metacity',
- 'openbox': 'Openbox',
- 'wmaker': 'Window Maker',
+ 'musca': 'Musca',
+ 'openbox': 'Openbox',
+ 'pekwm': 'PekWM',
+ 'wmaker': 'Window Maker',
'wmii': 'wmii',
'xfwm4': 'Xfwm',
- 'xmonad': 'xmonad'}
+ 'xmonad': 'Xmonad'}
# Find running processes.
p1 = Popen(['ps', '-A'], stdout=PIPE).communicate()[0].split('\n')
@@ -87,6 +91,13 @@ def output(key, value):
# Screenshot Function
screen = '%s' % options.screenshot
+# RAM Function
+def ram_display():
+ raminfo = Popen(['free', '-m'], stdout=PIPE).communicate()[0].split('\n')
+ ram = ''.join(filter(re.compile('M').search, raminfo)).split()
+ used = int(ram[2]) - int(ram[5]) - int(ram[6])
+ output ('RAM', '%s MB / %s MB' % (used, ram[1]))
+
def screenshot():
subprocess.check_call(['scrot', '-cd5'])
@@ -106,6 +117,12 @@ def hostname_display():
hostname = Popen(['uname', '-n'], stdout=PIPE).communicate()[0].rstrip('\n')
output ('Hostname', hostname)
+# CPU Function
+def cpu_display():
+ file = open('/proc/cpuinfo').readlines()
+ cpuinfo = file[4].replace('model name\t: ', '').rstrip('\n').replace('\t', ' ').replace('\t\t', ' ').replace(' ', '').replace(' ', '').replace(' ', '').replace(' ', '').replace(' ', '')
+ output ('CPU', cpuinfo)
+
# Uptime Function
def uptime_display():
fuptime = int(open('/proc/uptime').read().split('.')[0])