From 6678fa7953fde67d7371a28f6ddfe5b1aae03cdc Mon Sep 17 00:00:00 2001 From: dylan araps Date: Thu, 20 Jul 2017 10:44:21 +1000 Subject: [PATCH] general: Add example script. --- examples/example.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 examples/example.py diff --git a/examples/example.py b/examples/example.py new file mode 100644 index 0000000..9f7bf57 --- /dev/null +++ b/examples/example.py @@ -0,0 +1,22 @@ +"""pywal api example.""" +import pywal + + +def main(): + """Main function.""" + image = "/home/dylan/Pictures/Wallpapers/anVmEaA.jpg" + + # 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() + + # Set the wallpaper. + pywal.set_wallpaper(image)