diff options
| author | Dylan Araps <dylan.araps@gmail.com> | 2017-07-20 23:32:02 +1000 |
|---|---|---|
| committer | Dylan Araps <dylan.araps@gmail.com> | 2017-07-20 23:32:02 +1000 |
| commit | 2973ea06f6a77233bb4fa8d556ab3d2f014e037c (patch) | |
| tree | 02edcd6c8d1e055754730599e906b70fbe1af858 /examples | |
| parent | 52cd5e5f1a7c972a593fe55a853afd43111531e9 (diff) | |
api: Update example.
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/example.py | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/examples/example.py b/examples/example.py index f857b82..faf47b6 100644 --- a/examples/example.py +++ b/examples/example.py @@ -1,29 +1,42 @@ """Test script for wal api.""" +import pathlib import pywal +CACHE_DIR = pathlib.Path.home() / "wal-test" +COLOR_COUNT = 16 + + def main(): """Main function.""" + # Create the custom cache directory. + pywal.util.create_dir(CACHE_DIR / "schemes") + # Validate image and pick a random image if a # directory is given below. - image = pywal.get_image("/home/dylan/Pictures/Wallpapers/") + # + # CACHE_DIR is an optional argument and is used to check the current + # wallpaper against the random selection. This prevents shuffling to + # the identical image when a directory is passed as an argument. + image = pywal.get_image("/home/dylan/Pictures/Wallpapers/", CACHE_DIR) # Return a dict with the palette. - colors = pywal.create_palette(image) + # + # The last argument is 'quiet' mode. When set to true, no notifications + # are displayed. + colors = pywal.create_palette(image, CACHE_DIR, COLOR_COUNT, True) # Apply the palette to all open terminals. # Second argument is a boolean for VTE terminals. # Set it to true if the terminal you're using is # VTE based. (xfce4-terminal, termite, gnome-terminal.) - pywal.send_sequences(colors, False) + pywal.send_sequences(colors, False, CACHE_DIR) # Reload xrdb, i3 and polybar. - pywal.reload_env() + pywal.reload_env(CACHE_DIR) # Export template files. - # pywal.export_all_templates(colors, - # "path/to/templates", - # "path/to/save/files/") + pywal.export_all_templates(colors, CACHE_DIR) # Set the wallpaper. pywal.set_wallpaper(image) |
