Skip to content

Commit 5cd37f5

Browse files
authored
fix: The betterlockscreen argument no longer ignored (#34)
Closes #33
2 parents e8b1076 + c67a2f2 commit 5cd37f5

File tree

2 files changed

+8
-14
lines changed

2 files changed

+8
-14
lines changed

src/cli.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pub struct Cli {
2828

2929
/// Updates the betterlockscreen wallpaper
3030
#[clap(long, group = "input")]
31-
betterlockscreen: bool,
31+
betterlockscreen: Option<bool>,
3232
}
3333

3434
impl Cli {
@@ -44,10 +44,14 @@ impl Cli {
4444

4545
pub fn get_settings(&self) -> Settings {
4646
let mut settings = get_configuration().unwrap_or_else(|_| Settings::default());
47+
4748
if let Some(seconds) = self.get_seconds() {
4849
settings.sleep_time = seconds;
4950
}
50-
settings.betterlockscreen = self.betterlockscreen;
51+
52+
if let Some(betterlockscreen) = self.betterlockscreen {
53+
settings.betterlockscreen = betterlockscreen;
54+
}
5155

5256
settings
5357
}

src/wallpaper.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,7 @@ fn get_home_dir() -> Result<String, WallshiftError> {
2424
Ok(home)
2525
}
2626

27-
/// Gets the current wallpaper. It assumes that the user is only using feh to set the wallpaper.
28-
/// TODO: allow user to choose other wallpaper setter
29-
///
30-
///
31-
/// The .fehbg file is a shell script that is run when the user logs in. It is used to set the
32-
/// wallpaper. It uses the following format:
33-
///
34-
/// #!/bin/sh
35-
/// feh --no-fehbg --bg-fill /path/to/wallpaper
36-
///
37-
/// This function parses the .fehbg file and returns the path to the current wallpaper.
27+
/// Gets the current wallpaper that has been stored on a particular config file.
3828
pub fn get_current_wallpaper() -> Result<File, WallshiftError> {
3929
let wallpaper_path = read_to_string(format!(
4030
"{}/.local/share/wallshift/.current_wallpaper",
@@ -232,7 +222,7 @@ pub fn update_wallpaper(settings: &Settings, path: &str) -> Result<(), Wallshift
232222
}
233223

234224
// Saves the current wallpaper
235-
//
225+
236226
let home = get_home_dir()?;
237227

238228
std::fs::create_dir_all(format!("{home}/.local/share/wallshift")).map_err(|err| {

0 commit comments

Comments
 (0)