university-setup/scripts/rofi-courses.py
2019-09-15 20:42:11 +02:00

22 lines
445 B
Python
Executable file

#!/usr/bin/python3
from rofi import rofi
from courses import Courses
courses = Courses()
current = courses.current
try:
current_index = courses.index(current)
args = ['-a', current_index]
except ValueError:
args = []
code, index, selected = rofi('Select course', [c.info['title'] for c in courses], [
'-auto-select',
'-no-custom',
'-lines', len(courses)
] + args)
if index >= 0:
courses.current = courses[index]