Skip to content

Instantly share code, notes, and snippets.

@madprops

madprops/rofi.py Secret

Created August 31, 2022 10:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save madprops/44e27f25a2b22562c0a05faf76fccc33 to your computer and use it in GitHub Desktop.
Save madprops/44e27f25a2b22562c0a05faf76fccc33 to your computer and use it in GitHub Desktop.
prompt = rofi_prompt("Alt+1 Delete | Alt+(2-9) Join | Alt+0 Clear")
proc = Popen(f'{prompt} -format i {rofi_style} -selected-row {selected}', stdout=PIPE, stdin=PIPE, shell=True, text=True)
ans = proc.communicate("\n".join(opts))[0].strip()
if ans != "":
code = proc.returncode
index = int(ans)
if code == 10:
delete_item(index)
show_picker(index)
elif code >= 11 and code <= 18:
join_items(code - 9)
elif code == 19:
confirm_delete_items()
else:
select_item(index)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment