Загрузил(а) файлы в 'src'
This commit is contained in:
parent
7952b82617
commit
799e98655e
|
@ -0,0 +1,33 @@
|
|||
use std::time::{Duration, Instant};
|
||||
use std::thread::sleep;
|
||||
use std::process::Command;
|
||||
use std::fs;
|
||||
use download_rs::async_download::Download;
|
||||
use wallpaper;
|
||||
|
||||
fn main() {
|
||||
fs::create_dir_all("/tmp/i3-unspl").unwrap();
|
||||
|
||||
let _hd = "https://source.unsplash.com/random/1280x720/?backgrounds/";
|
||||
let _fhd = "https://source.unsplash.com/random/1920x1080/?backgrounds/";
|
||||
let _thd = "https://source.unsplash.com/random/3440x1440/?backgrounds/";
|
||||
let _uhd = "https://source.unsplash.com/random/4096x2160/?backgrounds/";
|
||||
|
||||
let name = "/tmp/i3-unspl/bg.png";
|
||||
|
||||
loop {
|
||||
fs::remove_file("/tmp/i3-unspl/bg.png");
|
||||
|
||||
let down = Download::new(_thd, Some(name),None);
|
||||
match down.download() {
|
||||
Ok(_) => println!("Изображение успешно скачано!"),
|
||||
Err(_e) => println!("Не удалось скачать изображение :("),
|
||||
}
|
||||
|
||||
wallpaper::set_from_path("/tmp/i3-unspl/bg.png");
|
||||
wallpaper::set_mode(wallpaper::Mode::Fit);
|
||||
|
||||
let _a = Instant::now();
|
||||
sleep(Duration::new(3600, 3600));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue