-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp_configs.lua
More file actions
54 lines (36 loc) · 1.02 KB
/
app_configs.lua
File metadata and controls
54 lines (36 loc) · 1.02 KB
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
-- this module contains functions related to the menu setup of an application.
-- This includes details like which group an app belongs to, what icon displays with it
-- and how to invoke/run it.
function NewApp(source, name, title, exec)
local app={}
app.type="app"
app.title=title
app.name=string.lower(name)
app.termapp=false
app.ignore=false
app.query=false
app.fileselect=false
app.source=source
app.exec=exec
return app
end
function AppConfigAdd(item)
local existing, name, field, i
local fields={"title", "groups", "icons", "exec", "invoke", "implies", "query:title", "query:filter"}
if item == nil then return end
name=string.lower(item.name)
existing=app_configs[name]
if existing == nil then app_configs[name]=item
else
for i,field in ipairs(fields)
do
if strutil.strlen(item[field]) > 0 then existing[field] = item[field] end
end
if existing.icon == nil then existing.icon=item.icon end
return existing
end
return item
end
function AppConfigFind(name)
return app_configs[string.lower(name)]
end