Compare commits
6 Commits
Author | SHA1 | Date |
---|---|---|
raatty | 8c8d6dfce6 | |
Raatty | e3872c0a69 | |
Raatty | 3f3bb56290 | |
Raatty | 34df640d5d | |
Raatty | e0beba1b89 | |
Raatty | e29ec82802 |
|
@ -362,7 +362,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "light-dm-sys"
|
||||
version = "0.0.1"
|
||||
source = "git+https://raatty.club:3000/raatty/lightdm-rs.git#a3c669583bb932e2b25372048b1e9dbda1f10e11"
|
||||
source = "git+https://git.raatty.club/raatty/lightdm-rs.git#a3c669583bb932e2b25372048b1e9dbda1f10e11"
|
||||
dependencies = [
|
||||
"gio-sys",
|
||||
"glib-sys",
|
||||
|
@ -374,7 +374,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "lightdm"
|
||||
version = "0.1.0"
|
||||
source = "git+https://raatty.club:3000/raatty/lightdm-rs.git#a3c669583bb932e2b25372048b1e9dbda1f10e11"
|
||||
source = "git+https://git.raatty.club/raatty/lightdm-rs.git#a3c669583bb932e2b25372048b1e9dbda1f10e11"
|
||||
dependencies = [
|
||||
"gio",
|
||||
"gio-sys",
|
||||
|
|
|
@ -9,7 +9,7 @@ edition = "2018"
|
|||
libhandy = "0.5.0"
|
||||
gdk = "0.12.1"
|
||||
gtk = "0.8.1"
|
||||
lightdm = { git = "https://raatty.club:3000/raatty/lightdm-rs.git"}
|
||||
lightdm = { git = "https://git.raatty.club/raatty/lightdm-rs.git"}
|
||||
|
||||
[profile.release]
|
||||
panic = "abort"
|
||||
|
|
|
@ -14,3 +14,6 @@ lightdm.conf
|
|||
greeter-session=lightdm-mobile-greeter
|
||||
user-session=<THE CHOSEN DE TO LAUNCH AFTER SUCCESSFUL LOGIN>
|
||||
```
|
||||
|
||||
## Theming
|
||||
If you have a file at `/etc/lightdm/lightdm_mobile_greeter.css` styling will be read from it falling back to the backed in styling, checkout style.css to get ideas on what to change
|
42
src/main.rs
42
src/main.rs
|
@ -5,9 +5,10 @@ use libhandy;
|
|||
use lightdm;
|
||||
use lightdm::{GreeterExt, SessionExt, UserExt, UserListExt};
|
||||
use std::cell::RefCell;
|
||||
use std::rc::Rc;
|
||||
use std::{fs,io};
|
||||
use std::io::prelude::*;
|
||||
use std::path::*;
|
||||
use std::rc::Rc;
|
||||
use std::{fs, io};
|
||||
|
||||
fn main() {
|
||||
if gtk::init().is_err() {
|
||||
|
@ -27,14 +28,18 @@ fn main() {
|
|||
{
|
||||
let handler_borrowed = handler.borrow();
|
||||
if let Ok(os_str) = pretty_name() {
|
||||
handler_borrowed.msg_label.as_ref().expect("no msg label").set_text(&os_str);
|
||||
handler_borrowed
|
||||
.msg_label
|
||||
.as_ref()
|
||||
.expect("no msg label")
|
||||
.set_text(&os_str);
|
||||
}
|
||||
}
|
||||
{
|
||||
let handler_borrowed = handler.borrow();
|
||||
let greeter = handler_borrowed.greeter.as_ref().expect("no greeter");
|
||||
let user = handler_borrowed.user.as_ref().expect("no user");
|
||||
greeter.authenticate(Some(&user)).ok();
|
||||
let user = handler_borrowed.user.as_ref().expect("no user");
|
||||
greeter.authenticate(Some(&user)).ok();
|
||||
}
|
||||
let handler_builder_clone = handler.clone();
|
||||
builder.connect_signals(move |_, name| {
|
||||
|
@ -94,14 +99,27 @@ fn main() {
|
|||
(screen_size.height as f32 * 0.8) as i32,
|
||||
);
|
||||
let style = gtk::CssProvider::new();
|
||||
let screen = gdk::Screen::get_default().expect("cant get screen");
|
||||
style
|
||||
.load_from_data(include_bytes!("../style.css"))
|
||||
.expect("failed to load style");
|
||||
gtk::StyleContext::add_provider_for_screen(
|
||||
&gdk::Screen::get_default().expect("cant get screen"),
|
||||
&screen,
|
||||
&style,
|
||||
gtk::STYLE_PROVIDER_PRIORITY_APPLICATION,
|
||||
);
|
||||
let custom_conf = Path::new("/etc/lightdm/lightdm_mobile_greeter.css");
|
||||
if custom_conf.exists() {
|
||||
let style2 = gtk::CssProvider::new();
|
||||
if let Some(path) = custom_conf.to_str() {
|
||||
style2.load_from_path(path).expect("failed to load style2");
|
||||
}
|
||||
gtk::StyleContext::add_provider_for_screen(
|
||||
&screen,
|
||||
&style2,
|
||||
gtk::STYLE_PROVIDER_PRIORITY_USER,
|
||||
)
|
||||
}
|
||||
}
|
||||
window.show();
|
||||
gtk::main();
|
||||
|
@ -215,12 +233,12 @@ impl Handler {
|
|||
}
|
||||
let keys_iter = keys.iter();
|
||||
for (rb, key) in rbs.iter().zip(keys_iter) {
|
||||
let handler_clone = handler.clone();
|
||||
let key_clone = key.clone();
|
||||
rb.connect_toggled(move |_| {
|
||||
handler_clone.borrow_mut().session = Some(key_clone.clone());
|
||||
});
|
||||
};
|
||||
let handler_clone = handler.clone();
|
||||
let key_clone = key.clone();
|
||||
rb.connect_toggled(move |_| {
|
||||
handler_clone.borrow_mut().session = Some(key_clone.clone());
|
||||
});
|
||||
}
|
||||
self.de_select.as_ref().expect("no de select").add(&vbox);
|
||||
vbox.show_all()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue