walrs
pywal but if its Fast-Minimal-Simple
git clone https://git.pi66.xyz/walrs
About | Files | Commits | Refs | License
fix args help problem and change the readme file
Author: pixel2175
Date: 2025-06-02 16:59
commit: d1585263
Stat
| M | README.md | 74 | +15 | -59 |
| D | main.rs | 245 | +0 | -245 |
| A | src/main.rs | 21 | +21 | -0 |
Diff
diff --git a/README.md b/README.md
index affb3de..86b00fd 100644
--- a/README.md
+++ b/README.md
@@ -1,65 +1,21 @@
-# Walrs
-Like Pywal, but written in Rust
+<div align="center" style="display: flex; align-items: center; justify-content: center; gap: 20px;">
+ <div align="left">
-## Features
-- Uses the same method as Pywal
-- Fast and minimal (10× faster than Pywal)
-- Better than Wallust in color accuracy, speed, and simplicity
-- Allows customization of brightness and saturation
+ ## walrs
+ #### Like Pywal, but written in Rust
+ walrs is a fast, minimalist CLI tool for generating color schemes from wallpapers.
+ It works the same as pywal but is written in Rust, making it faster and more efficient.
+ No external dependencies are required — just an app to set your wallpaper.
...
Show all
Show less
diff --git a/README.md b/README.md
index affb3de..86b00fd 100644
--- a/README.md
+++ b/README.md
@@ -1,65 +1,21 @@
-# Walrs
-Like Pywal, but written in Rust
+<div align="center" style="display: flex; align-items: center; justify-content: center; gap: 20px;">
+ <div align="left">
-## Features
-- Uses the same method as Pywal
-- Fast and minimal (10× faster than Pywal)
-- Better than Wallust in color accuracy, speed, and simplicity
-- Allows customization of brightness and saturation
+ ## walrs
+ #### Like Pywal, but written in Rust
+ walrs is a fast, minimalist CLI tool for generating color schemes from wallpapers.
+ It works the same as pywal but is written in Rust, making it faster and more efficient.
+ No external dependencies are required — just an app to set your wallpaper.
...
diff --git a/README.md b/README.md
index affb3de..86b00fd 100644
--- a/README.md
+++ b/README.md
@@ -1,65 +1,21 @@
-# Walrs
-Like Pywal, but written in Rust
+<div align="center" style="display: flex; align-items: center; justify-content: center; gap: 20px;">
+ <div align="left">
-## Features
-- Uses the same method as Pywal
-- Fast and minimal (10× faster than Pywal)
-- Better than Wallust in color accuracy, speed, and simplicity
-- Allows customization of brightness and saturation
+ ## walrs
+ #### Like Pywal, but written in Rust
+ walrs is a fast, minimalist CLI tool for generating color schemes from wallpapers.
+ It works the same as pywal but is written in Rust, making it faster and more efficient.
+ No external dependencies are required — just an app to set your wallpaper.
-## Usage
-```bash
-walrs - Generate a colorscheme from an image
+ If you're using pywal, you only need to replace the `wal` command with `walrs`.
+ Designed for users who prefer simplicity and speed.
-Usage: walrs [OPTIONS]
+ Report issues or bugs on GitHub.
+ Full documentation and details available at:
+ [https://pixelll.is-a.dev/tools/walrs](https://pixelll.is-a.dev/tools/walrs)
-Options:
- -i <IMAGE> Path to your wal.png | For random image: path to your wallpapers/
- -r, --reload Reload templates and set the wallpaper
- -R, --Reload Reload templates without setting the wallpaper
- -t, --theme <THEME> Use an external theme file
- -g, --generate <GENERATE> Generate theme and save it in the themes folder (.cache/wal/colorschemes)
- -s, --saturation <SATURATION> Specify saturation value (-128 to 127)
- -b, --brightness <BRIGHTNESS> Specify brightness value (-128 to 127)
- -q, --quit Enable quit mode (no output)
- --install-completions Install completions for the current shell
- -h, --help Print help
- -V, --version Print version
+ </div>
-```
+ <img src="https://pixelll.is-a.dev/static/images/walrs-logo.png" alt="walrs logo" height="200">
+</div>
-## Installation
-- AUR
-```bash
- yay -S walrs
-```
-- Source
-```bash
-git clone https://github.com/pixel2175/walrs && cd walrs && make install
-```
-
-## Performance
-- Memory: ~3 MB
-- Time: ~290 ms for a 1.5 MB 1080P image
-- Dependencies: Requires an external app to set the wallpaper (feh, xwallpaper, etc.)
-
-### Benchmark
-```bash
-
-time walrs -i ~/.config/wallpaper/
-[I] Generate: generate colors.
-[I] Template: create templates.
-[I] Wallpaper: wallpaper set with feh.
-[I] Terminal: terminal colorscheme set.
-[I] Xrdb: xrdb colorscheme set.
-[I] Colors: colorscheme applied successfully.
-● ● ● ● ● ● ● ● ●
-
-________________________________________________________
-Executed in 376.01 millis fish external
- usr time 236.90 millis 2.05 millis 234.85 millis
- sys time 132.21 millis 1.04 millis 131.17 millis
-```
-
-If you need any help, reach me on Discord @pi66
-or open an issue
diff --git a/main.rs b/main.rs
deleted file mode 100644
index 447e2dc..0000000
--- a/main.rs
+++ /dev/null
@@ -1,245 +0,0 @@
-mod create_templates;
-mod get_colors;
-mod reload;
-mod theme;
-mod utils;
-mod wallpaper;
-
-use argh::FromArgs;
-use create_templates::create_template;
-use get_colors::get_colors;
-use reload::reload;
-use std::fs::{copy, create_dir_all};
-use std::path::Path;
-use std::process::exit;
-use theme::{collect_themes, set_theme};
-use utils::*;
-
-#[derive(FromArgs)]
-#[argh(description = "walrs - Generate colorscheme from image")]
-struct Arg {
- #[argh(
- option,
- short = 'i',
- description = "path/to/your/wal.png | path/to/your/wallpapers/"
- )]
- image: Option<String>,
-
- #[argh(
- option,
- short = 'k',
- long = "backend",
- description = "change the colors backend (walrs -k backends)"
- )]
- backend: Option<String>,
-
- #[argh(
- switch,
- short = 'r',
- description = "reload without changing the wallpaper"
- )]
- reload: bool,
-
- #[argh(
- switch,
- short = 'R',
- long = "reload-nowal",
- description = "reload with changing the wallpaper"
- )]
- reload_nowal: bool,
-
- #[argh(
- option,
- short = 't',
- long = "theme",
- description = "use external theme file"
- )]
- theme: Option<String>,
-
- #[argh(
- option,
- short = 'g',
- long = "generate",
- description = "generate theme in themes folder (.cache/wal/colorschemes)"
- )]
- generate: Option<String>,
-
- #[argh(
- option,
- short = 's',
- long = "saturation",
- description = "specify the saturation value -128 => 127"
- )]
- saturation: Option<i8>,
-
- #[argh(
- option,
- short = 'b',
- long = "brightness",
- description = "specify the brightness value -128 => 127"
- )]
- brightness: Option<i8>,
-
- #[argh(
- switch,
- short = 'q',
- long = "quit",
- description = "set quit mode (no output)"
- )]
- quit: bool,
-
- #[argh(switch, short = 'v', long = "version", description = "version ")]
- version: bool,
-}
-
-fn image_path(image: Option<String>, send: bool) -> String {
- match image {
- Some(ref v) if Path::new(v).exists() => match get_absolute_path(v) {
- Some(p) => {
- if Path::new(&p).is_file() {
- p
- } else {
- std::str::from_utf8(
- &std::process::Command::new("sh")
- .arg("-c")
- .arg(format!("find "{}" -type f | sort -R | head -n1", p))
- .output()
- .unwrap()
- .stdout,
- )
- .unwrap()
- .trim()
- .to_string()
- }
- }
- None => {
- warning("Wallpaper", "Can't find wallpaper absolute path!", send);
- exit(1);
- }
- },
- Some(_) => {
- warning("Image", "Image does not exist", send);
- exit(1);
- }
- None => {
- warning("Image", "Can't find Image", send);
- exit(1);
- }
- }
-}
-
-fn print_themes(send: bool) {
- let (dark, light) = (collect_themes("dark", send), collect_themes("light", send));
-
- println!("[\x1b[33mDark\x1b[0m]");
- for theme in dark {
- println!(" -{theme}")
- }
-
- println!("[\x1b[33mLight\x1b[0m]");
- for theme in light {
- println!(" -{theme}")
- }
-}
-
-fn main() {
- let arg: Arg = argh::from_env();
- let backend = match arg.backend {
- Some(v) => {
- if v == "backends" {
- println!(
- "┌──────────────────────┬───────────────────────┐
-│ Method │ Description │
-├──────────────────────┼───────────────────────┤
-│ kmeans │ best colors, slow │
-│ color_thief │ balanced │
-│ palette_extract │ fast, weak colors │
-│ all │ use all methods │
-└──────────────────────┴───────────────────────┘"
- );
- exit(0)
- } else {
- v
- }
- }
- None => "kmeans".to_string(),
- };
- if arg.version {
- info(
- "Version",
- &format!("walrs {}", env!("CARGO_PKG_VERSION")),
- !arg.quit,
- );
- }
-
- if arg.reload_nowal {
- reload(!arg.quit, true);
- exit(0);
- }
-
- if arg.reload {
- reload(!arg.quit, false);
- exit(0);
- }
-
- if let Some(v) = arg.theme {
- if v == "themes" {
- print_themes(!arg.quit);
- } else {
- if get_config(!arg.quit)
- .join("wal")
- .join("colorscheme")
- .exists()
- || get_config(!arg.quit)
- .join("walrs")
- .join("colorscheme")
- .exists()
- {
- set_theme(v, !arg.quit);
- } else {
- create_dir_all(&format!(
- "{}/walrs/colorschemes",
- get_config(!arg.quit).to_string_lossy().to_string()
- ))
- .unwrap();
- run(&format!(
- "cp -r /etc/walrs/colorschemes/* {}/walrs/colorschemes",
- get_config(!arg.quit).to_string_lossy().to_string()
- ));
- set_theme(v, !arg.quit);
- };
- }
- exit(0);
- }
-
- if let Some(v) = arg.generate {
- let dis = get_config(!arg.quit).join("walrs").join("colorschemes");
- create_dir_all(&dis.join("dark")).unwrap();
- copy(
- get_config(!arg.quit).join("wal").join("colors"),
- dis.join("dark").join(v),
- )
- .unwrap();
- info("Generate", "generate colors", !arg.quit);
- exit(0);
- };
-
- if arg.image.is_some() {
- let image_path = image_path(arg.image, !arg.quit);
-
- let palette = get_colors(
- &image_path,
- &backend,
- !arg.quit,
- arg.brightness,
- arg.saturation,
- );
- info("Generate", "generate colors", !arg.quit);
-
- create_template(palette, &image_path, !arg.quit);
- info("Template", "create templates", !arg.quit);
-
- reload(!arg.quit, true);
- print_colors(!arg.quit);
- };
-}
diff --git a/src/main.rs b/src/main.rs
index d01b13f..f5db0a2 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -182,6 +182,27 @@ fn main() {
exit(0);
}
+ if arg.image.is_none() && arg.theme.is_none() && arg.generate.is_none() {
+ println!("Usage: walrs [-i <image>] [-k <backend>] [-r] [-R] [-t <theme>] [-g <generate>] [-s <saturation>] [-b <brightness>] [-q] [-v]
+
+walrs - Generate colorscheme from image
+
+Options:
+ -i, --image path/to/your/wal.png | path/to/your/wallpapers/
+ -k, --backend change the colors backend (walrs -k backends)
+ -r, --reload reload without changing the wallpaper
+ -R, --reload-no reload with changing the wallpaper
+ -t, --theme use external theme file
+ -g, --generate generate theme in themes folder (.cache/wal/colorschemes)
+ -s, --saturation specify the saturation value -128 => 127
+ -b, --brightness specify the brightness value -128 => 127
+ -q, --quit set quit mode (no output)
+ -v, --version version
+ --help, help display usage information
+");
+ exit(1);
+ }
+
if let Some(v) = arg.theme {
if v == "themes" {
print_themes(!arg.quit);