Add 'New Login' button to unlock dialog
This commit is contained in:
@ -6,8 +6,11 @@ edition = "2021"
|
||||
[lib]
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1"
|
||||
clap = "3"
|
||||
env_logger = "0.9"
|
||||
lazy_static = "1"
|
||||
libc = "0.2"
|
||||
toml = "0.5"
|
||||
xcb = { git = "https://github.com/rust-x-bindings/rust-xcb", rev = "d09b5f91bc07d56673f1bc0d6c7ecd72b5ff7b3e", features = ["randr", "screensaver", "xfixes"] }
|
||||
xdg = "2"
|
||||
|
@ -1,4 +1,5 @@
|
||||
use std::{ffi::CStr, io};
|
||||
use std::{ffi::CStr, fs::File, io::{self, Read}};
|
||||
use toml::Value;
|
||||
use xcb::x;
|
||||
|
||||
pub const BSCREENSAVER_WM_CLASS: &[u8] = b"bscreensaver\0Bscreensaver\0";
|
||||
@ -10,6 +11,21 @@ pub fn init_logging(env_name: &str) {
|
||||
.init();
|
||||
}
|
||||
|
||||
pub fn load_configuration() -> anyhow::Result<Option<Value>> {
|
||||
match xdg::BaseDirectories::new()?.find_config_file("bscreensaver.toml") {
|
||||
None => Ok(None),
|
||||
Some(config_path) => {
|
||||
let mut f = File::open(config_path)?;
|
||||
let mut config = String::new();
|
||||
f.read_to_string(&mut config)?;
|
||||
drop(f);
|
||||
|
||||
let config_toml = config.parse::<Value>()?;
|
||||
Ok(Some(config_toml))
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
pub fn create_atom(conn: &xcb::Connection, name: &[u8]) -> xcb::Result<x::Atom> {
|
||||
let cookie = conn.send_request(&x::InternAtom {
|
||||
only_if_exists: false,
|
||||
|
Reference in New Issue
Block a user