1
0
Fork 0

Add dtlaunch

master
jeffmer 2020-12-28 10:51:40 +00:00
parent 3f0617754e
commit b119494492
7 changed files with 105 additions and 0 deletions

View File

@ -2478,5 +2478,18 @@
{"name":"gmeter.app.js","url":"app.js"},
{"name":"gmeter.img","url":"app-icon.js","evaluate":true}
]
},
{ "id": "dtlaunch",
"name": "Desktop Launcher",
"icon": "icon.png",
"version":"0.02",
"description": "Desktop style App Launcher with six apps per page - fast access if you have lots of apps installed.",
"readme": "README.md",
"tags": "tool,system,launcher",
"type":"launch",
"storage": [
{"name":"dtlaunch.app.js","url":"app.js"},
{"name":"dtlaunch.img","url":"app-icon.js","evaluate":true}
]
}
]

2
apps/dtlaunch/ChangeLog Normal file
View File

@ -0,0 +1,2 @@
0.01: Initial version
0.02: Multiple pages

16
apps/dtlaunch/README.md Normal file
View File

@ -0,0 +1,16 @@
# Desktop style App Launcher
![](screenshot.jpg)
In the picture above, the Settings app is selected.
## Controls
**BTN1** - move backward through app icons on a page
**BTN2** - run the selected app
**BTN3** - move forward through app icons
**Swipe Left** - move to next page of app icons
**Swipe Right** - move to previous page of app icons

View File

@ -0,0 +1 @@
require("heatshrink").decompress(atob("mEwwhC/AH4ATxAAQC+2N7vd7AX/C/6/7a/4X/a/4X/C/4X/C/4Xfl3iC6vu9wXtI653WAH4A/ABg"))

73
apps/dtlaunch/app.js Normal file
View File

@ -0,0 +1,73 @@
/* Desktop launcher
*
*/
var s = require("Storage");
var apps = s.list(/\.info$/).map(app=>{var a=s.readJSON(app,1);return a&&{name:a.name,type:a.type,icon:a.icon,sortorder:a.sortorder,src:a.src};}).filter(app=>app && (app.type=="app" || app.type=="clock" || !app.type));
apps.sort((a,b)=>{
var n=(0|a.sortorder)-(0|b.sortorder);
if (n) return n; // do sortorder first
if (a.name<b.name) return -1;
if (a.name>b.name) return 1;
return 0;
});
var Napps = apps.length;
var Npages = Math.ceil(Napps/6);
var maxPage = Npages-1;
var selected = -1;
var oldselected = -1;
var page = 0;
function draw_icon(p,n,selected) {
var x = (n%3)*80;
var y = n>2?130:40;
(selected?g.setColor(0.3,0.3,0.3):g.setColor(0,0,0)).fillRect(x,y,x+79,y+89);
g.drawImage(s.read(apps[p*6+n].icon),x+10,y+10,{scale:1.25});
g.setColor(-1).setFontAlign(0,-1,0).setFont("6x8",1);
var txt = apps[p*6+n].name.split(" ");
for (var i = 0; i < txt.length; i++) {
txt[i] = txt[i].trim();
g.drawString(txt[i],x+40,y+70+i*8);
}
}
function drawPage(p){
g.setColor(0,0,0).fillRect(0,0,239,239);
g.setFont("6x8",2).setFontAlign(0,-1,0).setColor(1,1,1).drawString("Bangle ("+(p+1)+"/"+Npages+")",120,12);
for (var i=0;i<6;i++) {
if (!apps[p*6+i]) return i;
draw_icon(p,i,selected==i);
}
}
Bangle.on("swipe",(dir)=>{
selected = 0;
oldselected=-1;
if (dir<0){
++page; if (page>maxPage) page=maxPage;
drawPage(page);
} else {
--page; if (page<0) page=0;
drawPage(page);
}
});
function nextapp(d){
oldselected = selected;
selected+=d;
selected = selected<0?5:selected>5?0:selected;
selected = (page*6+selected)>=Napps?0:selected;
draw_icon(page,selected,true);
if (oldselected>=0) draw_icon(page,oldselected,false);
}
function doselect(){
load(apps[page*6+selected].src);
}
setWatch(nextapp.bind(null,-1), BTN1, {repeat:true,edge:"falling"});
setWatch(doselect, BTN2, {repeat:true,edge:"falling"});
setWatch(nextapp.bind(null,1), BTN3, {repeat:true,edge:"falling"});
drawPage(0);

BIN
apps/dtlaunch/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 305 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB