Browse Source

Added cursor theme support

sisyphus
JezerM 3 years ago
parent
commit
df0b3ccd36
No known key found for this signature in database
GPG Key ID: 66BBC5D01388C6B5
  1. 15
      web-greeter/browser/browser.py

15
web-greeter/browser/browser.py

@ -28,6 +28,7 @@
# Standard lib
import re
from browser.window import MainWindow
import os
from typing import (
@ -83,6 +84,17 @@ ENABLED_SETTINGS = [
'FocusOnNavigationEnabled', # Qt 5.11+
]
def getDefaultCursor():
cursor_theme = ""
file = open("/usr/share/icons/default/index.theme")
matched = re.search(r"Inherits=.*", file.read())
file.close()
if not matched:
logger.error("Default cursor couldn't be get")
return ""
cursor_theme = matched.group().replace("Inherits=", "")
return cursor_theme
class Application:
app: QApplication
desktop: QDesktopWidget
@ -123,6 +135,9 @@ class Application:
timeout = web_greeter_config["config"]["greeter"]["screensaver_timeout"]
set_screensaver(timeout or 300)
cursor_theme = web_greeter_config["config"]["greeter"]["icon_theme"]
os.environ["XCURSOR_THEME"] = cursor_theme if cursor_theme != None else getDefaultCursor()
self.app.aboutToQuit.connect(self._before_exit)
def _before_exit(self):

Loading…
Cancel
Save