1
0
Fork 0

no more json config

This commit is contained in:
Raatty 2020-04-21 17:51:00 +12:00
parent 358968327d
commit efd9e3de04
2 changed files with 5 additions and 16 deletions

View File

@ -7,13 +7,10 @@ A simple log in screen for use on touch screens, designed for use on postmarketO
make install make install
``` ```
## Configuring ## Configuring
/etc/lightdm_mobile_greeter.json As of version 3 I will now try to guess the user.
```json
{"user":"<YOUR USERNAME HERE>"}
```
lightdm.conf lightdm.conf
``` ```
greeter-session=lightdm-mobile-greeter greeter-session=lightdm-mobile-greeter
user-session=<THE CHOSEN DE TO LAUNCH AFTER SUCCESSFUL LOGIN> user-session=<THE CHOSEN DE TO LAUNCH AFTER SUCCESSFUL LOGIN>
``` ```

View File

@ -1,14 +1,6 @@
#!/usr/bin/python3 #!/usr/bin/python3
import gi import gi
from gi.repository import Gtk, Gdk, Handy, LightDM from gi.repository import Gtk, Gdk, Handy, LightDM
import json
class Config:
def __init__(self):
with open("/etc/lightdm_mobile_greeter.json") as f:
j = json.load(f)
self.user = j["user"]
class Handler: class Handler:
@ -24,8 +16,8 @@ class Handler:
vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, visible=True) vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, visible=True)
self.de_select.add(vbox) self.de_select.add(vbox)
self.greeter.connect_sync() self.greeter.connect_sync()
self.conf = Config() self.user = LightDM.UserList.get_instance().get_users()[0].get_name()
self.greeter.authenticate(self.conf.user) self.greeter.authenticate(self.user)
self.session = self.greeter.get_default_session_hint() self.session = self.greeter.get_default_session_hint()
sessions = iter([(s.get_name(), s.get_key()) for s in LightDM.get_sessions()]) sessions = iter([(s.get_name(), s.get_key()) for s in LightDM.get_sessions()])
name, key = sessions.__next__() name, key = sessions.__next__()
@ -60,7 +52,7 @@ class Handler:
if greeter.get_is_authenticated(): if greeter.get_is_authenticated():
greeter.start_session_sync(self.session) greeter.start_session_sync(self.session)
else: else:
greeter.authenticate(self.conf.user) greeter.authenticate(self.user)
def show_msg(self, greeter, text, type): def show_msg(self, greeter, text, type):
self.msg_label.set_text(text) self.msg_label.set_text(text)