Skip to content

Commit

Permalink
update default command to ignore blacklist
Browse files Browse the repository at this point in the history
  • Loading branch information
danitt committed Sep 24, 2023
1 parent fc3d7cc commit bbb5ae0
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fn main() {
Some(Commands::Uninstall) => {
uninstall::run().unwrap();
}
None => run(),
None => move_windows_to_primary_display(),
}
}

Expand All @@ -56,24 +56,21 @@ fn watch() -> notify::Result<()> {
println!("Watching for monitor configuration changes...");
for res in rx {
match res {
Ok(_) => run(),
Ok(_) => {
if !is_blacklisted_display_connected() {
println!("No blacklisted display found.");
}

println!("Moving windows to primary display");
move_windows_to_primary_display();
}
Err(e) => println!("Watch error: {:?}", e),
}
}

Ok(())
}

fn run() {
if !is_blacklisted_display_connected() {
println!("No blacklisted display found.");
return;
}

println!("Moving windows to primary display");
move_windows_to_primary_display();
}

fn is_blacklisted_display_connected() -> bool {
let blacklist_displays = get_blacklisted_displays();

Expand Down

0 comments on commit bbb5ae0

Please sign in to comment.