dynamic-wallpaper
dynamic-wallpaper copied to clipboard
remake/port for python using argparse
I remade this in python but now i don't know what to do with it lol. anyway here ya go:
import subprocess
import os
import sys
import argparse
BANNER = """
╺┳┓╻ ╻┏┓╻┏━┓┏┳┓╻┏━╸ ╻ ╻┏━┓╻ ╻ ┏━┓┏━┓┏━┓┏━╸┏━┓
┃┃┗┳┛┃┗┫┣━┫┃┃┃┃┃ ┃╻┃┣━┫┃ ┃ ┣━┛┣━┫┣━┛┣╸ ┣┳┛
╺┻┛ ╹ ╹ ╹╹ ╹╹ ╹╹┗━╸ ┗┻┛╹ ╹┗━╸┗━╸╹ ╹ ╹╹ ┗━╸╹┗╸
"""
THEMES = [
"aurora",
"beach",
"bitday",
"chihuahuan",
"cliffs",
"colony",
"desert",
"earth",
"exodus",
"factory",
"firewatch",
"forest",
"gradient",
"home",
"island",
"lake",
"lakeside",
"market",
"mojave",
"moon",
"mountains",
"room",
"sahara",
"street",
"tokyo",
]
__program__ = "dmenu"
__authors__ = ["https://github.com/adi1090x/dynamic-wallpaper/graphs/contributors"]
__version__ = 3.0
DEFAULT_THEME = "tokyo"
EXEC_PATH = "/home/joshua/.local/bin/pipes.sh"
HOME = os.getenv("$HOME")
if not os.path.exists(EXEC_PATH):
raise FileNotFoundError("pipes.sh is not in the local path")
parser = argparse.ArgumentParser(
prog=__program__,
# description=BANNER,
#epilog="".join([i + " " for i in __authors__]),
)
parser.add_argument(
"--list-styles",
help="List available styles",
action="store_true",
dest="list",
)
parser.add_argument(
"-p",
"--pywal",
action="store_true",
help="Use pywal to set wallpaper",
dest="pywal",
)
parser.add_argument(
"-s",
nargs=1,
type=str,
dest="style",
help="Name of the style to apply",
)
args = parser.parse_args()
if args.list:
print(f"Available styles: {' '.join(THEMES)}")
sys.exit()
if args.pywal == False and args.style == None:
parser.print_help()
print("""\n\nExamples:
dwall -s beach Set wallpaper from 'beach' style
dwall -p -s sahara Set wallpaper from 'sahara' style using pywal
""")
sys.exit()
theme = args.style[0] if args.style else DEFAULT_THEME
stdargs = [EXEC_PATH, "-p" if args.pywal else "", theme]
subprocess.run(
" ".join(stdargs),
cwd=HOME,
shell=True,
stderr=subprocess.STDOUT,
)