Improve readme

This commit is contained in:
Vyn 2024-06-03 09:35:53 +02:00
parent 0d840f0d50
commit fce4fad1fb
4 changed files with 11 additions and 14 deletions

View file

@ -13,7 +13,7 @@ Display wallpapers on Sway, this is essentially a wrapper for `swaybg`.
## Usage
```sh
```
usage: sway-wallpaper [options] <path> <output>
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
```

View file

@ -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_) {

View file

@ -13,6 +13,7 @@ Wallpapers::Wallpapers(const std::string& directoryPath) : directoryPath(directo
}
e1 = std::default_random_engine(r());
uniformDist = std::uniform_int_distribution<int>(0, wallpapersPath.size());
wallpapersPathQueue = wallpapersPath;
}
void Wallpapers::shuffle() {

View file

@ -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);