-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfvwm.lua
92 lines (62 loc) · 1.56 KB
/
fvwm.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
--[[
-- FVWM ***************************************
]]--
function FVWM_ItemsWrite(S, group)
local name, value, icon, str
for name,item in pairs(group)
do
if item.invoke ~= nil
then
str="+ \"" .. string.gsub(item.name, " ", "&");
icon=AppIconFind(item, settings.icon_path)
-- if icon ~=nil then str=str.."%"..icon.."%" end
str=str.."\" Exec "..item.invoke
S:writeln(str .. "\n")
end
end
for name,item in pairs(group)
do
if item.type=="group"
then
FVWM_SubmenuWrite(S, item)
end
end
end
function FVWM_MenuOutput(S, name, icon, items, top_items)
local item, subname
str="\nDestroyMenu " .. string.gsub(name, " ", "_") .. "\n"
str=str .."AddToMenu " .. string.gsub(name, " ", "_") .. " \"" .. name .."\" Title\n"
S:writeln(str)
if top_items ~= nil
then
FVWM_ItemsWrite(S, top_items)
if #top_items > 0 then S:writeln("+ \"\" Nop\n") end
end
for i,item in ipairs(items)
do
if item.type=="group" then
subname=GroupInfoFind(item)
S:writeln("+ \""..item.name.."\" Popup " .. string.gsub(subname, " ", "_") .. "\n")
end
end
end
function FVWM_SubmenuWrite(S, group)
local name,icon
name,icon=GroupInfoFind(group)
FVWM_MenuOutput(S, name, icon, group)
FVWM_ItemsWrite(S, group)
end
function FVWM_MenuWrite(menu, Path)
local i, item, S
S=OpenOutputFile(Path)
if S ~= nil
then
FVWM_MenuOutput(S, "MenuFvwmRoot", "", menu, faves_config)
S:writeln("+ \"\" Nop\n")
S:writeln("+ \"Refresh\" Refresh\n")
S:writeln("+ \"Restart\" Restart\n")
S:writeln("+ \"Quit\" Module FvwmScript FvwmScript-ConfirmQuit\n")
FVWM_ItemsWrite(S, menu)
S:close()
end
end