Skip to content

Commit

Permalink
Terminate web-greeter gracefully
Browse files Browse the repository at this point in the history
Set lightdm resettable property as true, so the greeter doesn't terminate
immediately after a successful start_session.
  • Loading branch information
JezerM committed Mar 31, 2024
1 parent 308139f commit bbc70a3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ def parse(argv):
from bridge import Greeter, Config, ThemeUtils
from PyQt5.QtWidgets import QApplication
from PyQt5.QtCore import Qt, QCoreApplication
from logger import logger

QCoreApplication.setAttribute(Qt.AA_EnableHighDpiScaling)
QApplication.setAttribute(Qt.AA_EnableHighDpiScaling)
Expand All @@ -141,3 +142,6 @@ def parse(argv):
# browser.load()
browser.show()
browser.run()

logger.debug("App closed")
sys.exit(0)
4 changes: 4 additions & 0 deletions src/bridge/Greeter.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ def __init__(self, *args, **kwargs):
self._brightness_controller = BrightnessController()

try:
LightDMGreeter.set_resettable(True)
LightDMGreeter.connect_to_daemon_sync()
except GError as err:
logger.error(err)
Expand Down Expand Up @@ -367,13 +368,16 @@ def shutdown(self):

@Bridge.method(str, result=bool)
def start_session(self, session):
from PyQt5.QtCore import QCoreApplication

if not session.strip():
return False
try:
started: bool = LightDMGreeter.start_session_sync(session)
if started or self.is_authenticated:
logger.debug("Session \"%s\" started", session)
screensaver.reset_screensaver()
QCoreApplication.quit() # Quit application after start_session
return started
except GError as err:
logger.error(err)
Expand Down

0 comments on commit bbc70a3

Please sign in to comment.