WallPyPer/src/wallpyper.py

38 lines
1.1 KiB
Python
Raw Normal View History

2022-08-06 10:35:10 +00:00
#!/usr/bin/python3
from wallpyperFuncs import *
def main():
2022-08-12 13:54:58 +00:00
theme = ""
2022-08-06 10:35:10 +00:00
if len(sys.argv) == 2 and sys.argv[1] in ("help","--help","-h"):
printHelpInfo()
else:
2022-08-12 13:54:58 +00:00
if len(sys.argv) == 1: theme = None
2022-08-06 10:35:10 +00:00
elif len(sys.argv) == 2 and sys.argv[1] in ("quit", "stop"): killLastSession(); sys.exit(0)
2022-08-12 13:30:54 +00:00
elif len(sys.argv) >= 2 and sys.argv[1] == "set":
if len(sys.argv) == 2:
2022-08-12 13:54:58 +00:00
themes = getThemes()
2022-08-12 13:30:54 +00:00
try:
import dmenu
theme = dmenu.show(themes, prompt='Themes:')
except ModuleNotFoundError:
2022-08-12 13:54:58 +00:00
try:
from rofi import Rofi
r = Rofi()
theme = themes[r.select('Themes:', themes)[0]]
except ModuleNotFoundError:
printHelpInfo()
exit(0)
2022-08-12 13:30:54 +00:00
elif len(sys.argv) == 3:
2022-08-12 13:54:58 +00:00
theme = sys.argv[2]
2022-08-12 13:30:54 +00:00
else: printHelpInfo()
2022-08-06 10:35:10 +00:00
else: printHelpInfo()
2022-08-12 13:54:58 +00:00
setTheme(theme)
2022-08-06 10:35:10 +00:00
if __name__ == '__main__':
main()