diff --git a/README.md b/README.md index 1ed2fdc..e951d72 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Display wallpapers on Sway, this is essentially a wrapper for `swaybg`. ## Usage -```sh +``` usage: sway-wallpaper [options] required: @@ -21,12 +21,15 @@ required: path The path to the directory containing the wallpapers options: - --always-random if set, always randomize the next wallpaper -h, --help Show help - -i, --interval Specify the interval between + -i, --interval Specify the interval between wallpapers in seconds --never-random if set, wallpapers order is based on the names of the files ``` +Example: + +`./sway-wallpaper /path/to/wallpapers -i 3600 DP-1` + ## Installation First, clone this repository `git clone https://codeberg.org/vyn/sway-wallpaper.git` (or download it the way you prefer). @@ -36,7 +39,7 @@ You only need **gcc** and **cmake**, run these commands in the project directory ``` mkdir build cd build -cmake .. +cmake -DCMAKE_BUILD_TYPE=Release .. make ``` diff --git a/src/CliArguments.h b/src/CliArguments.h index c2de5a9..a72aa93 100644 --- a/src/CliArguments.h +++ b/src/CliArguments.h @@ -99,11 +99,11 @@ namespace CliArguments { longestArgLength = key.length(); } } - std::cout << "usage: sway-wallpaper [options]" << std::endl; + std::cout << "usage: sway-wallpaper [options]"; for (const auto& arg : directArguments_) { std::cout << " <" << arg << ">"; } - std::cout << std::endl; + std::cout << std::endl << std::endl; std::cout << "required:" << std::endl; for (const auto& [key, arg] : arguments_) { diff --git a/src/Wallpapers.cpp b/src/Wallpapers.cpp index 5471b22..f721799 100644 --- a/src/Wallpapers.cpp +++ b/src/Wallpapers.cpp @@ -13,6 +13,7 @@ Wallpapers::Wallpapers(const std::string& directoryPath) : directoryPath(directo } e1 = std::default_random_engine(r()); uniformDist = std::uniform_int_distribution(0, wallpapersPath.size()); + wallpapersPathQueue = wallpapersPath; } void Wallpapers::shuffle() { diff --git a/src/main.cpp b/src/main.cpp index 550a6f4..bc66eb1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -24,17 +24,13 @@ int main(int argc, char** argv, char** envp) { }}, {"interval", { .aliases = {"i"}, - .description = "Specify the interval between", + .description = "Specify the interval between wallpapers in seconds", .type = CliArguments::Int, }}, {"never-random", { .description = "if set, wallpapers order is based on the names of the files", .type = CliArguments::Bool, }}, - {"always-random", { - .description = "if set, always randomize the next wallpaper", - .type = CliArguments::Bool, - }}, {"help", { .aliases = {"h"}, .description = "Show help", @@ -70,9 +66,6 @@ int main(int argc, char** argv, char** envp) { int interval = arguments.getInt("interval"); while (true) { sleep(interval); - if (arguments.exists("always-random")) { - wallpapers.shuffle(); - } SwaybgProcess newSwayBgProcess(wallpapers.next(), output); newSwayBgProcess.exec(); sleep(1);