-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathxmenu.lua
73 lines (51 loc) · 1.2 KB
/
xmenu.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
66
67
68
69
70
71
72
--[[
-- X Menu ***************************************
]]--
function XMenu_FormatItem(item, depth)
local i, icon
local str=""
for i=1,depth,1 do str=str.." " end
icon=AppIconFind(item, settings.icon_path)
if icon ~= nil then str=str .. "IMG:" .. icon .. " " end
str=str .. item.name
return str
end
function XMenu_ItemsWrite(S, group, depth)
local name, item, str
for name,item in pairs(group)
do
if item.name ~= nil and item.type ~= "group"
then
str=XMenu_FormatItem(item, depth)
if item.invoke ~= nil then str=str .. " " .. item.invoke end
S:writeln(str .."\n")
end
end
end
function XMenu_SubmenuWrite(S, group, depth)
local name, item
if group.name ~= "RootMenu"
then
str=XMenu_FormatItem(group, depth)
S:writeln(str .. '\n')
end
-- First go through and write out all the submenus
for name,item in pairs(group)
do
if item.type=="group" then XMenu_SubmenuWrite(S, item, depth + 1) end
end
XMenu_ItemsWrite(S, group, depth + 1)
end
function XMenu_MenuWrite(menu, Path)
local S
S=OpenOutputFile(Path)
if S ~= nil
then
if #faves_config > 0 then XMenu_ItemsWrite(S, faves_config, -1) end
XMenu_SubmenuWrite(S, menu, -1)
S:close()
end
end
--[[
-- X Menu ***************************************
]]--