made software app better

This commit is contained in:
2026-01-02 12:02:32 -08:00
parent ac966fba70
commit 709a62ae15
6 changed files with 175 additions and 16 deletions

2
.gitignore vendored
View File

@@ -1 +1,3 @@
.containerizer
/Launcher/build
/Software/build

View File

@@ -4,7 +4,22 @@ local appid = "org.ruffles.launcher"
local project_name = "Launcher"
local package_data = build.optimize(build.package("src"))
build.writePackage(package_data,"build/"..appid)
local meta = {
perms = {
repo = true,
network = true,
app = true,
http = true,
},
author = "Ruffles",
hidden = true,
name = project_name,
appid = appid,
}
build.writeMeta(meta,"build/"..project_name..".meta")
build.merge("build/"..appid,"build/"..project_name..".meta","build/"..project_name..".app")

View File

@@ -1,3 +1,4 @@
error("started")
local basalt = require("globals.basalt")
-- Get the main frame (your window)
@@ -54,7 +55,7 @@ local function mainloop()
local apps = app.getRunningApps()
for i,pid in ipairs(apps) do
local appData,msg = app.getDetail(pid)
if appData then
if appData and not appData.hidden then
processFrame:addLabel({
x=1,
y=i,

View File

@@ -12,9 +12,9 @@ build.writePackage(package_data,"build/"..appid)
local meta = {
perms = {
repo = true,
network = false,
app = true,
http = false,
network = true,
app = false,
http = true,
},
author = "Ruffles",
name = project_name,

View File

@@ -1 +1,131 @@
print("Hello, World!")
local basalt = require("globals.basalt")
local selected_id = nil
local install = nil
local remove = nil
local installed_cache = {} -- id -> bool
local dirty = true -- UI needs refresh
local need_check = nil -- which id to check installed state for
local main = basalt.getMainFrame()
main:setBackground(colors.gray)
local w, h = term.getSize()
local packages = repo.listPackages("apps")
local list = main:addList{
background = colors.black,
foreground = colors.white,
width = w,
height = h - 5,
}
local name_label = main:addLabel{
background = colors.black,
foreground = colors.white,
y = h - 4,
text = "None Selected",
}
local install_button = main:addButton{
background = colors.gray,
foreground = colors.white,
y = h - 3,
text = "",
}
local function populate()
list:clear()
for k, v in pairs(packages) do
list:addItem({ text = v.name, id = k })
end
end
local function update_ui()
if not selected_id then
name_label:setText("None Selected")
install_button:setText("")
install_button:setBackground(colors.gray)
return
end
name_label:setText(packages[selected_id].name)
local is_installed = installed_cache[selected_id]
if is_installed == nil then
-- we haven't checked yet
install_button:setText("Checking...")
install_button:setBackground(colors.lightGray)
return
end
if is_installed then
install_button:setText("Remove")
install_button:setBackground(colors.red)
else
install_button:setText("Install")
install_button:setBackground(colors.green)
end
end
list:onSelect(function(_, _, item)
selected_id = item.id
need_check = selected_id
dirty = true
end)
install_button:onClick(function()
if not selected_id then return end
local is_installed = installed_cache[selected_id]
if is_installed == nil then return end
if is_installed then
remove = selected_id
else
install = selected_id
end
end)
populate()
need_check = selected_id
update_ui()
local function mainloop()
while true do
if need_check then
local id = need_check
need_check = nil
installed_cache[id] = repo.appInstalled(id)
dirty = true
end
if install then
local id = install
install = nil
local app = repo.getPackageData("apps", id)
repo.installApp(app)
installed_cache[id] = true
dirty = true
end
if remove then
local id = remove
remove = nil
repo.uninstallApp(id)
installed_cache[id] = false
dirty = true
end
if dirty then
dirty = false
update_ui()
end
sleep(0.05)
end
end
parallel.waitForAll(function() basalt.run() end, mainloop)

File diff suppressed because one or more lines are too long