Update appList.lua

This commit is contained in:
Ale32bit 2016-11-17 16:00:03 +01:00 committed by GitHub
parent 5332352174
commit 62f902044a

View file

@ -1,52 +1,27 @@
local spkList = "/.sPhone/config/spklist"
local dir = "/.sPhone/apps/spk/"
local apps = {}
local ind = {}
if not fs.exists(spkList) then
config.list("/.sPhone/config/spklist")
end
local apps = {}
for k,v in pairs(config.list(spkList)) do
for k,v in pairs(config.list(spkList)) do
table.insert(apps,{
id = k,
name = v,
})
end
for k,v in ipairs(apps) do
end
for k,v in ipairs(apps) do
local hid = config.read(dir..v.id.."/.spk","hidden")
if hid then
table.remove(apps,k)
end
end
local function drawHome()
term.setBackgroundColor(sPhone.theme["backgroundColor"])
term.clear()
term.setTextColor(sPhone.theme["text"])
sPhone.header("Apps","X")
term.setBackgroundColor(sPhone.theme["backgroundColor"])
term.setTextColor(sPhone.theme["text"])
term.setCursorPos(1,3)
for k, v in pairs(apps) do
print(v.name)
end
end
drawHome()
local w, h = term.getSize()
while true do
drawHome()
local _,_,x,y = os.pullEvent("mouse_click")
if x == w and y == 1 then
break
elseif y >= 2 then
if apps[y-2] then
sPhone.launch(apps[y-2].id)
return
end
end
end
end
for k,v in ipairs(apps) do
ind[ v.id ] = v.name
end
sPhone.launch(sPhone.list(nil,{
list = ind,
pairs = true,
title = " Apps"
}))