-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathicewm.lua
70 lines (52 loc) · 1.27 KB
/
icewm.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
--[[
-- ICEWM ***************************************
]]--
function IceWM_ItemWrite(S, icon, item)
local toks, str, exec
if item.invoke ~=nil
then
toks=strutil.TOKENIZER(item.invoke, " ")
str=toks:next()
-- first token appears to be an environment variable setter, run this
-- in a shell
if string.find(str, "=") ~= nil
then
S:writeln("prog \"" .. item.name .. "\" \"" .. icon .. "\" /bin/sh -c \"" .. item.invoke.."\"\n")
else
S:writeln("prog \"" .. item.name .. "\" \"" .. icon .. "\" " .. item.invoke.."\n")
end
end
end
function IceWM_SubmenuWrite(S, group)
local name, value, icon
for name,item in pairs(group)
do
if item.type=="group"
then
name,icon=GroupInfoFind(item)
if icon==nil then icon="" end
S:writeln("menu \"" .. name .. "\" \"".. icon .. "\" {\n")
IceWM_SubmenuWrite(S, item)
S:writeln("}\n\n")
else
icon=AppIconFind(item, settings.icon_path)
if strutil.strlen(icon) == 0 then icon=item.name end
IceWM_ItemWrite(S, icon, item)
end
end
end
function IceWM_MenuWrite(menu, Path)
local i, name, item, icon, S
S=OpenOutputFile(Path)
if S ~= nil
then
if #faves_config > 0
then
IceWM_SubmenuWrite(S, faves_config)
S:writeln("separator\n")
end
IceWM_SubmenuWrite(S, menu)
S:close()
os.execute("icewm --restart")
end
end