summaryrefslogtreecommitdiff
path: root/examples/example.py
blob: f81d1317a36899ecbb893cbc3889fbabd9260cb3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import pywal


def main():
    """Main function."""
    # Validate image and pick a random image if a
    # directory is given below.
    image = pywal.get_image("/home/dylan/Pictures/Wallpapers/")

    # Return a dict with the palette.
    colors = pywal.create_palette(image)

    # 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)

    # Reload xrdb, i3 and polybar.
    pywal.reload_env()

    # Export template files.
    pywal.export_all_templates(colors,
                               "path/to/templates",
                               "path/to/save/files/")

    # Set the wallpaper.
    pywal.set_wallpaper(image)


main()