-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathjwm.lua
78 lines (57 loc) · 1.36 KB
/
jwm.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
--[[
-- JWM ***************************************
]]--
function JWM_ItemsWrite(S, group)
local name, value, icon
for name,item in pairs(group)
do
if item.type=="group"
then
JWM_SubmenuWrite(S, item)
elseif item.invoke ~= nil
then
icon=AppIconFind(item, settings.icon_path)
if icon ~=nil
then
S:writeln(" <Program label=\"".. item.name .. "\" icon=\""..icon.."\">" .. item.invoke .. "</Program>\n")
else
S:writeln(" <Program label=\"".. item.name .. "\">" .. item.invoke .. "</Program>\n")
end
end
end
end
function JWM_SubmenuWrite(S, group)
local conf, name,icon
name,icon=GroupInfoFind(group)
if icon ~= nil
then
S:writeln(" <Menu icon=\""..icon.."\" label=\"" .. name .."\">\n")
else
S:writeln(" <Menu label=\"" .. name .."\">\n")
end
JWM_ItemsWrite(S, group)
S:writeln(" </Menu>\n")
end
function JWM_MenuWrite(menu, Path)
local i, item, S
S=OpenOutputFile(Path)
if S ~= nil
then
S:writeln("<?xml version=\"1.0\"?>\n")
S:writeln("<JWM>\n")
S:writeln("<RootMenu>\n")
if #faves_config > 0
then
JWM_ItemsWrite(S, faves_config)
S:writeln("<Separator/>\n")
end
JWM_ItemsWrite(S, menu)
S:writeln("<Separator/>\n")
S:writeln("<Restart label=\"Restart\" icon=\"restart.png\"/>\n")
S:writeln("<Exit label=\"Exit\" confirm=\"true\" icon=\"quit.png\"/>\n")
S:writeln("</RootMenu>\n")
S:writeln("</JWM>\n")
S:close()
os.execute("jwm -reload")
end
end