Pi66

Home | Repos | About | Blog | Gaza

walrs
pywal but if its Fast-Minimal-Simple
git clone https://git.pi66.xyz/walrs

About | Files | Commits | Refs | License


1.0.4

Author: pixel
Date: 2025-04-04 19:38
commit: 177d6d80

Stat

M src/main.rs 28 +19 -9
M src/reload.rs 10 +5 -5

Diff

diff --git a/src/main.rs b/src/main.rs
index d81c12b..2e2db4f 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -20,7 +20,11 @@ struct Arg {
     #[arg(short = 'i')]
     image: Option<String>,

- /// reload Templates from cache file + /// reload Templates from cache file without set the wallpaper + #[arg(short = 'r', action = ArgAction::SetTrue)] + reload_nowal: bool, + + /// reload Templates from cache file and set the wallpaper #[arg(short = 'R', action = ArgAction::SetTrue)] reload: bool,

@@ -46,19 +50,25 @@ struct Arg { fn main() { let arg = Arg::parse(); ...

Show all

diff --git a/src/main.rs b/src/main.rs
index d81c12b..2e2db4f 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -20,7 +20,11 @@ struct Arg {
     #[arg(short = 'i')]
     image: Option<String>,

- /// reload Templates from cache file + /// reload Templates from cache file without set the wallpaper + #[arg(short = 'r', action = ArgAction::SetTrue)] + reload_nowal: bool, + + /// reload Templates from cache file and set the wallpaper #[arg(short = 'R', action = ArgAction::SetTrue)] reload: bool,

@@ -46,19 +50,25 @@ struct Arg { fn main() { let arg = Arg::parse();

- if !arg.reload && arg.image.is_none() { - let mut cmd = Arg::command(); - let _ = cmd.print_help(); - - std::process::exit(1); - }

+ if arg.reload_nowal { + reload(!arg.quit,false); + exit(0); + }

 if arg.reload {

- reload(!arg.quit); + reload(!arg.quit,true); exit(0); }

+ + if arg.image.is_none() { + let mut cmd = Arg::command(); + let _ = cmd.print_help(); + + std::process::exit(1); + } + let image_path = match arg.image { Some(ref v) if Path::new(v).exists() => match get_absolute_path(v) { Some(p) => p, @@ -83,7 +93,7 @@ fn main() { create_template(palette, &image_path); info("Template", "create templates", !arg.quit);

- reload(!arg.quit); + reload(!arg.quit,true);

 print&#95;colors(!arg.quit);

} diff --git a/src/reload.rs b/src/reload.rs index bfbd8e5..b1e5c0a 100644 --- a/src/reload.rs +++ b/src/reload.rs @@ -91,7 +91,7 @@ fn colors(colors:Vec<String>,send:bool){ info("Terminal", "terminal colorscheme set",send); }

-pub fn reload(send:bool) { +pub fn reload(send:bool,set_wal:bool) { let cache = get_cache_folder().expect("Can't get cache path"); let file_path = format!("{}/wal/colors", cache);

@@ -107,10 +107,10 @@ pub fn reload(send:bool) { None => {warning("Path", "can't found cache folder",send);exit(1)} };

- - let wallpaper = read_to_string(format!("{}/wal/wal",cache)).expect("run 'cp /etc/walrs/templates/wal ~/.config/walrs/templates/' and restart app").lines().next().unwrap().trim().to_string(); - wallpaper::change_wallpaper(wallpaper.as_str(),send); - + if set_wal{ + let wallpaper = read_to_string(format!("{}/wal/wal",cache)).expect("run 'cp /etc/walrs/templates/wal ~/.config/walrs/templates/' and restart app").lines().next().unwrap().trim().to_string(); + wallpaper::change_wallpaper(wallpaper.as_str(),send); + } colors(lines,send); xrdb(&cache,send); kitty(&cache,send);

// Created by Pi66

// Copyright ©Pi66 2026