-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmlvwm.lua
67 lines (47 loc) · 1.18 KB
/
mlvwm.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
--[[
-- MLVWM ***************************************
]]--
function MLVWM_ItemsWrite(S, group)
local conf, name, item
for name,item in pairs(group)
do
if item.type=="group"
then
S:writeln(" \""..item.name.. "\" SubMenu " .. string.gsub(item.name, " ", "_").. "\n")
elseif item.invoke ~= nil
then
S:writeln(" \"".. item.name .. "\" Action Exec \"" ..item.name .. "\" exec " .. item.invoke .. "\n")
end
end
end
function MLVWM_SubmenuWrite(S, group)
local name, item
-- First go through and write out all the submenus
for name,item in pairs(group)
do
if item.type=="group" then MLVWM_SubmenuWrite(S, item) end
end
S:writeln("Menu " .. string.gsub(group.name, " ", "_") .. ", Label \"" .. group.name .. "\"\n")
if group.name=="RootMenu" and #faves_config > 0
then
MLVWM_ItemsWrite(S, faves_config)
S:writeln("\"\" NonSelect\n")
end
MLVWM_ItemsWrite(S, group)
if group.name == "RootMenu"
then
S:writeln("\"\" NonSelect\n")
S:writeln("\"Restart\" Action Restart mlvwm\n")
S:writeln("\"Exit\" Action Exit\n")
end
S:writeln("END\n\n")
end
function MLVWM_MenuWrite(menu, Path)
local i, item, S
S=OpenOutputFile(Path)
if S ~= nil
then
MLVWM_SubmenuWrite(S, menu)
S:close()
end
end