Skip to content

Commit

Permalink
now the wm.py can detect console
Browse files Browse the repository at this point in the history
  • Loading branch information
billy3321 committed May 23, 2011
1 parent 3158e60 commit 2bbe0c6
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions lazyscripts/wm.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,17 @@ def __init__(self, dist=None):
if not dist:
dist = distro.Distribution().name
self.distro = dist
self.name = self.get_wminfo()
if self.distro == 'ubuntu' and \
distro.Distribution().version == '11.04' and \
self.name == 'gnome':
self.unity_check()

self.version = self.get_version()
if self.is_under_X():
self.name = self.get_wminfo()
if self.distro == 'ubuntu' and \
distro.Distribution().version == '11.04' and \
self.name == 'gnome':
self.unity_check()

self.version = self.get_version()
else:
self.name = 'console'
self.version = None

def __str__(self):
return self.name
Expand Down Expand Up @@ -157,5 +161,12 @@ def unity_check(self):
elif session in ('kde-plasma'):
self.name = 'kde'

def is_under_X(self):
display = getenv('DISPLAY')
if display:
return True
else:
return False


#END

0 comments on commit 2bbe0c6

Please sign in to comment.