# wallswitch
```
#-----------#-----------# ... ... #-----------#
| | | | |
#-----------#-----------# ... ... #-----------#
```
Randomly sets wallpapers for `n` Linux desktop monitors (arranged horizontally).
[Define papéis de parede aleatoriamente para desktop Linux com `n` monitores (dispostos horizontalmente).]
`wallswitch` randomly selects and applies different wallpapers to each of n monitors arranged horizontally.
Run the command:
```
wallswitch
```
The default number of monitors is `n` = 2.
Images are recursively searched in the indicated directories (`"dirs": [...]`) for files with extensions ["jpg", "jpeg", "png", "svg", "tif", "webp"].
## Help messages
To get help messages, run the command:
```
wallswitch -h
```
The output:
```
randomly sets wallpapers for n Linux desktop monitors (arranged horizontally).
Usage: wallswitch [OPTIONS]
Options:
-c, --config
Read the configuration file and exit the program
-d, --dimension <DIMENSION>
Set the minimum dimension that the height and width must satisfy
-i, --interval <INTERVAL>
Set the interval (in seconds) between each wallpaper displayed
-n, --monitor_number <MONITOR_NUMBER>
Set the number of monitors [default: 2]
-s, --sort
Sort the images found
-v, --verbose
Show intermediate runtime messages
-h, --help
Print help (see more with '--help')
-V, --version
Print version
```
## Configuration
**Displaying the Configuration**
You can view the contents of the wallswitch configuration file using these commands:
* Displays the configuration directly:
```
wallswitch -c
```
* Parses the `json` configuration using the [jq](https://jqlang.github.io/jq/) command-line tool (requires `jq` to be installed):
```
cat ~/.config/wallswitch/wallswitch.json | jq
```
The default configuration file (`~/.config/wallswitch/wallswitch.json`) has the following structure:
```json
{
"desktop": "gnome-xorg",
"dimension": 800,
"dirs": [
"/home/user_name/Figures",
"/home/user_name/Images",
"/home/user_name/Pictures",
"/home/user_name/Wallpapers",
"/home/user_name/Imagens",
"/usr/share/wallpapers",
"/usr/share/backgrounds",
"/tmp/teste"
],
"extensions": [
"jpg",
"jpeg",
"png",
"svg",
"tif",
"webp"
],
"interval": 1800,
"wallpaper": "/home/user_name/wallswitch.jpg"
}
```
**Editing the Configuration**
To customize wallswitch behavior, edit the configuration file directly:
* **Directory paths:** Modify the "dirs" array to include locations containing your desired image files. Remember to adjust the path according to your user name.
* **Dimensions:** Choose the minimum width and height dimensions.
* **Extensions:** Modify the “extensions” array to select the image file extensions.
* **Interval:** Change the "interval" value (in seconds) to control how often wallpapers are cycled.
**Important Note:** Ensure that all directories listed in "dirs" have read permissions for the user running wallswitch.
## Desktops
Make changes to the source code.
```
git clone https://github.com/claudiofsr/wallswitch.git
cd wallswitch
```
Edit the file: 'src/desktops.rs'.
To build and install from source, run the following command:
```
cargo b -r && cargo install --path=.
```
Options:
### gnome
Create a wallpaper file and set it as your desktop background image.
See the function:
```
fn set_gnome_wallpaper()
```
### xfce
See the function:
```
fn set_xfce_wallpaper()
```
Monitor 1: "/backdrop/screen0/monitorDP-0/workspace0/last-image"
Monitor 2: "/backdrop/screen0/monitorDP-2/workspace0/last-image"
Monitor N: ...
### openbox
See the function:
```
fn set_openbox_wallpaper()
```
## Mutually exclusive features
To use the [clap](https://crates.io/crates/clap) (default):
```
cargo b -r && cargo install --path=. --features args_v1
```
To reduce binary size, alternatively use my Command Line Argument Parser (args_v2.rs):
```
cargo b -r && cargo install --path=. --features args_v2
```
## Dependencies
* [imagemagick](https://imagemagick.org/) (image viewing/manipulation program).
* [feh](https://feh.finalrewind.org/) (fast and light image viewer).