add func fot rofi

This commit is contained in:
elwld 2022-08-12 18:54:58 +05:00
parent ff3c194f1d
commit 66c0be6569

View File

@ -3,26 +3,35 @@
from wallpyperFuncs import *
def main():
theme = ""
if len(sys.argv) == 2 and sys.argv[1] in ("help","--help","-h"):
printHelpInfo()
else:
if len(sys.argv) == 1: setTheme()
if len(sys.argv) == 1: theme = None
elif len(sys.argv) == 2 and sys.argv[1] in ("quit", "stop"): killLastSession(); sys.exit(0)
elif len(sys.argv) >= 2 and sys.argv[1] == "set":
if len(sys.argv) == 2:
themes = getThemes()
try:
import dmenu
themes = getThemes()
print(themes)
theme = dmenu.show(themes, prompt='Themes:')
setTheme(theme)
except ModuleNotFoundError:
printHelpInfo()
try:
from rofi import Rofi
r = Rofi()
theme = themes[r.select('Themes:', themes)[0]]
except ModuleNotFoundError:
printHelpInfo()
exit(0)
elif len(sys.argv) == 3:
setTheme(sys.argv[2])
theme = sys.argv[2]
else: printHelpInfo()
else: printHelpInfo()
setTheme(theme)
if __name__ == '__main__':
main()