Skip to content

Commit

Permalink
feat: Delete timers (#12)
Browse files Browse the repository at this point in the history
* feat: add timer deletion option

* feat: add utility icons

* docs: update readme
  • Loading branch information
colomolo authored Jul 1, 2023
1 parent 3f5582d commit cebea56
Show file tree
Hide file tree
Showing 8 changed files with 1,097 additions and 333 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ Simple [Alfred](https://www.alfredapp.com/) workflow for setting up short timers
## Usage
Use keyword `timer` (or custom keyword) to init Timer. Hit ↵ to set up Timer to default duration (configurable) or pass duration as an argument. Specify timer message. Timer is set!

Set up two presets for the most often used time durations.
Set up two presets for your custom time durations.

Use keyword `pomodoro` (or custom keyword) to start pomodoro timer which has customizable duration from 15 to 30 minutes.

Timer also has two presets for your custom durations.
Use `timers` (or custom keyword) to see the list of active timers with option to cancel individual timers.

### Duration input examples
- 10 mins 10
Expand Down
Binary file added add.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions add_timer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env osascript -l JavaScript

function run(argv) {
ObjC.import('stdlib');
const timers = JSON.parse($.getenv('timers_list'));
const id = String($.getenv('timer_id'));
const message = $.getenv('timer_message');

timers[id] = message;

return JSON.stringify(timers, null, 2);
}
Binary file added cancel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions delete_timer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env osascript -l JavaScript

function run(argv) {
ObjC.import('stdlib');
const timers = JSON.parse($.getenv('timers_list'));
const id = String(argv[0]);

delete timers[id];

return JSON.stringify(timers, null, 2);
}
Loading

0 comments on commit cebea56

Please sign in to comment.