Skip to content

Commit

Permalink
add debug logging and GLib.idle_add to set gui
Browse files Browse the repository at this point in the history
  • Loading branch information
sulincix committed Jul 1, 2024
1 parent 0ae6183 commit 3de9a8c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/module/daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,29 @@ def module_init():
if not get("enabled",True,"daemon"):
return
while True:
debug("Creating fifo")
os.mkfifo("/{}/pardus-greeter".format(busdir))
try:
with open("/{}/pardus-greeter".format(busdir),"r") as f:
username=""
password=""
debug("Reading fifo")
data=json.loads(f.read())
debug("fifo data: {}".format(str(data)))
os.unlink("/{}/pardus-greeter".format(busdir))
debug("Removing fifo")
if "username" in data:
username=str(data["username"])
if "password" in data:
password = str(data["password"])
if "session" in data:
lightdm.set(session = str(data["session"]))
loginwindow.o("ui_entry_username").set_text(username)
loginwindow.o("ui_entry_password").set_text(password)
GLib.idle_add(loginwindow.o("ui_entry_username").set_text, username)
GLib.idle_add(loginwindow.o("ui_entry_password").set_text, password)
lightdm.set(username, password)
lightdm.login()
except Exception as e:
if os.path.exists("/{}/pardus-greeter".format(busdir)):
os.unlink("/{}/pardus-greeter".format(busdir))
debug("Removing fifo")
print(traceback.format_exc(), file=sys.stderr)

0 comments on commit 3de9a8c

Please sign in to comment.