Tree File Menu
This python script creates a lua module that provides a file menu of any directory you want. It also allows you to assign programs to open the files in your menu. The script.
Installing
Copy the script to some convenient file and then edit these lines:
- modify the lines below accordingly
path = '/home/your-user-name/'
filetosave = open('/home/your-user-name/.config/awesome/myplacesmenu.lua', 'w')
replace your-user-name with your user name. Save and run the script. It will create a myplacesmenu.lua file in ~/.config/awesome/. To use your new file menu add:
require("myplacesmenu")
near the top of your ~/.config/awesome/rc.lua file and then add this entry to your menu.
{ "files", myplacesmenu.myplacesmenu()},
Example:
myawesomemenu = {
{ "files", myplacesmenu.myplacesmenu()},
{ "manual", "urxvt -e man awesome" },
{ "edit config", "urxvt -e vim /home/michaelmath/.config/awesome/rc.lua.new" },
{ "restart", awesome.restart },
{ "make default", "/home/michaelmath/scripts/rcmv.sh"},
{"debug", "urxvt -e /home/michaelmath/scripts/Awdebug.sh"},
{ "quit", awesome.quit },
{ "Log out", "/home/michaelmath/scripts/shutdown_dialog.sh"}
}
Whenever the script is run myplacesmenu.lua will be overwritten so calling the script from your .xinitrc file could potentially cause problems as the myplacesmenu.lua might be in the process of being written while awesome is starting.
Lua Version
Here is a lua version of this script. You will need to install luafilesystem for it to work. It doesn't work exactly in the same way since it doesn't store the menu into a file.
Installation
I let you deal with the installation of luafilesystem (luarocks works great). Then you need to download the lua script there, put it wherever you want in your config files. And then you need to require it from your rc.lua, assuming you put it in .config/awesome, you would have to add :
require('filesmenu')
to your rc.lua. Then just add entries in your awesome menu with the directory you want to appear in the file menu like this :
{ 'Documents', genMenu('/home/pata/Documents/')}
And here you go. Be aware that it might slow a bit awesome at start-up, especially with big folders. Also in the script there are some defaults actions to do with the files, feel free to add yours or change the existing in the filters table.