Jezer Mejía
3 years ago
committed by
GitHub
32 changed files with 1292 additions and 1094 deletions
@ -1,2 +1,6 @@
|
||||
PyGObject |
||||
whither @ https://github.com/JezerM/whither/tarball/master |
||||
PyQt5 |
||||
PyQtWebEngine |
||||
ruamel.yaml |
||||
python-xlib |
||||
cx_freeze |
||||
|
@ -0,0 +1,102 @@
|
||||
# -*- coding: utf-8 -*- |
||||
# |
||||
# __main__.py |
||||
# |
||||
# Copyright © 2021 JezerM |
||||
# |
||||
# This file is part of Web Greeter. |
||||
# |
||||
# Web Greeter is free software; you can redistribute it and/or modify |
||||
# it under the terms of the GNU General Public License as published by |
||||
# the Free Software Foundation; either version 3 of the License, or |
||||
# (at your option) any later version. |
||||
# |
||||
# Web Greeter is distributed in the hope that it will be useful, |
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
# GNU General Public License for more details. |
||||
# |
||||
# The following additional terms are in effect as per Section 7 of the license: |
||||
# |
||||
# The preservation of all legal notices and author attributions in |
||||
# the material or in the Appropriate Legal Notices displayed |
||||
# by works containing it is required. |
||||
# |
||||
# You should have received a copy of the GNU General Public License |
||||
# along with Web Greeter; If not, see <http://www.gnu.org/licenses/>. |
||||
|
||||
# Standard lib |
||||
import sys, argparse, os |
||||
from typing import List |
||||
|
||||
# 3rd-Party Libs |
||||
import globals |
||||
import config |
||||
|
||||
def list_themes() -> List[str]: |
||||
themes_dir = config.web_greeter_config["app"]["theme_dir"] |
||||
themes_dir = themes_dir if os.path.exists(themes_dir) else "/usr/share/web-greeter/themes" |
||||
filenames = os.listdir(themes_dir) |
||||
|
||||
dirlist = [] |
||||
for file in filenames: |
||||
if os.path.isdir(os.path.join(themes_dir, file)): |
||||
dirlist.append(file) |
||||
|
||||
return dirlist |
||||
|
||||
def print_themes(): |
||||
themes_dir = config.web_greeter_config["app"]["theme_dir"] |
||||
themes_dir = themes_dir if os.path.exists(themes_dir) else "/usr/share/web-greeter/themes" |
||||
themes = list_themes() |
||||
print("Themes are located in {themes_dir}\n".format(themes_dir = themes_dir)) |
||||
for theme in themes: |
||||
print("-", theme) |
||||
|
||||
|
||||
def set_theme(theme: str): |
||||
config.web_greeter_config["config"]["greeter"]["theme"] = theme |
||||
|
||||
def set_debug(value: bool): |
||||
conf = config.web_greeter_config["config"] |
||||
app = config.web_greeter_config["app"] |
||||
conf["greeter"]["debug_mode"] = value |
||||
app["frame"] = value |
||||
app["fullscreen"] = not value |
||||
|
||||
def parse(argv): |
||||
version = config.web_greeter_config["app"]["version"]["full"] |
||||
parser = argparse.ArgumentParser(prog="web-greeter", add_help=False) |
||||
parser.add_argument("-h", "--help", action="help", help="Show this help message and exit") |
||||
parser.add_argument("-v", "--version", action="version", version=version, help="Show version number") |
||||
|
||||
parser.add_argument("--debug", action="store_true", help="Run the greeter in debug mode", dest="debug", default=None) |
||||
parser.add_argument("--normal", action="store_false", help="Run in non-debug mode", dest="debug") |
||||
parser.add_argument("--list", action="store_true", help="List available themes") |
||||
parser.add_argument("--theme", help="Set the theme to use", metavar="[name]") |
||||
|
||||
args: argparse.Namespace |
||||
|
||||
try: |
||||
args = parser.parse_args(argv) |
||||
except argparse.ArgumentError: |
||||
sys.exit() |
||||
|
||||
# print(args) |
||||
|
||||
if (args.list): |
||||
print_themes() |
||||
sys.exit() |
||||
if (args.theme): |
||||
set_theme(args.theme) |
||||
if (args.debug != None): |
||||
set_debug(args.debug) |
||||
|
||||
if __name__ == '__main__': |
||||
parse(sys.argv[1:]) |
||||
|
||||
from browser.browser import Browser |
||||
|
||||
globals.greeter = Browser() |
||||
greeter = globals.greeter |
||||
greeter.run() |
@ -0,0 +1,46 @@
|
||||
# -*- coding: utf-8 -*- |
||||
# |
||||
# bridge.py |
||||
# |
||||
# Copyright © 2016-2017 Antergos |
||||
# |
||||
# This file is part of Web Greeter. |
||||
# |
||||
# Web Greeter is free software; you can redistribute it and/or modify |
||||
# it under the terms of the GNU General Public License as published by |
||||
# the Free Software Foundation; either version 3 of the License, or |
||||
# (at your option) any later version. |
||||
# |
||||
# Web Greeter is distributed in the hope that it will be useful, |
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
# GNU General Public License for more details. |
||||
# |
||||
# The following additional terms are in effect as per Section 7 of the license: |
||||
# |
||||
# The preservation of all legal notices and author attributions in |
||||
# the material or in the Appropriate Legal Notices displayed |
||||
# by works containing it is required. |
||||
# |
||||
# You should have received a copy of the GNU General Public License |
||||
# along with Web Greeter; If not, see <http://www.gnu.org/licenses/>. |
||||
|
||||
from PyQt5.QtCore import QObject, pyqtSignal, pyqtSlot, pyqtProperty |
||||
|
||||
class Bridge: |
||||
@staticmethod |
||||
def method(*args, **kwargs): |
||||
return pyqtSlot(*args, **kwargs) |
||||
|
||||
@staticmethod |
||||
def prop(*args, **kwargs): |
||||
return pyqtProperty(*args, **kwargs) |
||||
|
||||
@staticmethod |
||||
def signal(*args, **kwargs): |
||||
return pyqtSignal(*args, **kwargs) |
||||
|
||||
class BridgeObject(QObject): |
||||
def __init__(self, name: str): |
||||
super().__init__(parent=None) |
||||
self._name = name |
@ -0,0 +1,374 @@
|
||||
# -*- coding: utf-8 -*- |
||||
# |
||||
# browser.py |
||||
# |
||||
# Copyright © 2017 Antergos |
||||
# Copyright © 2021 JezerM |
||||
# |
||||
# This file is part of Web Greeter. |
||||
# |
||||
# Web Greeter is free software; you can redistribute it and/or modify |
||||
# it under the terms of the GNU General Public License as published by |
||||
# the Free Software Foundation; either version 3 of the License, or |
||||
# (at your option) any later version. |
||||
# |
||||
# Web Greeter is distributed in the hope that it will be useful, |
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
# GNU General Public License for more details. |
||||
# |
||||
# The following additional terms are in effect as per Section 7 of the license: |
||||
# |
||||
# The preservation of all legal notices and author attributions in |
||||
# the material or in the Appropriate Legal Notices displayed |
||||
# by works containing it is required. |
||||
# |
||||
# You should have received a copy of the GNU General Public License |
||||
# along with Web Greeter; If not, see <http://www.gnu.org/licenses/>. |
||||
|
||||
# Standard lib |
||||
|
||||
import re |
||||
from browser.window import MainWindow |
||||
import os |
||||
from typing import ( |
||||
Dict, |
||||
Tuple, |
||||
TypeVar, |
||||
) |
||||
|
||||
# 3rd-Party Libs |
||||
from PyQt5.QtCore import QRect, QUrl, Qt, QCoreApplication, QFile, QSize |
||||
from PyQt5.QtWidgets import QAction, QApplication, QDesktopWidget, QDockWidget, QMainWindow, QLayout, qApp, QWidget |
||||
from PyQt5.QtWebEngineCore import QWebEngineUrlScheme |
||||
from PyQt5.QtWebEngineWidgets import QWebEngineScript, QWebEngineProfile, QWebEngineSettings, QWebEngineView, QWebEnginePage |
||||
from PyQt5.QtGui import QColor, QIcon |
||||
from PyQt5.QtWebChannel import QWebChannel |
||||
|
||||
from browser.error_prompt import WebPage |
||||
from browser.url_scheme import QtUrlSchemeHandler |
||||
from browser.interceptor import QtUrlRequestInterceptor |
||||
|
||||
from logger import logger |
||||
from config import web_greeter_config |
||||
from bridge import Greeter, Config, ThemeUtils |
||||
from utils.screensaver import reset_screensaver, set_screensaver, init_display |
||||
import resources |
||||
|
||||
# Typing Helpers |
||||
BridgeObjects = Tuple['BridgeObject'] |
||||
Url = TypeVar('Url', str, QUrl) |
||||
|
||||
os.environ["QT_DEVICE_PIXEL_RATIO"] = "0" |
||||
os.environ["QT_AUTO_SCREEN_SCALE_FACTOR"] = "1" |
||||
os.environ["QT_SCREEN_SCALE_FACTORS"] = "1" |
||||
os.environ["QT_SCALE_FACTOR"] = "1" |
||||
|
||||
WINDOW_STATES = { |
||||
'NORMAL': Qt.WindowState.WindowNoState, |
||||
'MINIMIZED': Qt.WindowState.WindowMinimized, |
||||
'MAXIMIZED': Qt.WindowState.WindowMaximized, |
||||
'FULLSCREEN': Qt.WindowState.WindowFullScreen, |
||||
} # type: Dict[str, Qt.WindowState] |
||||
|
||||
DISABLED_SETTINGS = [ |
||||
'PluginsEnabled', # Qt 5.6+ |
||||
] |
||||
|
||||
ENABLED_SETTINGS = [ |
||||
'FocusOnNavigationEnabled', # Qt 5.8+ |
||||
'FullScreenSupportEnabled', # Qt 5.6+ |
||||
'LocalContentCanAccessFileUrls', |
||||
'ScreenCaptureEnabled', # Qt 5.7+ |
||||
'ScrollAnimatorEnabled', |
||||
'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 |
||||
window: QMainWindow |
||||
states = WINDOW_STATES |
||||
|
||||
def __init__(self): |
||||
QCoreApplication.setAttribute(Qt.ApplicationAttribute.AA_EnableHighDpiScaling) |
||||
QApplication.setAttribute(Qt.ApplicationAttribute.AA_EnableHighDpiScaling) |
||||
|
||||
self.app = QApplication([]) |
||||
self.window = MainWindow() |
||||
self.desktop = self.app.desktop() |
||||
|
||||
self.window.setAttribute(Qt.WidgetAttribute.WA_DeleteOnClose) |
||||
self.window.setWindowTitle("Web Greeter") |
||||
|
||||
|
||||
self.window.setWindowFlags( |
||||
self.window.windowFlags() | Qt.WindowType.MaximizeUsingFullscreenGeometryHint |
||||
) |
||||
|
||||
if web_greeter_config["app"]["frame"]: |
||||
self._init_menu_bar() |
||||
else: |
||||
self.window.setWindowFlags(self.window.windowFlags() | Qt.WindowType.FramelessWindowHint) |
||||
|
||||
screen_size = self.desktop.availableGeometry().size() |
||||
|
||||
self.window.setBaseSize(screen_size) |
||||
self.window.resize(screen_size) |
||||
|
||||
state = self.states['NORMAL'] |
||||
if web_greeter_config["app"]["fullscreen"]: |
||||
state = self.states["FULLSCREEN"] |
||||
|
||||
try: |
||||
self.window.windowHandle().setWindowState(state) |
||||
except Exception: |
||||
self.window.setWindowState(state) |
||||
|
||||
self.window.setCursor(Qt.CursorShape.ArrowCursor) |
||||
|
||||
init_display() |
||||
|
||||
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): |
||||
reset_screensaver() |
||||
|
||||
def show(self): |
||||
self.window.show() |
||||
logger.debug("Window is ready") |
||||
|
||||
def run(self) -> int: |
||||
logger.debug("Web Greeter started") |
||||
return self.app.exec_() |
||||
|
||||
def _init_menu_bar(self): |
||||
exit_action = QAction(QIcon('exit.png'), '&Exit', self.window) |
||||
exit_action.setShortcut('Ctrl+Q') |
||||
exit_action.setStatusTip('Exit application') |
||||
exit_action.triggered.connect(qApp.quit) |
||||
|
||||
menu_bar = self.window.menuBar() |
||||
|
||||
file_menu = menu_bar.addMenu('&File') |
||||
file_menu.addAction(exit_action) |
||||
|
||||
edit_menu = menu_bar.addMenu('&Edit') |
||||
edit_menu.addAction(exit_action) |
||||
|
||||
view_menu = menu_bar.addMenu('&View') |
||||
view_menu.addAction(exit_action) |
||||
|
||||
about_menu = menu_bar.addMenu('&About') |
||||
about_menu.addAction(exit_action) |
||||
|
||||
class NoneLayout(QLayout): |
||||
def __init__(self): |
||||
super().__init__() |
||||
|
||||
def sizeHint(self) -> QSize: |
||||
size = QSize(0, 0) |
||||
return size |
||||
|
||||
def minimumSizeHint(self) -> QSize: |
||||
size = QSize(0, 0) |
||||
return size |
||||
|
||||
|
||||
class Browser(Application): |
||||
url_scheme: QWebEngineUrlScheme |
||||
|
||||
def __init__(self): |
||||
super().__init__() |
||||
self.init() |
||||
self.load() |
||||
|
||||
def init(self): |
||||
logger.debug("Initializing Browser Window") |
||||
|
||||
if web_greeter_config["config"]["greeter"]["debug_mode"]: |
||||
os.environ['QTWEBENGINE_REMOTE_DEBUGGING'] = '12345' |
||||
|
||||
url_scheme = "web-greeter" |
||||
self.url_scheme = QWebEngineUrlScheme(url_scheme.encode()) |
||||
self.url_scheme.setDefaultPort(QWebEngineUrlScheme.SpecialPort.PortUnspecified) |
||||
self.url_scheme.setFlags(QWebEngineUrlScheme.Flag.SecureScheme or |
||||
QWebEngineUrlScheme.Flag.LocalScheme or |
||||
QWebEngineUrlScheme.Flag.LocalAccessAllowed) |
||||
QWebEngineUrlScheme.registerScheme(self.url_scheme) |
||||
|
||||
self.profile = QWebEngineProfile.defaultProfile() |
||||
self.interceptor = QtUrlRequestInterceptor(url_scheme) |
||||
self.url_scheme_handler = QtUrlSchemeHandler() |
||||
|
||||
self.view = QWebEngineView(parent=self.window) |
||||
self.page = WebPage() |
||||
self.view.setPage(self.page) |
||||
|
||||
self.channel = QWebChannel(self.page) |
||||
self.bridge_initialized = False |
||||
|
||||
self.profile.installUrlSchemeHandler(url_scheme.encode(), self.url_scheme_handler) |
||||
|
||||
self._initialize_page() |
||||
|
||||
if web_greeter_config["config"]["greeter"]["debug_mode"]: |
||||
self._initialize_devtools() |
||||
|
||||
if web_greeter_config["config"]["greeter"]["secure_mode"]: |
||||
self.profile.setUrlRequestInterceptor(self.interceptor) |
||||
|
||||
self.page.setBackgroundColor(QColor(0, 0, 0)) |
||||
self.window.setStyleSheet("""QMainWindow, QWebEngineView { |
||||
background: #000000; |
||||
}""") |
||||
|
||||
self.window.setCentralWidget(self.view) |
||||
|
||||
logger.debug("Browser Window created") |
||||
|
||||
self.show() |
||||
|
||||
def load(self): |
||||
self.greeter = Greeter() |
||||
self.greeter_config = Config() |
||||
self.theme_utils = ThemeUtils(self.greeter) |
||||
|
||||
self.bridge_objects = (self.greeter, self.greeter_config, self.theme_utils) |
||||
self.initialize_bridge_objects() |
||||
self.load_script(':/_greeter/js/bundle.js', 'Web Greeter Bundle') |
||||
self.load_theme() |
||||
|
||||
def _initialize_devtools(self): |
||||
self.dev_view = QWebEngineView(parent=self.window) |
||||
self.dev_page = QWebEnginePage() |
||||
self.dev_view.setPage(self.dev_page) |
||||
self.page.setDevToolsPage(self.dev_page) |
||||
|
||||
self.qdock = QDockWidget() |
||||
self.qdock.setWidget(self.dev_view) |
||||
titlebar = QWidget(self.qdock) |
||||
layout = NoneLayout() |
||||
titlebar.setLayout(layout) |
||||
self.qdock.setTitleBarWidget(titlebar) |
||||
|
||||
self.window.addDockWidget(Qt.DockWidgetArea.RightDockWidgetArea, self.qdock) |
||||
self.qdock.hide() |
||||
logger.debug("DevTools initialized") |
||||
|
||||
def toggle_devtools(self): |
||||
if not web_greeter_config["config"]["greeter"]["debug_mode"]: |
||||
return |
||||
win_size = self.window.size() |
||||
# dev_size = self.qdock.size() |
||||
|
||||
self.qdock.resize(int(win_size.width() / 2), int(win_size.height())) |
||||
|
||||
if self.qdock.isVisible(): |
||||
self.qdock.hide() |
||||
self.view.setFocus() |
||||
else: |
||||
self.qdock.show() |
||||
self.dev_view.setFocus() |
||||
|
||||
def _initialize_page(self): |
||||
page_settings = self.page.settings().globalSettings() |
||||
|
||||
if not web_greeter_config["config"]["greeter"]["secure_mode"]: |
||||
ENABLED_SETTINGS.append('LocalContentCanAccessRemoteUrls') |
||||
else: |
||||
DISABLED_SETTINGS.append('LocalContentCanAccessRemoteUrls') |
||||
|
||||
for setting in DISABLED_SETTINGS: |
||||
try: |
||||
page_settings.setAttribute(getattr(QWebEngineSettings, setting), False) |
||||
except AttributeError: |
||||
pass |
||||
|
||||
for setting in ENABLED_SETTINGS: |
||||
try: |
||||
page_settings.setAttribute(getattr(QWebEngineSettings, setting), True) |
||||
except AttributeError: |
||||
pass |
||||
|
||||
self.page.setView(self.view) |
||||
|
||||
def load_theme(self): |
||||
theme = web_greeter_config["config"]["greeter"]["theme"] |
||||
dir = "/usr/share/web-greeter/themes/" |
||||
path_to_theme = os.path.join(dir, theme, "index.html") |
||||
def_theme = "gruvbox" |
||||
|
||||
if (theme.startswith("/")): path_to_theme = theme |
||||
elif (theme.__contains__(".") or theme.__contains__("/")): |
||||
path_to_theme = os.path.join(os.getcwd(), theme) |
||||
|
||||
if (not path_to_theme.endswith(".html")): |
||||
path_to_theme = os.path.join(path_to_theme, "index.html") |
||||
|
||||
if (not os.path.exists(path_to_theme)): |
||||
print("Path does not exists") |
||||
path_to_theme = os.path.join(dir, def_theme, "index.html") |
||||
|
||||
url = QUrl("web-greeter://app/{0}".format(path_to_theme)) |
||||
self.page.load(url) |
||||
|
||||
logger.debug("Theme loaded") |
||||
|
||||
@staticmethod |
||||
def _create_webengine_script(path: Url, name: str) -> QWebEngineScript: |
||||
script = QWebEngineScript() |
||||
script_file = QFile(path) |
||||
|
||||
# print(script_file, path) |
||||
|
||||
if script_file.open(QFile.OpenModeFlag.ReadOnly): |
||||
script_string = str(script_file.readAll(), 'utf-8') |
||||
|
||||
script.setInjectionPoint(QWebEngineScript.DocumentCreation) |
||||
script.setName(name) |
||||
script.setWorldId(QWebEngineScript.MainWorld) |
||||
script.setSourceCode(script_string) |
||||
# print(script_string) |
||||
|
||||
return script |
||||
|
||||
def _get_channel_api_script(self) -> QWebEngineScript: |
||||
return self._create_webengine_script(':/qtwebchannel/qwebchannel.js', 'QWebChannel API') |
||||
|
||||
def _init_bridge_channel(self) -> None: |
||||
self.page.setWebChannel(self.channel) |
||||
self.page.scripts().insert(self._get_channel_api_script()) |
||||
self.bridge_initialized = True |
||||
|
||||
def initialize_bridge_objects(self) -> None: |
||||
if not self.bridge_initialized: |
||||
self._init_bridge_channel() |
||||
registered_objects = self.channel.registeredObjects() |
||||
|
||||
for obj in self.bridge_objects: |
||||
if obj not in registered_objects: |
||||
self.channel.registerObject(obj._name, obj) |
||||
# print("Registered", obj._name) |
||||
|
||||
def load_script(self, path: Url, name: str): |
||||
script = self._create_webengine_script(path, name) |
||||
self.page.scripts().insert(script) |
||||
|
@ -0,0 +1,136 @@
|
||||
# -*- coding: utf-8 -*- |
||||
# |
||||
# error_prompt.py |
||||
# |
||||
# Copyright © 2021 JezerM |
||||
# |
||||
# This file is part of Web Greeter. |
||||
# |
||||
# Web Greeter is free software; you can redistribute it and/or modify |
||||
# it under the terms of the GNU General Public License as published by |
||||
# the Free Software Foundation; either version 3 of the License, or |
||||
# (at your option) any later version. |
||||
# |
||||
# Web Greeter is distributed in the hope that it will be useful, |
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
# GNU General Public License for more details. |
||||
# |
||||
# The following additional terms are in effect as per Section 7 of the license: |
||||
# |
||||
# The preservation of all legal notices and author attributions in |
||||
# the material or in the Appropriate Legal Notices displayed |
||||
# by works containing it is required. |
||||
# |
||||
# You should have received a copy of the GNU General Public License |
||||
# along with Web Greeter; If not, see <http://www.gnu.org/licenses/>. |
||||
|
||||
# Standard lib |
||||
|
||||
# 3rd-Party Libs |
||||
from typing import List |
||||
from PyQt5.QtWebEngineWidgets import QWebEnginePage |
||||
from PyQt5.QtWidgets import QAbstractButton, QDialogButtonBox, QDialog, QVBoxLayout, QLabel, QPushButton |
||||
from config import web_greeter_config |
||||
|
||||
import globals |
||||
from logging import ( |
||||
getLogger, |
||||
DEBUG, |
||||
Formatter, |
||||
StreamHandler, |
||||
) |
||||
|
||||
log_format = ''.join([ |
||||
'%(asctime)s [ %(levelname)s ] %(filename)s %(', |
||||
'lineno)d: %(message)s' |
||||
]) |
||||
formatter = Formatter(fmt=log_format, datefmt="%Y-%m-%d %H:%M:%S") |
||||
logger = getLogger("javascript") |
||||
logger.propagate = False |
||||
stream_handler = StreamHandler() |
||||
stream_handler.setLevel(DEBUG) |
||||
stream_handler.setFormatter(formatter) |
||||
logger.setLevel(DEBUG) |
||||
logger.addHandler(stream_handler) |
||||
|
||||
class WebPage(QWebEnginePage): |
||||
|
||||
def javaScriptConsoleMessage(self, level: QWebEnginePage.JavaScriptConsoleMessageLevel, message: str, lineNumber: int, sourceID: str): |
||||
if sourceID == "": |
||||
sourceID = "console" |
||||
|
||||
logLevel = 0 |
||||
if level == WebPage.JavaScriptConsoleMessageLevel.ErrorMessageLevel: |
||||
logLevel = 40 |
||||
elif level == WebPage.JavaScriptConsoleMessageLevel.WarningMessageLevel: |
||||
logLevel = 30 |
||||
elif level == WebPage.JavaScriptConsoleMessageLevel.InfoMessageLevel: |
||||
return |
||||
else: |
||||
return |
||||
|
||||
record = logger.makeRecord( |
||||
name="javascript", |
||||
level=logLevel, |
||||
fn="", |
||||
lno=lineNumber, |
||||
msg=message, |
||||
args=(), |
||||
exc_info=None |
||||
) |
||||
record.filename = sourceID |
||||
logger.handle(record) |
||||
|
||||
if logLevel == 40: |
||||
errorMessage = "{source} {line}: {msg}".format( |
||||
source=sourceID, line=lineNumber, msg=message) |
||||
errorPrompt(errorMessage) |
||||
|
||||
class Dialog(QDialog): |
||||
def __init__(self, parent=None, title:str = "Dialog", message:str = "Message", detail:str = "", buttons: List[str] = []): |
||||
super().__init__(parent) |
||||
self.setWindowTitle(title) |
||||
|
||||
self.buttonBox = QDialogButtonBox() |
||||
for i in range(0, len(buttons)): |
||||
button = QPushButton(buttons[i]) |
||||
button.role = i |
||||
self.buttonBox.addButton(button, QDialogButtonBox.ButtonRole.NoRole) |
||||
|
||||
self.buttonBox.clicked.connect(self.handle_click) |
||||
|
||||
self.layout = QVBoxLayout() |
||||
self.layout.addWidget(QLabel(message)) |
||||
self.layout.addWidget(QLabel(detail)) |
||||
self.layout.addWidget(self.buttonBox) |
||||
|
||||
self.setLayout(self.layout) |
||||
|
||||
def handle_click(self, button: QAbstractButton): |
||||
self.done(button.role) |
||||
|
||||
def errorPrompt(err): |
||||
if not web_greeter_config["config"]["greeter"]["detect_theme_errors"]: |
||||
return |
||||
|
||||
dia = Dialog(parent=globals.greeter.window, title="Error", |
||||
message="An error ocurred. Do you want to change to default theme?", |
||||
detail=err, |
||||
buttons=["Reload theme", "Set default theme", "Cancel"], |
||||
) |
||||
|
||||
dia.exec() |
||||
result = dia.result() |
||||
|
||||
if result == 2: # Cancel |
||||
return |
||||
elif result == 1: # Default theme |
||||
web_greeter_config["config"]["greeter"]["theme"] = "gruvbox" |
||||
globals.greeter.load_theme() |
||||
return |
||||
elif result == 0: # Reload |
||||
globals.greeter.load_theme() |
||||
return |
||||
|
||||
return |
@ -0,0 +1,56 @@
|
||||
# -*- coding: utf-8 -*- |
||||
# |
||||
# interceptor.py |
||||
# |
||||
# Copyright © 2016-2017 Antergos |
||||
# |
||||
# This file is part of Web Greeter. |
||||
# |
||||
# Web Greeter is free software; you can redistribute it and/or modify |
||||
# it under the terms of the GNU General Public License as published by |
||||
# the Free Software Foundation; either version 3 of the License, or |
||||
# (at your option) any later version. |
||||
# |
||||
# Web Greeter is distributed in the hope that it will be useful, |
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
# GNU General Public License for more details. |
||||
# |
||||
# The following additional terms are in effect as per Section 7 of the license: |
||||
# |
||||
# The preservation of all legal notices and author attributions in |
||||
# the material or in the Appropriate Legal Notices displayed |
||||
# by works containing it is required. |
||||
# |
||||
# You should have received a copy of the GNU General Public License |
||||
# along with Web Greeter; If not, see <http://www.gnu.org/licenses/>. |
||||
|
||||
# 3rd-Party Libs |
||||
from PyQt5.QtWebEngineCore import QWebEngineUrlRequestInterceptor, QWebEngineUrlRequestInfo |
||||
|
||||
class QtUrlRequestInterceptor(QWebEngineUrlRequestInterceptor): |
||||
|
||||
def __init__(self, url_scheme: str): |
||||
super().__init__() |
||||
self._url_scheme = url_scheme |
||||
|
||||
def intercept_request(self, info: QWebEngineUrlRequestInfo) -> None: |
||||
url = info.requestUrl().toString() |
||||
not_webg_uri = self._url_scheme != info.requestUrl().scheme() |
||||
not_data_uri = 'data' != info.requestUrl().scheme() |
||||
not_local_file = not info.requestUrl().isLocalFile() |
||||
|
||||
# print(url) |
||||
|
||||
not_devtools = ( |
||||
not url.startswith('http://127.0.0.1') and not url.startswith('ws://127.0.0.1') |
||||
and not url.startswith('devtools') |
||||
) |
||||
|
||||
block_request = not_devtools and not_data_uri and not_webg_uri and not_local_file |
||||
|
||||
info.block(block_request) # Block everything that is not allowed |
||||
|
||||
def interceptRequest(self, info: QWebEngineUrlRequestInfo) -> None: |
||||
self.intercept_request(info) |
||||
|
@ -0,0 +1,74 @@
|
||||
# -*- coding: utf-8 -*- |
||||
# |
||||
# url_scheme.py |
||||
# |
||||
# Copyright © 2016-2018 Antergos |
||||
# Copyright © 2021 JezerM |
||||
# |
||||
# This file is part of Web Greeter. |
||||
# |
||||
# Web Greeter is free software; you can redistribute it and/or modify |
||||
# it under the terms of the GNU General Public License as published by |
||||
# the Free Software Foundation; either version 3 of the License, or |
||||
# (at your option) any later version. |
||||
# |
||||
# Web Greeter is distributed in the hope that it will be useful, |
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
# GNU General Public License for more details. |
||||
# |
||||
# The following additional terms are in effect as per Section 7 of the license: |
||||
# |
||||
# The preservation of all legal notices and author attributions in |
||||
# the material or in the Appropriate Legal Notices displayed |
||||
# by works containing it is required. |
||||
# |
||||
# You should have received a copy of the GNU General Public License |
||||
# along with Web Greeter; If not, see <http://www.gnu.org/licenses/>. |
||||
|
||||
""" Custom Url Scheme Handler """ |
||||
|
||||
# Standard Lib |
||||
import os |
||||
import mimetypes |
||||
|
||||
# 3rd-Party Libs |
||||
from PyQt5.QtCore import QBuffer, QIODevice |
||||
from PyQt5.QtWebEngineCore import QWebEngineUrlSchemeHandler, QWebEngineUrlRequestJob |
||||
|
||||
|
||||
class QtUrlSchemeHandler(QWebEngineUrlSchemeHandler): |
||||
|
||||
def requestStarted(self, job: QWebEngineUrlRequestJob) -> None: |
||||
path = job.requestUrl().path() |
||||
path = os.path.realpath(path) |
||||
|
||||
# print("PATH", job.requestUrl().path()) |
||||
|
||||
if not path: |
||||
# print("JOB FAIL", path) |
||||
job.fail(QWebEngineUrlRequestJob.UrlInvalid) |
||||
return |
||||
|
||||
if not os.path.exists(path): |
||||
# print("NOT FOUND", path) |
||||
job.fail(QWebEngineUrlRequestJob.UrlNotFound) |
||||
return |
||||
|
||||
try: |
||||
with open(path, 'rb') as file: |
||||
content_type = mimetypes.guess_type(path) |
||||
if not content_type[0]: |
||||
content_type = ["text/plain", None] |
||||
buffer = QBuffer(parent=self) |
||||
|
||||
buffer.open(QIODevice.WriteOnly) |
||||
buffer.write(file.read()) |
||||
buffer.seek(0) |
||||
buffer.close() |
||||
|
||||
job.reply(content_type[0].encode(), buffer) |
||||
|
||||
except Exception as err: |
||||
raise err |
||||
|
@ -0,0 +1,73 @@
|
||||
# -*- coding: utf-8 -*- |
||||
# |
||||
# window.py |
||||
# |
||||
# Copyright © 2021 JezerM |
||||
# |
||||
# This file is part of Web Greeter. |
||||
# |
||||
# Web Greeter is free software; you can redistribute it and/or modify |
||||
# it under the terms of the GNU General Public License as published by |
||||
# the Free Software Foundation; either version 3 of the License, or |
||||
# (at your option) any later version. |
||||
# |
||||
# Web Greeter is distributed in the hope that it will be useful, |
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
# GNU General Public License for more details. |
||||
# |
||||
# The following additional terms are in effect as per Section 7 of the license: |
||||
# |
||||
# The preservation of all legal notices and author attributions in |
||||
# the material or in the Appropriate Legal Notices displayed |
||||
# by works containing it is required. |
||||
# |
||||
# You should have received a copy of the GNU General Public License |
||||
# along with Web Greeter; If not, see <http://www.gnu.org/licenses/>. |
||||
|
||||
from bridge.Greeter import changeBrightness, decreaseBrightness, increaseBrightness |
||||
from PyQt5.QtCore import QFileSystemWatcher, Qt |
||||
from PyQt5.QtWidgets import QAction, QMainWindow |
||||
from PyQt5.QtGui import QKeyEvent |
||||
from config import web_greeter_config |
||||
|
||||
import globals |
||||
|
||||
class MainWindow(QMainWindow): |
||||
def __init__(self): |
||||
super().__init__() |
||||
self.init_actions() |
||||
# self.watchBrightness() |
||||
|
||||
def init_actions(self): |
||||
devAct = QAction(text="&Toggle Devtools", parent=self) |
||||
devAct.setShortcut("Shift+Ctrl+I") |
||||
devAct.triggered.connect(self.toggle_devtools) |
||||
|
||||
monBUp = QAction(text="&Increase brightness", parent=self) |
||||
monBDo = QAction(text="&Decrease brightness", parent=self) |
||||
monBUp.setShortcut(Qt.Key.Key_MonBrightnessUp) |
||||
monBDo.setShortcut(Qt.Key.Key_MonBrightnessDown) |
||||
monBUp.triggered.connect(self.inc_brightness) |
||||
monBDo.triggered.connect(self.dec_brightness) |
||||
|
||||
self.addAction(devAct) |
||||
self.addAction(monBUp) |
||||
self.addAction(monBDo) |
||||
|
||||
def toggle_devtools(self): |
||||
globals.greeter.toggle_devtools() |
||||
|
||||
def inc_brightness(self): |
||||
increaseBrightness() |
||||
def dec_brightness(self): |
||||
decreaseBrightness() |
||||
|
||||
def watchBrightness(self): |
||||
self.watcher = QFileSystemWatcher(parent=self) |
||||
self.watcher.addPath("/sys/class/backlight/intel_backlight/brightness") |
||||
self.watcher.fileChanged.connect(self.updateBrightness) |
||||
|
||||
def updateBrightness(self): |
||||
if globals.greeter: |
||||
globals.greeter.greeter.brightness_update.emit() |
@ -0,0 +1,89 @@
|
||||
# -*- coding: utf-8 -*- |
||||
# |
||||
# config.py |
||||
# |
||||
# Copyright © 2021 JezerM |
||||
# |
||||
# This file is part of Web Greeter. |
||||
# |
||||
# Web Greeter is free software; you can redistribute it and/or modify |
||||
# it under the terms of the GNU General Public License as published by |
||||
# the Free Software Foundation; either version 3 of the License, or |
||||
# (at your option) any later version. |
||||
# |
||||
# Web Greeter is distributed in the hope that it will be useful, |
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
# GNU General Public License for more details. |
||||
# |
||||
# The following additional terms are in effect as per Section 7 of the license: |
||||
# |
||||
# The preservation of all legal notices and author attributions in |
||||
# the material or in the Appropriate Legal Notices displayed |
||||
# by works containing it is required. |
||||
# |
||||
# You should have received a copy of the GNU General Public License |
||||
# along with Web Greeter; If not, see <http://www.gnu.org/licenses/>. |
||||
# Standard lib |
||||
|
||||
import sys |
||||
import os |
||||
import ruamel.yaml as yaml |
||||
|
||||
import globals |
||||
from logger import logger |
||||
|
||||
path_to_config = "/etc/lightdm/web-greeter.yml" |
||||
|
||||
global web_greeter_config |
||||
web_greeter_config = { |
||||
"config": { |
||||
"branding": { |
||||
"background_images_dir": "/usr/share/backgrounds", |
||||
"logo_image": "", |
||||
"user_image": "", |
||||
}, |
||||
"greeter": { |
||||
"debug_mode": False, |
||||
"detect_theme_errors": True, |
||||
"screensaver_timeout": 300, |
||||
"secure_mode": True, |
||||
"theme": "gruvbox", |
||||
"icon_theme": None, |
||||
"time_language": None, |
||||
}, |
||||
"layouts": ["us", "latam"], |
||||
"features": { |
||||
"battery": False, |
||||
"backlight": { |
||||
"enabled": False, |
||||
"value": 10, |
||||
"steps": 0, |
||||
} |
||||
} |
||||
}, |
||||
"app": { |
||||
"fullscreen": True, |
||||
"frame": False, |
||||
"debug_mode": False, |
||||
"theme_dir": "/usr/share/web-greeter/themes/", |
||||
"version": { |
||||
"full": "3.0.0", |
||||
"major": 3, |
||||
"minor": 3, |
||||
"micro": 0, |
||||
}, |
||||
} |
||||
} |
||||
|
||||
def load_config(): |
||||
try: |
||||
if (not os.path.exists(path_to_config)): |
||||
raise Exception("Config file not found") |
||||
file = open(path_to_config, "r") |
||||
web_greeter_config["config"] = yaml.safe_load(file) |
||||
except Exception as err: |
||||
logger.error("Config was not loaded:\n\t{0}".format(err)) |
||||
pass |
||||
|
||||
load_config() |
@ -1,222 +1 @@
|
||||
# -*- coding: utf-8 -*- |
||||
# |
||||
# globals.py |
||||
# |
||||
# Copyright © 2017 Antergos |
||||
# |
||||
# This file is part of Web Greeter. |
||||
# |
||||
# Web Greeter is free software; you can redistribute it and/or modify |
||||
# it under the terms of the GNU General Public License as published by |
||||
# the Free Software Foundation; either version 3 of the License, or |
||||
# (at your option) any later version. |
||||
# |
||||
# Web Greeter is distributed in the hope that it will be useful, |
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
# GNU General Public License for more details. |
||||
# |
||||
# The following additional terms are in effect as per Section 7 of the license: |
||||
# |
||||
# The preservation of all legal notices and author attributions in |
||||
# the material or in the Appropriate Legal Notices displayed |
||||
# by works containing it is required. |
||||
# |
||||
# You should have received a copy of the GNU General Public License |
||||
# along with Web Greeter; If not, see <http://www.gnu.org/licenses/>. |
||||
|
||||
import sys |
||||
import pkg_resources |
||||
import os |
||||
from typing import ( |
||||
ClassVar, |
||||
Type, |
||||
List, |
||||
Tuple, |
||||
) |
||||
|
||||
# 3rd-Party Libs |
||||
from whither.app import App |
||||
from whither.base.config_loader import ConfigLoader |
||||
from whither.bridge import BridgeObject |
||||
|
||||
# This Application |
||||
import resources |
||||
from bridge import ( |
||||
Config, |
||||
Greeter, |
||||
ThemeUtils, |
||||
) |
||||
from logging import ( |
||||
getLogger, |
||||
DEBUG, |
||||
ERROR, |
||||
Formatter, |
||||
StreamHandler, |
||||
) |
||||
|
||||
from PyQt5.QtWidgets import QMainWindow |
||||
from PyQt5.QtGui import QColor |
||||
from PyQt5.QtCore import QResource |
||||
import subprocess |
||||
|
||||
from utils import theme |
||||
|
||||
# Typing Helpers |
||||
BridgeObj = Type[BridgeObject] |
||||
|
||||
|
||||
log_format = ''.join([ |
||||
'%(asctime)s [ %(levelname)s ] %(module)s - %(filename)s:%(', |
||||
'lineno)d : %(funcName)s | %(message)s' |
||||
]) |
||||
formatter = Formatter(fmt=log_format, datefmt="%Y-%m-%d %H:%M:%S") |
||||
stream_handler = StreamHandler() |
||||
logger = getLogger("debug") |
||||
|
||||
stream_handler.setLevel(DEBUG) |
||||
stream_handler.setFormatter(formatter) |
||||
logger.propagate = False |
||||
logger.setLevel(DEBUG) |
||||
logger.addHandler(stream_handler) |
||||
|
||||
initial_timeout = 0 |
||||
|
||||
|
||||
def setScreenSaver(timeout: int): |
||||
global initial_timeout |
||||
timeout = timeout if timeout >= 0 else 300 |
||||
try: |
||||
child = subprocess.Popen(["xset", "q"], stdout=subprocess.PIPE, |
||||
stderr=subprocess.PIPE, text=True) |
||||
awk = subprocess.run( |
||||
["awk", "/^ timeout: / {print $2}"], stdout=subprocess.PIPE, stdin=child.stdout, text=True) |
||||
|
||||
initial_timeout = int(awk.stdout.replace("\n", "")) |
||||
|
||||
subprocess.run(["xset", "s", str(timeout)], check=True) |
||||
|
||||
except Exception as err: |
||||
logger.error("Screensaver timeout couldn't be set") |
||||
else: |
||||
logger.debug("Screensaver timeout set") |
||||
|
||||
|
||||
def resetScreenSaver(): |
||||
try: |
||||
subprocess.run(["xset", "s", str(initial_timeout)]) |
||||
except Exception as err: |
||||
logger.error("Screensaver reset failed") |
||||
else: |
||||
logger.debug("Screensaver reset") |
||||
|
||||
|
||||
def getDefaultCursor(): |
||||
cursor_theme = "" |
||||
try: |
||||
child = subprocess.Popen(["cat", "/usr/share/icons/default/index.theme"], |
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) |
||||
awk = subprocess.run( |
||||
["awk", "-F=", "/Inherits/ {print $2}"], stdout=subprocess.PIPE, stdin=child.stdout, text=True) |
||||
cursor_theme = awk.stdout.replace("\n", "") |
||||
except Exception as err: |
||||
logger.error("Default cursor couldn't be get") |
||||
return cursor_theme |
||||
|
||||
|
||||
def loadStyle(path): |
||||
file = QResource(path) |
||||
file = file.uncompressedData() |
||||
file = str(file.data(), encoding='utf-8') |
||||
return file |
||||
|
||||
|
||||
BASE_DIR = os.path.dirname(os.path.realpath(__file__)) |
||||
CONFIG_FILE = os.path.join(BASE_DIR, 'whither.yml') |
||||
|
||||
|
||||
class WebGreeter(App): |
||||
greeter = None # type: ClassVar[BridgeObj] | None |
||||
greeter_config = None # type: ClassVar[BridgeObj] | None |
||||
theme_utils = None # type: ClassVar[BridgeObj] | None |
||||
|
||||
def __init__(self, *args, **kwargs) -> None: |
||||
super().__init__('WebGreeter', *args, **kwargs) |
||||
self.logger.debug('Web Greeter started.') |
||||
self.greeter = Greeter(self.config) |
||||
self.greeter_config = Config(self.config) |
||||
self.theme_utils = ThemeUtils(self.greeter, self.config) |
||||
self._web_container.bridge_objects = (self.greeter, self.greeter_config, self.theme_utils) |
||||
|
||||
style = loadStyle(":/_greeter/css/style.css") |
||||
self._main_window.widget.setStyleSheet(style) |
||||
page = self._main_window.widget.centralWidget().page() |
||||
page.setBackgroundColor(QColor(0, 0, 0)) |
||||
|
||||
setScreenSaver(self.config.greeter["screensaver_timeout"]) |
||||
|
||||
self._web_container.initialize_bridge_objects() |
||||
self._web_container.load_script(':/_greeter/js/bundle.js', 'Web Greeter Bundle') |
||||
self.load_theme() |
||||
|
||||
@classmethod |
||||
def __pre_init__(cls): |
||||
ConfigLoader.add_filter(cls.validate_greeter_config_data) |
||||
|
||||
def _before_main_window_init(self): |
||||
self.get_and_apply_user_config() |
||||
|
||||
def _before_exit(self): |
||||
resetScreenSaver() |
||||
|
||||
@classmethod |
||||
def validate_greeter_config_data(cls, key: str, data: str) -> str: |
||||
if "'@" not in data: |
||||
return data |
||||
|
||||
if 'WebGreeter' == key: |
||||
path = '../build/web-greeter/whither.yml' |
||||
else: |
||||
path = '../build/dist/web-greeter.yml' |
||||
|
||||
return open(path, 'r').read() |
||||
|
||||
def get_and_apply_user_config(self): |
||||
self.logger.debug("Aplying config") |
||||
config_file = os.path.join(self.config.config_dir, 'web-greeter.yml') |
||||
branding_config = ConfigLoader('branding', config_file).config |
||||
greeter_config = ConfigLoader('greeter', config_file).config |
||||
features_config = ConfigLoader('features', config_file).config |
||||
layouts_config = ConfigLoader('layouts', config_file).config |
||||
|
||||
greeter_config.update(custom_config["app"]["greeter"]) |
||||
|
||||
self.config.branding.update(branding_config) |
||||
self.config.greeter.update(greeter_config) |
||||
self.config.features.update(features_config) |
||||
self.config.layouts = layouts_config |
||||
|
||||
cursor_theme = greeter_config["icon_theme"] |
||||
os.environ["XCURSOR_THEME"] = cursor_theme if cursor_theme != None else getDefaultCursor() |
||||
|
||||
self._config.debug_mode = greeter_config['debug_mode'] |
||||
self._config.allow_remote_urls = not greeter_config['secure_mode'] |
||||
self._config.context_menu.enabled = greeter_config['debug_mode'] |
||||
self._config.window.update(custom_config["whither"]["window"]) |
||||
|
||||
def load_theme(self): |
||||
self.logger.debug('Loading theme...') |
||||
theme_url = theme.checkTheme(self) |
||||
self._web_container.load(theme_url) |
||||
|
||||
|
||||
global custom_config |
||||
global greeter |
||||
custom_config = { |
||||
"whither": { |
||||
"window": {} |
||||
}, |
||||
"app": { |
||||
"greeter": {} |
||||
} |
||||
} |
||||
global greeter # type: Browser |
||||
|
@ -1,176 +0,0 @@
|
||||
#!/usr/bin/python3 |
||||
# -*- coding: utf-8 -*- |
||||
# |
||||
# main.py |
||||
# |
||||
# Copyright © 2021 JezerM |
||||
# |
||||
# This file is part of Web Greeter. |
||||
# |
||||
# Web Greeter is free software; you can redistribute it and/or modify |
||||
# it under the terms of the GNU General Public License as published by |
||||
# the Free Software Foundation; either version 3 of the License, or |
||||
# (at your option) any later version. |
||||
# |
||||
# Web Greeter is distributed in the hope that it will be useful, |
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
# GNU General Public License for more details. |
||||
# |
||||
# The following additional terms are in effect as per Section 7 of the license: |
||||
# |
||||
# The preservation of all legal notices and author attributions in |
||||
# the material or in the Appropriate Legal Notices displayed |
||||
# by works containing it is required. |
||||
# |
||||
# You should have received a copy of the GNU General Public License |
||||
# along with Web Greeter; If not, see <http://www.gnu.org/licenses/>. |
||||
|
||||
# Standard Lib |
||||
import sys |
||||
import ruamel.yaml as yaml |
||||
import pkg_resources |
||||
import os |
||||
from typing import ( List ) |
||||
|
||||
# 3rd-Party Libs |
||||
|
||||
# This Application |
||||
from utils import errorPrompt, keyboard |
||||
|
||||
import globals |
||||
from globals import WebGreeter, logger |
||||
|
||||
|
||||
def loadWhitherConf(): |
||||
global whither_yaml |
||||
global webGreeter_conf |
||||
global file_test |
||||
try: |
||||
file_test = pkg_resources.resource_string("__main__", 'whither.yml').decode('utf-8') |
||||
except Exception: |
||||
file_test = pkg_resources.resource_string(__file__, 'whither.yml').decode('utf-8') |
||||
|
||||
whither_yaml = yaml.safe_load(file_test) |
||||
webGreeter_conf = whither_yaml["WebGreeter"] |
||||
|
||||
|
||||
def show_help(): |
||||
version = webGreeter_conf["app"]["version"]["full"] |
||||
help_text = """Usage: |
||||
web-greeter [OPTION...] - LightDM Web Greeter |
||||
|
||||
--debug Runs the greeter in debug mode |
||||
--normal Runs in non-debug mode |
||||
|
||||
--list Lists available themes |
||||
--theme Sets the theme to use |
||||
|
||||
-h, --help Show this help list |
||||
-v, --version Print program version""".format( |
||||
version = version |
||||
) |
||||
print(help_text) |
||||
|
||||
|
||||
def show_version(): |
||||
version = webGreeter_conf["app"]["version"]["full"] |
||||
print("{version}".format(version = version)) |
||||
|
||||
def changeConfig(option: str, value): |
||||
custom_config[option] = value |
||||
return |
||||
|
||||
|
||||
def debugMode(value: bool): |
||||
window = dict(custom_config["whither"]["window"]) |
||||
greeter = dict(custom_config["app"]["greeter"]) |
||||
if value: |
||||
greeter["debug_mode"] = True |
||||
window["decorated"] = True |
||||
window["stays_on_top"] = False |
||||
window["initial_state"] = "normal" |
||||
else: |
||||
greeter["debug_mode"] = False |
||||
window["decorated"] = False |
||||
window["stays_on_top"] = True |
||||
custom_config["whither"]["window"] = window |
||||
custom_config["app"]["greeter"] = greeter |
||||
|
||||
|
||||
def changeTheme(theme: str): |
||||
custom_config["app"]["greeter"]["theme"] = theme |
||||
|
||||
|
||||
def listThemes(quiet = False): |
||||
themes_dir = webGreeter_conf["app"]["themes_dir"] |
||||
themes_dir = themes_dir if os.path.exists(themes_dir) else "/usr/share/web-greeter/themes" |
||||
filenames = os.listdir(themes_dir) |
||||
|
||||
dirlist = [] |
||||
for file in filenames: |
||||
if os.path.isdir(os.path.join(themes_dir, file)): |
||||
dirlist.append(file) |
||||
|
||||
if not quiet: |
||||
print("Themes are located in {themes_dir}\n".format(themes_dir = themes_dir)) |
||||
for theme in dirlist: |
||||
print("-", theme) |
||||
|
||||
return dirlist |
||||
|
||||
|
||||
args_lenght = sys.argv.__len__() |
||||
|
||||
|
||||
def yargs(args: List[str]): |
||||
loadWhitherConf() |
||||
used = 0 |
||||
|
||||
if args[0] == "--help" or args[0] == "-h": |
||||
show_help() |
||||
used += 1 |
||||
exit() |
||||
elif args[0] == "--version" or args[0] == "-v": |
||||
show_version() |
||||
used += 1 |
||||
exit() |
||||
elif args[0] == "--debug": |
||||
debugMode(True) |
||||
used += 1 |
||||
elif args[0] == "--normal": |
||||
debugMode(False) |
||||
used += 1 |
||||
elif args[0] == "--theme": |
||||
if args.__len__() > 1: |
||||
changeTheme(args[1]) |
||||
used += 2 |
||||
else: |
||||
print("No theme provided") |
||||
used += 1 |
||||
exit(1) |
||||
elif args[0] == "--list": |
||||
listThemes() |
||||
used += 1 |
||||
exit() |
||||
else: |
||||
show_help() |
||||
used += 1 |
||||
exit(1) |
||||
for x in range(used): |
||||
args.pop(0) |
||||
if args.__len__() != 0: |
||||
yargs(args) |
||||
|
||||
|
||||
if __name__ == '__main__': |
||||
custom_config = globals.custom_config |
||||
|
||||
if args_lenght > 1: |
||||
args = sys.argv |
||||
args.pop(0) |
||||
yargs(args) |
||||
|
||||
globals.greeter = WebGreeter() |
||||
|
||||
globals.greeter.run() |
@ -0,0 +1,28 @@
|
||||
from cx_Freeze import setup, Executable |
||||
import os |
||||
|
||||
setup_dir = os.path.abspath(os.path.dirname(__file__)) |
||||
os.chdir(setup_dir) |
||||
|
||||
long_description = "" |
||||
|
||||
if os.path.exists(os.path.join(setup_dir, "README.md")): |
||||
with open("README.md", "r", encoding="utf-8") as fh: |
||||
long_description = fh.read() |
||||
|
||||
setup( |
||||
name = "web-greeter", |
||||
version = "3.0.0", |
||||
license = 'GPL-3.0', |
||||
author = "Antergos Linux Project, Jezer Mejía", |
||||
author_email = "amyuki4@gmail.com", |
||||
description = "A modern, visually appealing greeter for LightDM", |
||||
long_description = long_description, |
||||
long_description_content_type="text/markdown", |
||||
executables = [Executable("__main__.py", target_name="web-greeter")], |
||||
options = {"build_exe": { |
||||
"build_exe": "dist", |
||||
"packages": ["gi", "Xlib"], |
||||
"silent_level": 0, |
||||
}}, |
||||
) |
@ -1,144 +0,0 @@
|
||||
# -*- coding: utf-8 -*- |
||||
# |
||||
# errorPrompt.py |
||||
# |
||||
# Copyright © 2021 JezerM |
||||
# |
||||
# This file is part of Web Greeter. |
||||
# |
||||
# Web Greeter is free software; you can redistribute it and/or modify |
||||
# it under the terms of the GNU General Public License as published by |
||||
# the Free Software Foundation; either version 3 of the License, or |
||||
# (at your option) any later version. |
||||
# |
||||
# Web Greeter is distributed in the hope that it will be useful, |
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
# GNU General Public License for more details. |
||||
# |
||||
# The following additional terms are in effect as per Section 7 of the license: |
||||
# |
||||
# The preservation of all legal notices and author attributions in |
||||
# the material or in the Appropriate Legal Notices displayed |
||||
# by works containing it is required. |
||||
# |
||||
# You should have received a copy of the GNU General Public License |
||||
# along with Web Greeter; If not, see <http://www.gnu.org/licenses/>. |
||||
|
||||
from whither.toolkits.bootstrap import WebPage |
||||
|
||||
from PyQt5.QtWidgets import QDialogButtonBox, QDialog, QVBoxLayout, QLabel, QPushButton |
||||
|
||||
from logging import ( |
||||
getLogger, |
||||
DEBUG, |
||||
ERROR, |
||||
Formatter, |
||||
StreamHandler, |
||||
) |
||||
|
||||
import globals |
||||
|
||||
log_format = ''.join([ |
||||
'%(asctime)s [ %(levelname)s ] %(filename)s %(', |
||||
'lineno)d: %(message)s' |
||||
]) |
||||
formatter = Formatter(fmt=log_format, datefmt="%Y-%m-%d %H:%M:%S") |
||||
logger = getLogger("javascript") |
||||
logger.propagate = False |
||||
stream_handler = StreamHandler() |
||||
stream_handler.setLevel(DEBUG) |
||||
stream_handler.setFormatter(formatter) |
||||
logger.setLevel(DEBUG) |
||||
logger.addHandler(stream_handler) |
||||
|
||||
|
||||
def javaScriptConsoleMessage(self, level: WebPage.JavaScriptConsoleMessageLevel, message: str, lineNumber: int, sourceID: str): |
||||
if sourceID == "": |
||||
sourceID = "console" |
||||
|
||||
logLevel = 0 |
||||
if level == WebPage.JavaScriptConsoleMessageLevel.ErrorMessageLevel: |
||||
logLevel = 40 |
||||
elif level == WebPage.JavaScriptConsoleMessageLevel.WarningMessageLevel: |
||||
logLevel = 30 |
||||
elif level == WebPage.JavaScriptConsoleMessageLevel.InfoMessageLevel: |
||||
return |
||||
else: |
||||
return |
||||
|
||||
record = logger.makeRecord( |
||||
name="javascript", |
||||
level=logLevel, |
||||
fn="", |
||||
lno=lineNumber, |
||||
msg=message, |
||||
args=(), |
||||
exc_info=None |
||||
) |
||||
record.filename = sourceID |
||||
logger.handle(record) |
||||
|
||||
if logLevel == 40: |
||||
errorMessage = "{source} {line}: {msg}".format( |
||||
source=sourceID, line=lineNumber, msg=message) |
||||
errorPrompt(errorMessage) |
||||
|
||||
|
||||
class ErrorDialog(QDialog): |
||||
def __init__(self, parent=None, err=""): |
||||
super().__init__(parent) |
||||
|
||||
self.setWindowTitle("Error") |
||||
|
||||
self.buttonBox = QDialogButtonBox() |
||||
cancelBtn = QPushButton("Cancel") |
||||
defaultBtn = QPushButton("Set default theme") |
||||
reloadBtn = QPushButton("Reload theme") |
||||
|
||||
reloadBtn.clicked.connect(self.handle_reload) |
||||
|
||||
self.buttonBox.addButton(defaultBtn, QDialogButtonBox.ButtonRole.AcceptRole) |
||||
self.buttonBox.addButton(reloadBtn, QDialogButtonBox.ButtonRole.ResetRole) |
||||
self.buttonBox.addButton(cancelBtn, QDialogButtonBox.ButtonRole.RejectRole) |
||||
|
||||
self.buttonBox.accepted.connect(self.accept) |
||||
self.buttonBox.rejected.connect(self.reject) |
||||
|
||||
self.layout = QVBoxLayout() |
||||
message = QLabel("An error ocurred. Do you want to change to default theme?") |
||||
err = QLabel(err) |
||||
self.layout.addWidget(message) |
||||
self.layout.addWidget(err) |
||||
self.layout.addWidget(self.buttonBox) |
||||
self.setLayout(self.layout) |
||||
|
||||
def handle_reload(self, value: bool): |
||||
self.done(2) |
||||
|
||||
|
||||
def errorPrompt(err): |
||||
|
||||
if not globals.greeter.config.greeter.detect_theme_errors: |
||||
return |
||||
|
||||
dia = ErrorDialog(globals.greeter._main_window.widget.centralWidget(), err) |
||||
|
||||
dia.exec() |
||||
result = dia.result() |
||||
|
||||
if result == 0: # Cancel |
||||
return |
||||
elif result == 1: # Default theme |
||||
globals.custom_config["app"]["greeter"]["theme"] = "gruvbox" |
||||
globals.greeter.get_and_apply_user_config() |
||||
globals.greeter.load_theme() |
||||
return |
||||
elif result == 2: # Reload |
||||
globals.greeter.load_theme() |
||||
return |
||||
|
||||
return |
||||
|
||||
|
||||
WebPage.javaScriptConsoleMessage = javaScriptConsoleMessage |
@ -1,37 +0,0 @@
|
||||
# -*- coding: utf-8 -*- |
||||
# |
||||
# interceptor.py |
||||
# |
||||
# Copyright © 2016-2017 Antergos |
||||
# |
||||
# This file is part of whither. |
||||
# |
||||
# whither is free software; you can redistribute it and/or modify |
||||
# it under the terms of the GNU General Public License as published by |
||||
# the Free Software Foundation; either version 3 of the License, or |
||||
# (at your option) any later version. |
||||
# |
||||
# whither is distributed in the hope that it will be useful, |
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
# GNU General Public License for more details. |
||||
# |
||||
# The following additional terms are in effect as per Section 7 of the license: |
||||
# |
||||
# The preservation of all legal notices and author attributions in |
||||
# the material or in the Appropriate Legal Notices displayed |
||||
# by works containing it is required. |
||||
# |
||||
# You should have received a copy of the GNU General Public License |
||||
# along with whither; If not, see <http://www.gnu.org/licenses/>. |
||||
|
||||
""" Url Request Interceptor """ |
||||
|
||||
# 3rd-Party Libs |
||||
from whither.bridge import UrlRequestInterceptor as Interceptor |
||||
|
||||
|
||||
class UrlRequestInterceptor(Interceptor): |
||||
|
||||
def intercept_request(self, info): |
||||
self.interceptRequest(info) |
@ -1,133 +0,0 @@
|
||||
# -*- coding: utf-8 -*- |
||||
# |
||||
# pkg_json.py |
||||
# |
||||
# Copyright © 2016-2017 Antergos |
||||
# |
||||
# This file is part of Web Greeter for LightDM. |
||||
# |
||||
# Web Greeter is free software; you can redistribute it and/or modify |
||||
# it under the terms of the GNU General Public License as published by |
||||
# the Free Software Foundation; either version 3 of the License, or |
||||
# (at your option) any later version. |
||||
# |
||||
# Web Greeter is distributed in the hope that it will be useful, |
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
# GNU General Public License for more details. |
||||
# |
||||
# The following additional terms are in effect as per Section 7 of the license: |
||||
# |
||||
# The preservation of all legal notices and author attributions in |
||||
# the material or in the Appropriate Legal Notices displayed |
||||
# by works containing it is required. |
||||
# |
||||
# You should have received a copy of the GNU General Public License |
||||
# along with Web Greeter; If not, see <http://www.gnu.org/licenses/>. |
||||
|
||||
""" Utility class used to manage greeter themes' package.json files. """ |
||||
|
||||
# Standard Lib |
||||
import json |
||||
import os |
||||
|
||||
|
||||
class MissingKeyError(KeyError): |
||||
|
||||
def __init__(self, keys: list): |
||||
self.keys = keys |
||||
msg_part = ' is' if len(keys) == 1 else 's are' |
||||
msg = 'Required key{0} missing: {1}'.format(msg_part, keys) |
||||
|
||||
super().__init__(msg) |
||||
|
||||
|
||||
class PackageJSON: |
||||
""" |
||||
Holds data from a theme's package.json file. |
||||
|
||||
Attributes: |
||||
_optional_keys (tuple): Top-level keys that aren't required. |
||||
_required_keys (tuple): Top-level keys that are required. |
||||
_wg_theme_keys (tuple): Keys nested under `wg_theme` key. All are required. |
||||
|
||||
author (dict): Author's info. Required: `name`. Optional: `email`, `url`. |
||||
bugs (str): Issue tracker url. |
||||
config (dict): Theme configuration data. |
||||
description (str): Short description. |
||||
display_name (str): Display name. |
||||
entry_point (str): Path to HTML file relative to theme's root directory. |
||||
homepage (str): Homepage url. |
||||
name (str): Package name. |
||||
scripts (list): All JavaScript files required by the theme. Paths should be relative |
||||
to the theme's root directory. Vendor scripts provided by the greeter |
||||
should be listed by their name instead of file path. |
||||
styles (list): All CSS files required by the theme. Paths should be relative |
||||
to the theme's root directory. Vendor styles provided by the greeter |
||||
should be listed by their name instead of file path. |
||||
supports (list): List of greeter versions supported by the theme. The version format |
||||
is MAJOR[.MINOR[.PATCH]] where MINOR and PATCH are optional. |
||||
Examples: |
||||
`3` : `2.9.9` < compatible versions < `4.0.0` |
||||
`3.0` : `3` < compatible versions < `3.1` |
||||
`3.0.1`: compatible version == `3.0.1` |
||||
version (str): Theme version. |
||||
""" |
||||
_optional_keys = ( |
||||
'config', |
||||
'description', |
||||
'name', |
||||
) |
||||
|
||||
_required_keys = ( |
||||
'author', |
||||
'bugs', |
||||
'homepage', |
||||
'version', |
||||
'wg_theme', |
||||
) |
||||
|
||||
_wg_theme_keys = ( |
||||
'display_name', |
||||
'entry_point', |
||||
'scripts', |
||||
'styles', |
||||
'supports', |
||||
) |
||||
|
||||
def __init__(self, path: str) -> None: |
||||
""" |
||||
Args: |
||||
path (str): Absolute path to `package.json` file. |
||||
""" |
||||
self.path = path |
||||
|
||||
self._initialize() |
||||
|
||||
def _initialize(self): |
||||
package_json = os.path.join(self.path, 'package.json') |
||||
|
||||
if not os.path.exists(package_json): |
||||
raise FileNotFoundError |
||||
|
||||
data = json.loads(package_json) |
||||
missing_keys = [k for k in self._required_keys if k not in data] |
||||
|
||||
if missing_keys: |
||||
raise MissingKeyError(missing_keys) |
||||
|
||||
if not isinstance(data['wg_theme'], dict): |
||||
raise TypeError('wg_theme: Expected type(dict)!') |
||||
|
||||
missing_keys = [k for k in self._wg_theme_keys if k not in data['wg_theme']] |
||||
|
||||
if missing_keys: |
||||
raise MissingKeyError(missing_keys) |
||||
|
||||
for key, value in data['wg_theme'].items(): |
||||
setattr(self, key, value) |
||||
|
||||
del data['wg_theme'] |
||||
|
||||
for key, value in data.items(): |
||||
setattr(self, key, value) |
@ -0,0 +1,39 @@
|
||||
from logger import logger |
||||
from Xlib.display import Display |
||||
|
||||
saved_data: dict[str, int] |
||||
saved = False |
||||
available = False |
||||
|
||||
display = None |
||||
|
||||
def init_display(): |
||||
global display, available |
||||
try: |
||||
display = Display() |
||||
available = True |
||||
except Exception as err: |
||||
logger.error(f"Xlib error: {err}") |
||||
|
||||
def set_screensaver(timeout: int): |
||||
global saved_data, saved, available, display |
||||
if saved or not available: |
||||
return |
||||
display.sync() |
||||
data: dict[str, int] = display.get_screen_saver()._data or {} |
||||
saved_data = data |
||||
saved = True |
||||
|
||||
display.set_screen_saver(timeout, data["interval"], data["prefer_blanking"], data["allow_exposures"]) |
||||
display.flush() |
||||
logger.debug("Screensaver timeout set") |
||||
|
||||
def reset_screensaver(): |
||||
global saved_data, saved, available, display |
||||
if not saved or not available: |
||||
return |
||||
display.sync() |
||||
display.set_screen_saver(saved_data["timeout"], saved_data["interval"], saved_data["prefer_blanking"], saved_data["allow_exposures"]) |
||||
display.flush() |
||||
saved = False |
||||
logger.debug("Screensaver reset") |
@ -1,113 +0,0 @@
|
||||
# -*- coding: utf-8 -*- |
||||
# |
||||
# theme.py |
||||
# |
||||
# Copyright © 2016-2017 Antergos |
||||
# |
||||
# This file is part of whither. |
||||
# |
||||
# whither is free software; you can redistribute it and/or modify |
||||
# it under the terms of the GNU General Public License as published by |
||||
# the Free Software Foundation; either version 3 of the License, or |
||||
# (at your option) any later version. |
||||
# |
||||
# whither is distributed in the hope that it will be useful, |
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
# GNU General Public License for more details. |
||||
# |
||||
# The following additional terms are in effect as per Section 7 of the license: |
||||
# |
||||
# The preservation of all legal notices and author attributions in |
||||
# the material or in the Appropriate Legal Notices displayed |
||||
# by works containing it is required. |
||||
# |
||||
# You should have received a copy of the GNU General Public License |
||||
# along with whither; If not, see <http://www.gnu.org/licenses/>. |
||||
|
||||
""" Utility class used to find and manage greeter themes. """ |
||||
|
||||
# Standard Lib |
||||
import os |
||||
from os.path import abspath |
||||
|
||||
# This Application |
||||
from .pkg_json import PackageJSON |
||||
|
||||
from logging import ( |
||||
getLogger, |
||||
DEBUG, |
||||
Formatter, |
||||
StreamHandler, |
||||
) |
||||
|
||||
log_format = ''.join([ |
||||
'%(asctime)s [ %(levelname)s ] %(filename)s %(', |
||||
'lineno)d: %(message)s' |
||||
]) |
||||
formatter = Formatter(fmt=log_format, datefmt="%Y-%m-%d %H:%M:%S") |
||||
logger = getLogger("theme") |
||||
logger.propagate = False |
||||
stream_handler = StreamHandler() |
||||
stream_handler.setLevel(DEBUG) |
||||
stream_handler.setFormatter(formatter) |
||||
logger.setLevel(DEBUG) |
||||
logger.addHandler(stream_handler) |
||||
|
||||
|
||||
def checkTheme(self): |
||||
theme: str = self.config.greeter.theme |
||||
dir = self.config.themes_dir |
||||
path_to_theme: str = os.path.join(dir, theme, "index.html") |
||||
def_theme = "gruvbox" |
||||
|
||||
if theme.startswith("/"): path_to_theme = theme; |
||||
elif "." in theme or "/" in theme: |
||||
path_to_theme = os.path.abspath(theme) |
||||
|
||||
if not path_to_theme.endswith(".html"): |
||||
path_to_theme = os.path.join(path_to_theme, "index.html") |
||||
|
||||
if not os.path.exists(path_to_theme): |
||||
logger.error("\"{0}\" theme does not exists. Using \"{1}\"".format(theme, def_theme)) |
||||
path_to_theme = os.path.join(dir, def_theme, "index.html") |
||||
|
||||
return path_to_theme |
||||
|
||||
|
||||
def listThemes(self): |
||||
themes_dir = self.config.themes_dir |
||||
themes_dir = themes_dir if os.path.exists(themes_dir) else "/usr/share/web-greeter/themes" |
||||
filenames = os.listdir(themes_dir) |
||||
|
||||
dirlist = [] |
||||
for file in filenames: |
||||
if os.path.isdir(os.path.join(themes_dir, file)): |
||||
dirlist.append(file) |
||||
|
||||
return dirlist |
||||
|
||||
|
||||
class Theme: |
||||
""" |
||||
Represents a greeter theme installed on the local system. |
||||
|
||||
Args: |
||||
path (str): The absolute path to the theme's directory. |
||||
|
||||
Attributes: |
||||
data (PackageJSON): The theme's data sourced from its `package.json` file. |
||||
""" |
||||
|
||||
def __init__(self, path: str) -> None: |
||||
self.path = path |
||||
|
||||
self._initialize() |
||||
|
||||
def _initialize(self) -> None: |
||||
package_json = os.path.join(self.path, 'package.json') |
||||
|
||||
try: |
||||
self.data = PackageJSON(package_json) |
||||
except Exception: |
||||
self.data = None |
@ -1,62 +0,0 @@
|
||||
# Whither (Universal Linux Apps) Configuration |
||||
|
||||
# App Name |
||||
WebGreeter: |
||||
# Whither's Config |
||||
whither: |
||||
allow_remote_urls: False |
||||
at_spi_service: |
||||
enabled: '@at_spi_service@' |
||||
command: /usr/lib/at-spi2-core/at-spi-bus-launcher |
||||
arg: --launch-immediately |
||||
app_id: web-greeter |
||||
url_scheme: web-greeter |
||||
context_menu: |
||||
enabled: False |
||||
debug_mode: '@debug_mode@' |
||||
entry_point: |
||||
autoload: False |
||||
toolbar: |
||||
enabled: False |
||||
toolkit: auto |
||||
window: |
||||
decorated: '@decorated@' |
||||
initial_state: maximized |
||||
stays_on_top: '@stays_on_top@' |
||||
title: Web Greeter for LightDM |
||||
|
||||
# App's Config |
||||
app: |
||||
branding: |
||||
background_images_dir: '@background_images_dir@' |
||||
logo_image: '@logo_image@' |
||||
user_image: '@user_image@' |
||||
config_dir: '@config_dir@' |
||||
greeter: |
||||
debug_mode: '@debug_mode@' |
||||
detect_theme_errors: True |
||||
screensaver_timeout: 300 |
||||
secure_mode: True |
||||
theme: gruvbox |
||||
icon_theme: |
||||
time_language: |
||||
layouts: |
||||
- us |
||||
- latam |
||||
features: |
||||
battery: False |
||||
backlight: |
||||
enabled: False |
||||
value: 10 |
||||
steps: 0 |
||||
greeters_dir: '@greeters_dir@' |
||||
locale_dir: '@locale_dir@' |
||||
themes_dir: '@themes_dir@' |
||||
version: |
||||
full: '3.0.0' |
||||
major: 3 |
||||
minor: 0 |
||||
micro: 0 |
||||
alpha: False |
||||
beta: False |
||||
rc: False |
Loading…
Reference in new issue