CURRENTLY IN DEVELOPMENT, API IS NOT STABLE
menugen
is a bash script which runs menugen scripts (specially formatted bash scripts)
and renders them as a series of interactive menus using
rofi or fzf.
rofi
is a great selector, and some great scripts have already been written
which take advantage of rofi's features to make quick and easy-to-use menus
driven applications.
Some examples include:
menugen
's entire purpose is to make these types of programs easy to create
and maintain.
To start, download menugen to your computer. Next, follow along with a couple of examples which you can find in the repository:
First I'll show you the code, then I'll explain some basics about working with
menugen
.
#!../menugen
#begin main
name="Hello World"
add_item "Here we're adding an item to a menu" 'next' 'echo Running the item'
add_link 'Just a link, will not run an action' 'next'
add_exec 'Just runs an action, will terminate afterwards' 'echo Running the exec'
#end main
#begin next
name="Final menu"
prompt="See ya! > "
add_exec 'All done!' "echo Thanks for playing, come again sometime"
#end next
Save that in a file, maybe helloworld
, chmod 700
it, then run with ./helloworld
.
There's a couple of things to notice right off the bat.
menugen
auto generates "back" menu options, filling in the name of the menu where necessary.menugen
will always start at the main menu