Skip to content

Commit

Permalink
handle force flag correctly and naming
Browse files Browse the repository at this point in the history
  • Loading branch information
0xk1f0 committed Apr 1, 2023
1 parent ce3af7f commit 5585769
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/outputs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ struct ListOutputs {
}

impl Monitor {
pub fn new_from_hyprland() -> Result<Vec<Monitor>, String> {
pub fn new() -> Result<Vec<Monitor>, String> {
// new vector for result imgs
let mut result: Vec<Monitor> = Vec::new();

Expand Down
32 changes: 21 additions & 11 deletions src/splitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ impl Splitter {
)?;

// fetch monitors
self.monitors = Monitor::new_from_hyprland().map_err(
self.monitors = Monitor::new().map_err(
|err| err.to_string()
)?;

Expand Down Expand Up @@ -76,12 +76,9 @@ impl Splitter {

//check wpaper config hash
if ! config.force_resplit {
if let true = wpaperd.check_existing().map_err(
if let false = wpaperd.check_existing().map_err(
|err| err.to_string()
)? {
// match, don't rebuild
}
else {
// we need to rebuild
self.result_papers = self.perform_split(
img,
Expand All @@ -91,17 +88,30 @@ impl Splitter {
|err| err.to_string()
)?;

// also config
wpaperd.build(&self.result_papers).map_err(
|err| err.to_string()
)?;

// finally, run wrapper
cmd_wrapper().map_err(
|err| err.to_string()
)?;
}
} else {
// we need to rebuild
self.result_papers = self.perform_split(
img,
config,
format!("{}/.cache/",var("HOME").unwrap())
).map_err(
|err| err.to_string()
)?;

wpaperd.build(&self.result_papers).map_err(
|err| err.to_string()
)?;
}

// finally, run wrapper
cmd_wrapper().map_err(
|err| err.to_string()
)?;

// no wpaperd to worry about, just split
} else {
// just split
Expand Down

0 comments on commit 5585769

Please sign in to comment.