diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/target diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..a6b11fc --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "lightdm-mobile-greeter" +version = "0.1.0" +authors = ["Raatty "] +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/lightdm-mobile-greeter.py b/lightdm-mobile-greeter.py deleted file mode 100644 index 0c6d796..0000000 --- a/lightdm-mobile-greeter.py +++ /dev/null @@ -1,86 +0,0 @@ -#!/usr/bin/python3 -import gi -from gi.repository import Gtk, Gdk, Handy, LightDM - - -class Handler: - def __init__(self, builder: Gtk.Builder): - self.pin_entry = builder.get_object("entry_buffer") - self.greeter = LightDM.Greeter() - self.greeter.connect("authentication-complete", self.auth_complete) - self.greeter.connect("show-message", self.show_msg) - self.greeter.connect("show-prompt", self.show_prompt) - self.pmpt_label = builder.get_object("prompt_label") - self.msg_label = builder.get_object("message_label") - self.de_select = builder.get_object("de_select") - vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, visible=True) - self.de_select.add(vbox) - self.greeter.connect_sync() - self.user = LightDM.UserList.get_instance().get_users()[0].get_name() - self.greeter.authenticate(self.user) - self.session = self.greeter.get_default_session_hint() - sessions = iter([(s.get_name(), s.get_key()) for s in LightDM.get_sessions()]) - name, key = sessions.__next__() - first = Gtk.RadioButton.new_with_label(None, name) - first.connect("toggled", self.session_change, key) - vbox.add(first) - for name, key in sessions: - rb = Gtk.RadioButton.new_with_label_from_widget(first, name) - rb.connect("toggled", self.session_change, key) - vbox.add(rb) - if self.session == key: - rb.set_active(True) - vbox.show_all() - - def session_change(self, rb, key): - self.session = key - - def on_destry(self, window): - Gtk.main_quit() - - def login_cb(self, login_btn): - self.greeter.respond(self.pin_entry.get_text()) - self.pin_entry.set_text("", 0) - - def backspace(self, del_btn): - length = self.pin_entry.get_length() - if length <= 0: - return - self.pin_entry.delete_text(length - 1, 1) - - def auth_complete(self, greeter): - if greeter.get_is_authenticated(): - greeter.start_session_sync(self.session) - else: - greeter.authenticate(self.user) - - def show_msg(self, greeter, text, type): - self.msg_label.set_text(text) - - def show_prompt(self, greeter, text, type): - self.pmpt_label.set_text(text) - - def de_popover(self, settings_btn): - self.de_select.popup() - - -Handy.Keypad() -builder: Gtk.Builder = Gtk.Builder.new_from_file( - "%DATADIR%/lightdm-mobile-greeter/interface.ui" -) -handler = Handler(builder) -builder.connect_signals(handler) -window: Gtk.Window = builder.get_object("greeter_window") -display = Gdk.Display.get_default() -monitor = display.get_monitor(0) -screen_size = monitor.get_geometry() -window.set_size_request(screen_size.width, screen_size.height) -container = builder.get_object("container") -container.set_size_request(screen_size.width * 0.8, screen_size.height * 0.8) -style: Gtk.CssProvider = Gtk.CssProvider() -style.load_from_path("%DATADIR%/lightdm-mobile-greeter/style.css") -Gtk.StyleContext.add_provider_for_screen( - Gdk.Screen.get_default(), style, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION -) -window.show() -Gtk.main() diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..e7a11a9 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello, world!"); +}