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