summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDjMelik <melik@archlinux.us>2010-11-17 11:41:15 -0800
committerDjMelik <melik@archlinux.us>2010-11-17 11:41:15 -0800
commitfd19001e5f855a26b13eed0674223a96faf65a69 (patch)
treeaed38935a06e8a6faba9c0b1b34e868ae08ee697
parent29ef86981e54c03488219d425407f50d6fd8b946 (diff)
added process detection
-rw-r--r--archey.new48
1 files changed, 27 insertions, 21 deletions
diff --git a/archey.new b/archey.new
index 373d3b2..d744d20 100644
--- a/archey.new
+++ b/archey.new
@@ -104,11 +104,13 @@ logosDict = {'Arch Linux': '''{color[1]}
\x1b[0m'''
}
+processes = Popen(['ps', '-u', getuser()],stdout=PIPE).communicate()[0].split(b'\n')
+
#---------------Classes---------------#
class Output:
results = []
- results.extend(['']*(14))
+ results.extend(['']*(13))
def __init__(self):
self.distro = self.__detectDistro()
@@ -116,6 +118,8 @@ class Output:
def __detectDistro(self):
if os.path.exists('/etc/pacman.conf'):
return 'Arch Linux'
+ else:
+ sys.exit(1)
def append(self, display):
self.results.append('%s%s: %s%s' % (colorDict[self.distro][1], display.key, colorDict['Clear'][0], display.value))
@@ -154,27 +158,27 @@ class Uptime:
self.key = 'Uptime'
self.value = uptime
-#class WindowManager:
-# def __init__(self):
-# wm = ''
-# for key in wmDict.keys():
-# if processes(key):
-# wm = key
-# break
-#
-# self.key = 'Window Manager'
-# self.value = wm
+class WindowManager:
+ def __init__(self):
+ wm = ''
+ for key in wmDict.keys():
+ if key in processes:
+ wm = key
+ break
+
+ self.key = 'Window Manager'
+ self.value = wm
-#class DesktopEnvironment:
-# def __init__(self):
-# de = ''
-# for key in deDict.keys():
-# if processes(key):
-# wm = key
-# break
-#
-# self.key = 'Desktop Environment'
-# self.value = de
+class DesktopEnvironment:
+ def __init__(self):
+ de = ''
+ for key in deDict.keys():
+ if key in processes:
+ wm = wmDict[key]
+ break
+
+ self.key = 'Desktop Environment'
+ self.value = de
class Shell:
def __init__(self):
@@ -205,4 +209,6 @@ out.append(Shell())
out.append(User())
out.append(Terminal())
out.append(Uptime())
+out.append(WindowManager())
+#out.append(DesktopEnvirornment())
out.output()