-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
icon search now case-insensitive, split code up into multiple files, …
…added makefile and 'make install'
- Loading branch information
1 parent
0e804f6
commit 9941fa9
Showing
25 changed files
with
3,283 additions
and
668 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
PREFIX=/usr/local | ||
|
||
menubuilder.lua: includes.lua globals.lua command_line.lua config_file.lua desktop_files.lua icons.lua dialogs.lua blackbox.lua fvwm.lua icewm.lua jwm.lua mlvwm.lua openbox.lua pekwm.lua pwm.lua twm.lua xmenu.lua ctrlmenu.lua main.lua | ||
cat includes.lua globals.lua command_line.lua config_file.lua desktop_files.lua icons.lua dialogs.lua blackbox.lua fvwm.lua icewm.lua jwm.lua mlvwm.lua openbox.lua pekwm.lua pwm.lua twm.lua xmenu.lua main.lua > menubuilder.lua | ||
chmod a+x menubuilder.lua | ||
|
||
clean: | ||
rm menubuilder.lua | ||
|
||
install: | ||
mkdir -p ~/bin | ||
cp menubuilder.lua ~/bin | ||
mkdir -p ~/.config/menubuilder/ | ||
cp menubuilder.conf ~/.config/menubuilder/ | ||
|
||
global-install: | ||
mkdir -p $(PREFIX)/bin | ||
cp menubuilder.lua $(PREFIX)/bin | ||
mkdir -p $(PREFIX)/share/man/man1 | ||
cp menubuilder.1 $(PREFIX)/share/man/man1 | ||
mkdir -p /etc/ | ||
cp menubuilder.conf /etc/menubuilder/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
|
||
--[[ | ||
-- BLACKBOX/FLUXBOX/HACKEDBOX *************************************** | ||
]]-- | ||
|
||
|
||
function Blackbox_ItemWrite(S, item) | ||
local invoke | ||
|
||
if item.type=="group" | ||
then | ||
Blackbox_SubmenuWrite(S, item.name, item) | ||
elseif item.invoke ~= nil | ||
then | ||
-- blackbox dequotes these when running them | ||
invoke=string.gsub(item.invoke, "\\", "\\\\") | ||
|
||
--if there's arguments then it's likely that some form of shell replacement (e.g. '*') or shell variables are | ||
--being used, so we run this command under a shell | ||
if string.find(invoke, ' ') ~= nil | ||
then | ||
S:writeln("[exec] (" .. item.name.. ") {/bin/sh -c \"" .. invoke.."\"}\n") | ||
else | ||
S:writeln("[exec] (" .. item.name.. ") {" .. invoke.."}\n") | ||
end | ||
end | ||
end | ||
|
||
|
||
function Blackbox_ItemsWrite(S, items) | ||
local name, item | ||
|
||
for name,item in pairs(items) | ||
do | ||
Blackbox_ItemWrite(S, item) | ||
end | ||
end | ||
|
||
|
||
function Blackbox_SubmenuWrite(S, title, group) | ||
|
||
S:writeln("[submenu] ("..title..")\n") | ||
Blackbox_ItemsWrite(S, group) | ||
S:writeln("[end]\n") | ||
|
||
end | ||
|
||
function Blackbox_MenuWrite(menu, Path) | ||
local i, item, S | ||
|
||
S=OpenOutputFile(Path) | ||
if S ~= nil | ||
then | ||
S:writeln("[begin] (Root Menu)\n") | ||
if #faves_config > 0 | ||
then | ||
Blackbox_ItemsWrite(S, faves_config) | ||
S:writeln("[nop]\n") | ||
end | ||
|
||
|
||
Blackbox_ItemsWrite(S, menu) | ||
|
||
S:writeln("[nop]\n") | ||
S:writeln("[workspaces] (workspace menu)\n") | ||
S:writeln("[config] (blackbox config)\n") | ||
S:writeln("[reconfig] (Reconfigure)\n") | ||
S:writeln("[restart] (Restart)\n") | ||
S:writeln("[exit] (Exit)\n") | ||
S:writeln("[end]\n") | ||
|
||
S:close() | ||
end | ||
|
||
end | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
function DisplayHelp() | ||
|
||
print("usage:") | ||
print("") | ||
print(" lua menubuilder.lua [options] [window manager] [window manager] ...") | ||
print("") | ||
|
||
print("options:") | ||
print("") | ||
|
||
print(" -c path to config file, if not supplied then '~/.config/menubuilder/*.conf' will be tried, followed by, '~/.config/menubuilder.conf', and '~/.menubuilder.conf/etc/menubuilder.conf'") | ||
print(" -faves [items] a list of program names to include above everthing else on the top menu") | ||
print(" -icons [path] add a colon-separated list of paths under which to search for icons") | ||
print(" -no-icons do not find icons for the menu") | ||
print(" -t [app] terminal app to use for terminal programs, defaults to 'xterm'") | ||
print(" -term [app] terminal app to use for terminal programs, defaults to 'xterm'") | ||
print(" -dialogs [app] dialog app to use for programs that need additional info. Choices are 'xdialog', 'zenity' or 'qarma'. Defaults to 'no dialogs'. If no dialog app is set then entries for apps requring dialogs will not be added to the menu.") | ||
print(" -misc [size] Merge any top-level menus that contain less than <size> items into a single 'miscellaneous' top-level group.") | ||
print(" -submenu [size] For any groups that are not top-level and which contain less than <size> items, show the items in the parent group, rather than in a submenu.") | ||
|
||
print("") | ||
|
||
print("supported window managers:") | ||
print("Multiple 'window manager' arguments can be supplied and can contain the following values:") | ||
print("") | ||
print(" all this will write out menu files for all supported window managers") | ||
print(" blackbox write to file ~/.blackbox/menu") | ||
print(" fluxbox write to file ~/.fluxbox/menu") | ||
print(" openbox write to file ~/.config/openbox/menu.xml") | ||
print(" icewm write to file ~/.icewm/menu") | ||
print(" pekwm write to file ~/.pekwm/menu") | ||
print(" mlvwm write to file ~/.menu.mlvwm") | ||
print(" pwm write to file ~/.pwm/rootmenu.conf") | ||
print(" jwm write to file ~/.menu.jwm") | ||
print(" twm write to file ~/.menu.twm") | ||
print(" ctwm write to file ~/.menu.ctwm") | ||
print(" vtwm write to file ~/.menu.vtwm") | ||
print(" moonwm write to file ~/.config/moonwm/favorites") | ||
print(" xmenu write to file ~/.menu.xmenu") | ||
print(" ctrlmenu write to file ~/.menu.ctrlmenu") | ||
print(" ") | ||
print(" stdout:blackbox write blackbox menu to stdout") | ||
print(" stdout:fluxbox write fluxbox menu to stdout") | ||
print(" stdout:openbox write fluxbox menu to stdout") | ||
print(" stdout:icewm write icewm menu to stdout") | ||
print(" stdout:pekwm write pekwm menu to stdout") | ||
print(" stdout:mlvwm write mlvwm menu to stdout") | ||
print(" stdout:pwm write pwm menu to stdout") | ||
print(" stdout:jwm write jwm menu to stdout") | ||
print(" stdout:twm write twm menu to stdout") | ||
print(" stdout:ctwm write ctwm menu to stdout") | ||
print(" stdout:vtwm write vtwm menu to stdout") | ||
print(" stdout:moonwm write moonwm menu to stdout") | ||
print(" stdout:xmenu write xmenu menu to stdout") | ||
print(" stdout:ctrlmenu write ctrlmenu menu to stdout") | ||
print("") | ||
|
||
print("example:") | ||
print("") | ||
print(" MenuBuilder.lua -faves xterm,links,smplayer jwm icewm") | ||
|
||
|
||
end | ||
|
||
|
||
|
||
function ParseCommandLine(args) | ||
for i,arg in ipairs(args) | ||
do | ||
|
||
if arg == "-c" | ||
then | ||
settings.config=args[i+1] | ||
args[i+1]="" | ||
elseif arg == "-faves" | ||
then | ||
settings.faves=args[i+1] | ||
args[i+1]="" | ||
elseif arg == "-icons" | ||
then | ||
settings.icon_path=settings.icon_path .. args[i+1] .. ":" | ||
args[i+1]="" | ||
elseif arg == "-no-icons" | ||
then | ||
settings.find_icons=false | ||
elseif arg == "-s" or arg == "-submenu" | ||
then | ||
settings.submenu_size=tonumber(args[i+1]) | ||
if settings.submenu_size==nil then settings.submenu_size=0 end | ||
args[i+1]="" | ||
elseif arg == "-m" or arg == "-misc" | ||
then | ||
settings.misc_group=tonumber(args[i+1]) | ||
if settings.misc_group==nil then settings.misc_group=0 end | ||
args[i+1]="" | ||
elseif arg== "-dialogs" | ||
then | ||
DialogApp(args[i+1]) | ||
args[i+1]="" | ||
elseif arg=="-t" or arg=="-term" | ||
then | ||
settings.term=args[i+1] | ||
args[i+1]="" | ||
elseif arg=="-?" or arg=="-h" or arg=="-help" or arg=="--help" | ||
then | ||
DisplayHelp() | ||
os.exit(0) | ||
elseif arg=="all" then settings.output="jwm,twm,vtwm,ctwm,pwm,icewm,pekwm,mlvwm,blackbox,fluxbox,openbox,moonwm,xmenu,ctrlmenu" | ||
else settings.output=settings.output .. args[i].."," | ||
end | ||
|
||
end | ||
|
||
end | ||
|
||
|
||
|
||
|
Oops, something went wrong.