Fix flickering screen in KDE

This commit is contained in:
Gobinath 2017-06-19 11:23:28 -04:00
parent 52ee6292a9
commit 1943c385d1
3 changed files with 31 additions and 2 deletions

View File

@ -31,7 +31,8 @@ class BreakScreen:
"""
Read the break_screen.glade and build the user interface.
"""
def __init__(self, on_skip, on_postpone, glade_file, style_sheet_path):
def __init__(self, context, on_skip, on_postpone, glade_file, style_sheet_path):
self.context = context
self.on_skip = on_skip
self.on_postpone = on_postpone
self.is_pretified = False
@ -170,6 +171,9 @@ class BreakScreen:
# Set visual to apply css theme. It should be called before show method.
window.set_visual(window.get_screen().get_rgba_visual())
if self.context['desktop'] == 'kde':
# Fix flickering screen in KDE by setting opacity to 1
window.set_opacity(1)
window.move(x, y)
window.stick()

View File

@ -249,6 +249,30 @@ def read_lang_files():
return languages
def desktop_environment():
"""
Detect the desktop environment.
"""
desktop_session = os.environ.get('DESKTOP_SESSION')
current_desktop = os.environ.get('XDG_CURRENT_DESKTOP')
if desktop_session is not None:
desktop_session = desktop_session.lower()
if desktop_session in ['gnome','unity', 'budgie-desktop', 'cinnamon', 'mate', 'xfce4', 'lxde', 'pantheon', 'fluxbox', 'blackbox', 'openbox', 'icewm', 'jwm', 'afterstep','trinity', 'kde']:
return desktop_session
elif (desktop_session.startswith('xubuntu') or (current_desktop is not None and 'xfce' in current_desktop)):
return 'xfce'
elif desktop_session.startswith('ubuntu'):
return 'unity'
elif desktop_session.startswith('lubuntu'):
return 'lxde'
elif 'plasma' in desktop_session or desktop_session.startswith('kubuntu') or os.environ.get('KDE_FULL_SESSION') == 'true':
return 'kde'
elif os.environ.get('GNOME_DESKTOP_SESSION_ID'):
return 'gnome'
return 'unknown'
def lock_screen_command():
"""
Function tries to detect the screensaver command based on the current envinroment

View File

@ -256,9 +256,10 @@ def main():
# Initialize the Safe Eyes Context
context['version'] = SAFE_EYES_VERSION
context['desktop'] = Utility.desktop_environment()
tray_icon = TrayIcon(config, language, show_settings, show_about, enable_safeeyes, disable_safeeyes, on_quit)
break_screen = BreakScreen(on_skipped, on_postponed, break_screen_glade, Utility.style_sheet_path)
break_screen = BreakScreen(context, on_skipped, on_postponed, break_screen_glade, Utility.style_sheet_path)
break_screen.initialize(config, language)
notification = Notification(language)
plugins = Plugins(config)