Improve readme
This commit is contained in:
parent
0d840f0d50
commit
fce4fad1fb
4 changed files with 11 additions and 14 deletions
11
README.md
11
README.md
|
@ -13,7 +13,7 @@ Display wallpapers on Sway, this is essentially a wrapper for `swaybg`.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
```sh
|
```
|
||||||
usage: sway-wallpaper [options] <path> <output>
|
usage: sway-wallpaper [options] <path> <output>
|
||||||
|
|
||||||
required:
|
required:
|
||||||
|
@ -21,12 +21,15 @@ required:
|
||||||
path The path to the directory containing the wallpapers
|
path The path to the directory containing the wallpapers
|
||||||
|
|
||||||
options:
|
options:
|
||||||
--always-random if set, always randomize the next wallpaper
|
|
||||||
-h, --help Show help
|
-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
|
--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
|
## Installation
|
||||||
|
|
||||||
First, clone this repository `git clone https://codeberg.org/vyn/sway-wallpaper.git` (or download it the way you prefer).
|
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
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
cmake ..
|
cmake -DCMAKE_BUILD_TYPE=Release ..
|
||||||
make
|
make
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -99,11 +99,11 @@ namespace CliArguments {
|
||||||
longestArgLength = key.length();
|
longestArgLength = key.length();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::cout << "usage: sway-wallpaper [options]" << std::endl;
|
std::cout << "usage: sway-wallpaper [options]";
|
||||||
for (const auto& arg : directArguments_) {
|
for (const auto& arg : directArguments_) {
|
||||||
std::cout << " <" << arg << ">";
|
std::cout << " <" << arg << ">";
|
||||||
}
|
}
|
||||||
std::cout << std::endl;
|
std::cout << std::endl << std::endl;
|
||||||
std::cout << "required:" << std::endl;
|
std::cout << "required:" << std::endl;
|
||||||
|
|
||||||
for (const auto& [key, arg] : arguments_) {
|
for (const auto& [key, arg] : arguments_) {
|
||||||
|
|
|
@ -13,6 +13,7 @@ Wallpapers::Wallpapers(const std::string& directoryPath) : directoryPath(directo
|
||||||
}
|
}
|
||||||
e1 = std::default_random_engine(r());
|
e1 = std::default_random_engine(r());
|
||||||
uniformDist = std::uniform_int_distribution<int>(0, wallpapersPath.size());
|
uniformDist = std::uniform_int_distribution<int>(0, wallpapersPath.size());
|
||||||
|
wallpapersPathQueue = wallpapersPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Wallpapers::shuffle() {
|
void Wallpapers::shuffle() {
|
||||||
|
|
|
@ -24,17 +24,13 @@ int main(int argc, char** argv, char** envp) {
|
||||||
}},
|
}},
|
||||||
{"interval", {
|
{"interval", {
|
||||||
.aliases = {"i"},
|
.aliases = {"i"},
|
||||||
.description = "Specify the interval between",
|
.description = "Specify the interval between wallpapers in seconds",
|
||||||
.type = CliArguments::Int,
|
.type = CliArguments::Int,
|
||||||
}},
|
}},
|
||||||
{"never-random", {
|
{"never-random", {
|
||||||
.description = "if set, wallpapers order is based on the names of the files",
|
.description = "if set, wallpapers order is based on the names of the files",
|
||||||
.type = CliArguments::Bool,
|
.type = CliArguments::Bool,
|
||||||
}},
|
}},
|
||||||
{"always-random", {
|
|
||||||
.description = "if set, always randomize the next wallpaper",
|
|
||||||
.type = CliArguments::Bool,
|
|
||||||
}},
|
|
||||||
{"help", {
|
{"help", {
|
||||||
.aliases = {"h"},
|
.aliases = {"h"},
|
||||||
.description = "Show help",
|
.description = "Show help",
|
||||||
|
@ -70,9 +66,6 @@ int main(int argc, char** argv, char** envp) {
|
||||||
int interval = arguments.getInt("interval");
|
int interval = arguments.getInt("interval");
|
||||||
while (true) {
|
while (true) {
|
||||||
sleep(interval);
|
sleep(interval);
|
||||||
if (arguments.exists("always-random")) {
|
|
||||||
wallpapers.shuffle();
|
|
||||||
}
|
|
||||||
SwaybgProcess newSwayBgProcess(wallpapers.next(), output);
|
SwaybgProcess newSwayBgProcess(wallpapers.next(), output);
|
||||||
newSwayBgProcess.exec();
|
newSwayBgProcess.exec();
|
||||||
sleep(1);
|
sleep(1);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue