1
0
mirror of https://github.com/20kdc/OC-KittenOS.git synced 2024-11-27 04:48:05 +11:00

Fix the launcher for high amounts of applications

This commit is contained in:
20kdc 2018-03-29 21:35:04 +01:00
parent 332cdd2fc6
commit 902ff12d22

View File

@ -11,14 +11,17 @@ local running = true
local buttons = {} local buttons = {}
local xlen = 0 local xlen = 0
local xlb = 1
local yp = 1
local appNames = neo.listApps() local appNames = neo.listApps()
for k, v in ipairs(appNames) do for k, v in ipairs(appNames) do
if v:sub(1, 4) == "app-" then if v:sub(1, 4) == "app-" then
local vl = unicode.len(v) local vs = unicode.safeTextFormat(v)
local vl = unicode.len(vs) + xlb + 1
if xlen < vl then if xlen < vl then
xlen = vl xlen = vl
end end
table.insert(buttons, neoux.tcbutton(1, #buttons + 1, v, function (w) table.insert(buttons, neoux.tcbutton(xlb, yp, vs, function (w)
-- Button pressed. -- Button pressed.
local pid, err = neo.executeAsync(v) local pid, err = neo.executeAsync(v)
if not pid then if not pid then
@ -28,10 +31,15 @@ for k, v in ipairs(appNames) do
running = false running = false
end end
end)) end))
yp = yp + 1
if yp == 16 then
yp = 1
xlb = xlen + 1
end
end end
end end
neoux.create(xlen + 2, #buttons, nil, neoux.tcwindow(xlen + 2, #buttons, buttons, function (w) neoux.create(xlen, math.min(15, #buttons), nil, neoux.tcwindow(xlen, math.min(15, #buttons), buttons, function (w)
w.close() w.close()
running = false running = false
end, 0xFFFFFF, 0)) end, 0xFFFFFF, 0))