Check for Unity instead

This commit is contained in:
Jonathan Corwin 2011-12-22 12:27:54 +00:00
parent b9c1da189a
commit 16043527fc

View File

@ -123,13 +123,11 @@ class MainDisplay(Display):
self.audioPlayer = None self.audioPlayer = None
self.firstTime = True self.firstTime = True
self.setStyleSheet(u'border: 0px; margin: 0px; padding: 0px;') self.setStyleSheet(u'border: 0px; margin: 0px; padding: 0px;')
if not self.checkGnomeShell32(): windowFlags = QtCore.Qt.FramelessWindowHint | QtCore.Qt.Tool | \
self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.Tool | QtCore.Qt.WindowStaysOnTopHint
QtCore.Qt.WindowStaysOnTopHint | if os.environ.get(u'XDG_CURRENT_DESKTOP') == u'Unity':
QtCore.Qt.X11BypassWindowManagerHint) windowFlags = windowFlags | QtCore.Qt.X11BypassWindowManagerHint
else: self.setWindowFlags(windowFlags)
self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.Tool |
QtCore.Qt.WindowStaysOnTopHint)
self.setAttribute(QtCore.Qt.WA_DeleteOnClose) self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
if self.isLive: if self.isLive:
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
@ -447,31 +445,6 @@ class MainDisplay(Display):
self.setCursor(QtCore.Qt.ArrowCursor) self.setCursor(QtCore.Qt.ArrowCursor)
self.frame.evaluateJavaScript('document.body.style.cursor = "auto"') self.frame.evaluateJavaScript('document.body.style.cursor = "auto"')
def checkGnomeShell32(self):
if hasattr(MainDisplay, u'gnomeShell32'):
return MainDisplay.gnomeShell32
MainDisplay.gnomeShell32 = False
if sys.platform == u'win32' or sys.platform == u'darwin':
return False
if os.environ.get(u'DESKTOP_SESSION') != u'gnome':
return False
gnome = Popen((u'gnome-session', u'--version'), stdout=PIPE)
output, error = gnome.communicate()
code = gnome.wait()
if code != 1:
return False
version = output.split(u' ')[1][:-1].split(u'.')
if int(version[0]) < 3:
return False
if int(version[0]) == 3 and int(version[1]) < 2:
return False
ps = Popen((u'ps', u'-C' u'gnome-shell', u'-o', u'comm='), stdout=PIPE)
output, error = ps.communicate()
code = ps.wait()
if code != 0:
return False
MainDisplay.gnomeShell32 = True
return True
class AudioPlayer(QtCore.QObject): class AudioPlayer(QtCore.QObject):
""" """