Skip to content

Commit

Permalink
sched/clkinfo: tapping an alarm toggles it on/off
Browse files Browse the repository at this point in the history
  • Loading branch information
bobrippling committed Sep 19, 2024
1 parent 84f1212 commit 943de6f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions apps/sched/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@
0.24: Emit alarmReload when alarms change (used by widalarm)
0.25: Fix wrap around when snoozed through midnight
0.26: Fix hitting snooze on an alarm after when the snooze would've fired
0.27: Tapping clkinfo enables/disables the selected alarm
10 changes: 8 additions & 2 deletions apps/sched/clkinfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,13 @@
}

var img = iconAlarmOn;
var all = alarm.getAlarms();
//get only alarms not created by other apps
var alarmItems = {
name: /*LANG*/"Alarms",
img: img,
dynamic: true,
items: alarm.getAlarms().filter(a=>!a.appid)
items: all.filter(a=>!a.appid)
//.sort((a,b)=>alarm.getTimeToAlarm(a)-alarm.getTimeToAlarm(b))
.sort((a,b)=>getAlarmOrder(a)-getAlarmOrder(b))
.map((a, i)=>({
Expand All @@ -123,7 +124,12 @@
this.interval = undefined;
this.switchTimeout = undefined;
},
run: function() { }
run: function() {
a.on = !a.on;
this.emit("redraw");
alarm.setAlarms(all);
alarm.reload();
}
})),
};

Expand Down
2 changes: 1 addition & 1 deletion apps/sched/metadata.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "sched",
"name": "Scheduler",
"version": "0.26",
"version": "0.27",
"description": "Scheduling library for alarms and timers",
"icon": "app.png",
"type": "scheduler",
Expand Down

0 comments on commit 943de6f

Please sign in to comment.