From afb7277310eadfcc8017c2061dd9a63bcb4b80b0 Mon Sep 17 00:00:00 2001 From: Izaya Date: Sun, 22 Apr 2018 01:15:59 +1000 Subject: [PATCH 1/7] added launcherbar to the repo --- repository/apps/app-launchbar.lua | 135 ++++++++++++++++++++++++++++++ 1 file changed, 135 insertions(+) create mode 100644 repository/apps/app-launchbar.lua diff --git a/repository/apps/app-launchbar.lua b/repository/apps/app-launchbar.lua new file mode 100644 index 0000000..8bc34e2 --- /dev/null +++ b/repository/apps/app-launchbar.lua @@ -0,0 +1,135 @@ +local event = require("event")(neo) +local neoux, err = require("neoux") +if not neoux then error(err) end +neoux = neoux(event, neo) + +local running = true +local window + +local pinned = {} +-- load pinned applications +local icecap = neo.requireAccess("x.neo.pub.base", "load pinned applications") +local w,f = pcall(icecap.open,"/pinned", false) + +if w and f then + neo.emergency(f) + local fcontent = f.read("*a") + for s in fcontent:gmatch("[^\n]+") do + for k,v in ipairs(neo.listApps()) do + if v == s then + pinned[#pinned+1] = s + end + end + end + f.close() +else + pinned = {"app-control","app-taskmgr"} +end + +local function savePinned() -- saves pinned applications + local f=icecap.open("/pinned",true) + if f then + for k,v in pairs(pinned) do + f.write(v.."\n") + end + f.close() + end +end + +local function isPinned(name) + local bpinned = false + for l,m in ipairs(pinned) do + if m == name then bpinned = l end + end + return bpinned +end + +local function genAppMenu(autoclose) + local wwidth, wheight, wcontent = 1, 1, {} + local applist = neo.listApps() + for _,app in ipairs(applist) do + if app:sub(1,4) == "app-" then + local appname = app:sub(5) + if appname:len()+2 > wwidth then + wwidth = appname:len()+2 + end + table.insert(wcontent,neoux.tcbutton(1, wheight, appname, function (w) + local pid, err = neo.executeAsync(app) + if not pid then + neoux.startDialog(tostring(err), "launchErr") + else + if autoclose then + w.close() + end + end + end)) + wheight = wheight + 1 + end + end + local cy = 1 + for _, app in ipairs(applist) do + if app:sub(1,4) == "app-" then + local appname = app:sub(5) + local pinicon = unicode.char(9633) + if isPinned(app) then + pinicon = unicode.char(9632) + end + table.insert(wcontent, neoux.tcbutton(wwidth+1, cy, pinicon, function(w) + local bpinned = isPinned(app) + if not bpinned then + table.insert(pinned,app) + else + table.remove(pinned,bpinned) + end + local wc, mx = genLaunchBar() + window.reset(mx, 1, nil, wc) + local fwwidth, fwheight, fbuttons = genAppMenu() + w.reset(fwwidth+3, fwheight, "apps", neoux.tcwindow(fwwidth+3, fwheight, fbuttons, function (w) + w.close() + end, 0xFFFFFF, 0)) + savePinned() + end)) + cy = cy + 1 + end + end + return wwidth, wheight, wcontent +end + +local function appMenu(autoclose) + local wwidth, wheight, buttons = genAppMenu(autoclose) + neo.emergency(wwidth,wheight,buttons) + neoux.create(wwidth+3, wheight, "apps", neoux.tcwindow(wwidth+3, wheight, buttons, function (w) + w.close() + end, 0xFFFFFF, 0)) +end + +function genLaunchBar() + local buttons = {} + local mx = 1 + table.insert(buttons,neoux.tcbutton(mx, 1, "disks", function(w) + neo.executeAsync("app-fm") + end)) + mx = mx + 7 + table.insert(buttons,neoux.tcbutton(mx, 1, "apps", function(w) + appMenu() + end)) + mx = mx + 6 + for k,v in pairs(pinned) do + local dstr = v:sub(5) + table.insert(buttons,neoux.tcbutton(mx,1,dstr,function(w) + neo.executeAsync(v) + end)) + mx = mx + dstr:len() + 2 + end + return neoux.tcwindow(mx, 1, buttons, function(w) + w.close() + running = false + end, 0xFFFFFF, 0), mx +end + +local wc, mx = genLaunchBar() +window = neoux.create(mx, 1, nil, wc) + +while running do + event.pull() +end From c76bf62a53b4ad2ef87cb385d16581e6b7ae05d6 Mon Sep 17 00:00:00 2001 From: Izaya Date: Sun, 22 Apr 2018 01:18:39 +1000 Subject: [PATCH 2/7] added launchbar to the repo listing --- repository/data/app-claw/local.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/repository/data/app-claw/local.lua b/repository/data/app-claw/local.lua index 0e757e0..e460268 100644 --- a/repository/data/app-claw/local.lua +++ b/repository/data/app-claw/local.lua @@ -22,6 +22,19 @@ return { "docs/repoauthors/app-eeprog" }, }, + ["app-launchbar"] = { + desc = "Application launcher bar", + v = 0, + deps = { + "neo" + }, + dirs = { + "apps" + }, + files = { + "apps/app-launchbar.lua" + }, + }, ["neo-docs"] = { desc = "KittenOS NEO system documentation", v = 2, From 233eb9be7ece3d13a9f880da7ebd0bc81ff50d98 Mon Sep 17 00:00:00 2001 From: Izaya Date: Mon, 23 Apr 2018 02:47:36 +1000 Subject: [PATCH 3/7] app-slaunch, for all your xfce-appfinder-clone needs --- repository/apps/app-slaunch.lua | 69 ++++++++++++++++++++++++++++++ repository/data/app-claw/local.lua | 13 ++++++ 2 files changed, 82 insertions(+) create mode 100644 repository/apps/app-slaunch.lua diff --git a/repository/apps/app-slaunch.lua b/repository/apps/app-slaunch.lua new file mode 100644 index 0000000..5776f23 --- /dev/null +++ b/repository/apps/app-slaunch.lua @@ -0,0 +1,69 @@ +-- This is released into the public domain. +-- No warranty is provided, implied or otherwise. + +-- app-slaunch: searching launcher +local event = require("event")(neo) +local neoux, err = require("neoux") +if not neoux then error(err) end +neoux = neoux(event, neo) + +local running = true + +local buttons = {} +local appNames = neo.listApps() +local searchTerm = "" + +function searchApps(str) + local rt = {} + for k,v in ipairs(appNames) do + if v:sub(1, 4) == "app-" then + if v:find(str) then + rt[#rt+1] = v + neo.emergency(v) + end + end + end + return rt +end + +function genWindow(apps) + local wwidth, wheight, wcontents = 1, 1, {} + for k,v in pairs(apps) do + appname = v:sub(5) + if appname:len()+2 > wwidth then + wwidth = appname:len()+2 + end + table.insert(wcontents, neoux.tcbutton(1, wheight+1, appname, function(w) + local pid, err = neo.executeAsync(v) + if not pid then + neoux.startDialog(tostring(err), "launchErr") + else + w.close() + running = false + end + end)) + wheight = wheight + 1 + end + wwidth = math.max(wwidth, 11) + table.insert(wcontents,1,neoux.tcfield(1,1,wwidth,function(nv) + if not nv then return searchTerm end + searchTerm = nv + local sapps = searchApps(searchTerm) + local fwwidth, fwheight, fwcontents = genWindow(sapps) + window.reset(fwwidth, fwheight, nil, neoux.tcwindow(fwwidth, fwheight, fwcontents, function(w) + w.close() + running = false + end, 0xFFFFFF, 0)) + end)) + return wwidth, wheight, wcontents +end + +wwidth, wheight, wcontents = genWindow(searchApps(searchTerm)) +window = neoux.create(wwidth, wheight, nil, neoux.tcwindow(wwidth, wheight, wcontents, function (w) + w.close() + running = false +end, 0xFFFFFF, 0)) + +while running do + event.pull() +end diff --git a/repository/data/app-claw/local.lua b/repository/data/app-claw/local.lua index e460268..c2b8846 100644 --- a/repository/data/app-claw/local.lua +++ b/repository/data/app-claw/local.lua @@ -35,6 +35,19 @@ return { "apps/app-launchbar.lua" }, }, + ["app-slaunch"] = { + desc = "Searching launcher", + v = 0, + deps = { + "neo" + }, + dirs = { + "apps" + }, + files = { + "apps/app-slaunch.lua" + }, + }, ["neo-docs"] = { desc = "KittenOS NEO system documentation", v = 2, From 08a34619e03f5e0dbe3bb58a17d4381d5b604896 Mon Sep 17 00:00:00 2001 From: Izaya Date: Mon, 23 Apr 2018 20:50:21 +1000 Subject: [PATCH 4/7] added (public domain) license info to app-launchbar --- repository/apps/app-launchbar.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/repository/apps/app-launchbar.lua b/repository/apps/app-launchbar.lua index 8bc34e2..9649122 100644 --- a/repository/apps/app-launchbar.lua +++ b/repository/apps/app-launchbar.lua @@ -1,3 +1,8 @@ +-- This is released into the public domain. +-- No warranty is provided, implied or otherwise. + +-- app-launchbar: launchbar with application pinning + local event = require("event")(neo) local neoux, err = require("neoux") if not neoux then error(err) end From 704d54bb8fdaadf0ef91017f40f1d4adebb12425 Mon Sep 17 00:00:00 2001 From: Izaya Date: Fri, 27 Apr 2018 13:29:30 +1000 Subject: [PATCH 5/7] launchers no longer spam neo.emergency --- repository/apps/app-launchbar.lua | 2 -- repository/apps/app-slaunch.lua | 1 - 2 files changed, 3 deletions(-) diff --git a/repository/apps/app-launchbar.lua b/repository/apps/app-launchbar.lua index 9649122..7d846e6 100644 --- a/repository/apps/app-launchbar.lua +++ b/repository/apps/app-launchbar.lua @@ -17,7 +17,6 @@ local icecap = neo.requireAccess("x.neo.pub.base", "load pinned applications") local w,f = pcall(icecap.open,"/pinned", false) if w and f then - neo.emergency(f) local fcontent = f.read("*a") for s in fcontent:gmatch("[^\n]+") do for k,v in ipairs(neo.listApps()) do @@ -102,7 +101,6 @@ end local function appMenu(autoclose) local wwidth, wheight, buttons = genAppMenu(autoclose) - neo.emergency(wwidth,wheight,buttons) neoux.create(wwidth+3, wheight, "apps", neoux.tcwindow(wwidth+3, wheight, buttons, function (w) w.close() end, 0xFFFFFF, 0)) diff --git a/repository/apps/app-slaunch.lua b/repository/apps/app-slaunch.lua index 5776f23..6e34e64 100644 --- a/repository/apps/app-slaunch.lua +++ b/repository/apps/app-slaunch.lua @@ -19,7 +19,6 @@ function searchApps(str) if v:sub(1, 4) == "app-" then if v:find(str) then rt[#rt+1] = v - neo.emergency(v) end end end From 79969151039160a8b265bf46cb1281a8e8796920 Mon Sep 17 00:00:00 2001 From: Izaya Date: Sat, 28 Apr 2018 15:28:34 +1000 Subject: [PATCH 6/7] updated the repo to listing to include license files, added licensing and authorship for app-launchbar and app-slaunch --- repository/data/app-claw/local.lua | 56 ++++++++++++----------- repository/docs/repoauthors/app-launchbar | 2 + repository/docs/repoauthors/app-slaunch | 2 + 3 files changed, 34 insertions(+), 26 deletions(-) create mode 100644 repository/docs/repoauthors/app-launchbar create mode 100644 repository/docs/repoauthors/app-slaunch diff --git a/repository/data/app-claw/local.lua b/repository/data/app-claw/local.lua index c2b8846..1310511 100644 --- a/repository/data/app-claw/local.lua +++ b/repository/data/app-claw/local.lua @@ -22,32 +22,6 @@ return { "docs/repoauthors/app-eeprog" }, }, - ["app-launchbar"] = { - desc = "Application launcher bar", - v = 0, - deps = { - "neo" - }, - dirs = { - "apps" - }, - files = { - "apps/app-launchbar.lua" - }, - }, - ["app-slaunch"] = { - desc = "Searching launcher", - v = 0, - deps = { - "neo" - }, - dirs = { - "apps" - }, - files = { - "apps/app-slaunch.lua" - }, - }, ["neo-docs"] = { desc = "KittenOS NEO system documentation", v = 2, @@ -132,6 +106,36 @@ return { "docs/repoauthors/svc-ghostie" }, }, + ["app-launchbar"] = { + desc = "Application launcher bar", + v = 0, + deps = { + "neo" + }, + dirs = { + "apps", + "docs/repoauthors" + }, + files = { + "apps/app-launchbar.lua", + "docs/repoauthors/app-launchbar" + }, + }, + ["app-slaunch"] = { + desc = "Searching launcher", + v = 0, + deps = { + "neo" + }, + dirs = { + "apps", + "docs/repoauthors" + }, + files = { + "apps/app-slaunch.lua", + "docs/repoauthors/app-slaunch" + }, + }, -- licenses (MUST BE IMMUTABLE) ["zzz-license-pd"] = { desc = "license file 'Public Domain'", diff --git a/repository/docs/repoauthors/app-launchbar b/repository/docs/repoauthors/app-launchbar new file mode 100644 index 0000000..4bb3f58 --- /dev/null +++ b/repository/docs/repoauthors/app-launchbar @@ -0,0 +1,2 @@ +repository/apps/app-launchbar.lua: Izaya, Public Domain + diff --git a/repository/docs/repoauthors/app-slaunch b/repository/docs/repoauthors/app-slaunch new file mode 100644 index 0000000..8d3003a --- /dev/null +++ b/repository/docs/repoauthors/app-slaunch @@ -0,0 +1,2 @@ +repository/apps/app-slaunch.lua: Izaya, Public Domain + From 42e4212dc67ea664e1531c604cf3ce5782d181d3 Mon Sep 17 00:00:00 2001 From: Izaya Date: Sun, 29 Apr 2018 12:33:00 +1000 Subject: [PATCH 7/7] added a dependency on the public domain license and added authorship info to the actual code files --- repository/apps/app-launchbar.lua | 1 + repository/apps/app-slaunch.lua | 2 ++ repository/data/app-claw/local.lua | 6 ++++-- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/repository/apps/app-launchbar.lua b/repository/apps/app-launchbar.lua index 7d846e6..35ab847 100644 --- a/repository/apps/app-launchbar.lua +++ b/repository/apps/app-launchbar.lua @@ -2,6 +2,7 @@ -- No warranty is provided, implied or otherwise. -- app-launchbar: launchbar with application pinning +-- Authors: Izaya local event = require("event")(neo) local neoux, err = require("neoux") diff --git a/repository/apps/app-slaunch.lua b/repository/apps/app-slaunch.lua index 6e34e64..6fee6ed 100644 --- a/repository/apps/app-slaunch.lua +++ b/repository/apps/app-slaunch.lua @@ -2,6 +2,8 @@ -- No warranty is provided, implied or otherwise. -- app-slaunch: searching launcher +-- Authors: Izaya + local event = require("event")(neo) local neoux, err = require("neoux") if not neoux then error(err) end diff --git a/repository/data/app-claw/local.lua b/repository/data/app-claw/local.lua index 1310511..ce99e31 100644 --- a/repository/data/app-claw/local.lua +++ b/repository/data/app-claw/local.lua @@ -110,7 +110,8 @@ return { desc = "Application launcher bar", v = 0, deps = { - "neo" + "neo", + "zzz-license-pd" }, dirs = { "apps", @@ -125,7 +126,8 @@ return { desc = "Searching launcher", v = 0, deps = { - "neo" + "neo", + "zzz-license-pd" }, dirs = { "apps",