wallswitch
#-----------#-----------# ... ... #-----------#
| | | | |
| Monitor 1 | Monitor 2 | | Monitor n |
| | | | |
#-----------#-----------# ... ... #-----------#
Randomly sets wallpapers for n Linux desktop monitors (arranged horizontally).
[Define papéis de parede aleatoriamente para desktop Linux com n monitores (dispostos horizontalmente).]
Description:
wallswitch randomly selects and applies different wallpapers to each of n monitors arranged horizontally.
Features:
-
Random Wallpaper Selection: Dynamically chooses distinct wallpapers from designated directories for each monitor, ensuring no duplicates appear across screens.
-
Configurable Filtering:
- Dimension Control: Refine your wallpaper choices by setting minimum and maximum dimensions (height and width) to include only images within a specific size range.
- File Size Management: Specify minimum and maximum file sizes for searching, allowing you to exclude very large or small images.
-
Flexible Configuration: Tailor wallswitch to your needs with options for:
- Directory Specification: Define custom directories containing your wallpaper images using the
dirsoption. - Image File Types: Select specific image extensions to consider (e.g., JPG, PNG, SVG) through the
extensionsoption. - Resolution Matching: Optimize display by matching wallpapers to monitor resolutions defined in the
resolutionsarray.
- Directory Specification: Define custom directories containing your wallpaper images using the
-
Wallpaper Cycling Interval: Set the time interval between wallpaper changes using the
intervaloption. -
Image Sorting: Optionally sort selected images based on filename using the
sortoption.
Usage:
Run the command:
The default number of monitors is set to n = 2.
Wallpapers will be searched recursively within the specified directories ("dirs": [...]) for files with extensions ["avif", "jpg", "jpeg", "png", "svg", "tif", "webp"].
Configuration
The configuration file, located at ~/.config/wallswitch/wallswitch.json, is key to customizing wallswitch behavior:
- Displaying the Configuration:
- Direct Display:
- Parsing with jq:
|
- Direct Display:
The default configuration file has the following structure:
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 and maximum 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.
Two wallpapers per monitor (Gnome)
If you have two monitors and want to display two wallpapers on each monitor, modify your ~/.config/wallswitch/wallswitch.json file as follows:
"monitor": 2 --> 4
"width": 3840 --> 1920
Explanation:
-
monitor: 4: Simulate 4 monitors. -
resolutionsArray: Each object within this array defines a resolution for one of your monitors.- In this example, we've defined four resolutions with the width set to
1920and height to2160.
This effectively tells wallswitch to assign two different wallpapers per monitor, ensuring that each screen has distinct backgrounds.
- In this example, we've defined four resolutions with the width set to
Wallpaper suggestions
- Get all gnome backgrounds.
Dowload wallpapers with:
git clone https://github.com/zebreus/all-gnome-backgrounds.git
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, --min_dimension <MIN_DIMENSION>
Set the minimum dimension that the height and width must satisfy
-D, --max_dimension <MAX_DIMENSION>
Set the maximum dimension that the height and width must satisfy
-b, --min_size <MIN_SIZE>
Set a minimum file size (in bytes) for searching image files
-B, --max_size <MAX_SIZE>
Set a maximum file size (in bytes) for searching image files
-i, --interval <INTERVAL>
Set the interval (in seconds) between each wallpaper displayed
-n, --monitor <MONITOR>
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
min_dimension is the minimum value obtained from the width and height of an image file:
min_dimension = min(width, height).
max_dimension is the maximum value obtained from the width and height of an image file:
max_dimension = max(width, height).
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=.
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 (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 (image viewing/manipulation program).
-
feh (fast and light image viewer).