Add 'New Login' button to unlock dialog

This commit is contained in:
2022-05-04 00:22:00 -07:00
parent 832b381421
commit 92504d279a
7 changed files with 68 additions and 28 deletions

View File

@ -20,8 +20,6 @@ bscreensaver-util = { path = "../util" }
humantime = "2"
log = "0.4"
nix = "0.23"
toml = "0.5"
# git source needed until extension event error resolution fix is released
xcb = { git = "https://github.com/rust-x-bindings/rust-xcb", rev = "d09b5f91bc07d56673f1bc0d6c7ecd72b5ff7b3e", features = ["randr", "xfixes", "xinput"] }
xcb-xembed = { path = "../xcb-xembed" }
xdg = "2"

View File

@ -15,7 +15,7 @@ use nix::{
use std::{
env,
ffi::CString,
fs::{read_link, File},
fs::read_link,
io::{self, Read},
os::{
linux::process::{ChildExt, CommandExt, PidFd},
@ -277,19 +277,11 @@ fn main() -> anyhow::Result<()> {
fn parse_config() -> anyhow::Result<Configuration> {
use humantime::parse_duration;
use toml::Value;
match xdg::BaseDirectories::new()?.find_config_file("bscreensaver.toml") {
None => Ok(Configuration::default()),
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>()?;
let mut config = Configuration::default();
let mut config = Configuration::default();
match load_configuration()? {
None => Ok(config),
Some(config_toml) => {
config.lock_timeout = match config_toml.get("lock-timeout") {
None => config.lock_timeout,
Some(val) => parse_duration(val.as_str().ok_or(anyhow!("'lock-timeout' must be a duration string like '10m' or '90s'"))?)?,