Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Things Extension #85

Merged
merged 8 commits into from
Oct 20, 2021
Merged

Add Things Extension #85

merged 8 commits into from
Oct 20, 2021

Conversation

loris
Copy link
Contributor

@loris loris commented Oct 17, 2021

Description

Here is the first working version of a Things extension. It currently uses JXA (ie, AppleScript using JavaScript) to communicate with Things, so Things needs to be installed and running.
It is very basic at the moment: it includes several commands to list the To-Dos from Things lists (Inbox, Today, etc) and allows to filter and open to-dos.

Expect several improvements and new features in the coming days (have a look at the screenshot for some hints).

Feel free to test, give me feedbacks or contribute.

Type of change

  • New extension

Screencast

Screenshot 2021-10-17 at 21 25 28

Checklist

@PitNikola PitNikola added the new extension Label for PRs with new extensions label Oct 18, 2021
@danielrgjoseph
Copy link

What time zone are the scripts working in? It appears that for tasks due today, it gives the time of midnight of the day before. I am not sure if this is the intended behavior. For example, if a task is due today and it's 6 am, the today script says due 6 hrs ago. It could perhaps be more beneficial to just say today or perhaps could to the next day's midnight, so instead of due 6 hrs ago, it would say due in 16 hrs if that makes sense.

@PitNikola PitNikola self-assigned this Oct 19, 2021
@loris
Copy link
Contributor Author

loris commented Oct 19, 2021

@Daniel-Joseph great feedback, indeed I was planning to do something like this. I stumbled upon a Things workflow for Alfred and the author is doing something similar to what you suggested (ie, displaying "today"), here: https://github.com/xilopaint/alfred-things/blob/master/src/things.applescript#L96

@loris
Copy link
Contributor Author

loris commented Oct 19, 2021

@Daniel-Joseph added a new formatDueDate method that mimic the way due dates are displayed in Things (well except the red coloring, but we cannot do that in Raycast List UI at the moment).

Here is Raycast:
image

And Things:
image

@danielrgjoseph
Copy link

Oh wow that's a really nice and quick fix. I think I just found another unintended bug. For recurring tasks in upcoming, the date before this last commit would say in 17000 days, and now after your most recent changes says Jan 1 even if the recurring task is set to be due this week. I do not personally know how to address this.

@loris
Copy link
Contributor Author

loris commented Oct 19, 2021

@Daniel-Joseph interesting, it looks like a really strange bug (or maybe on purpose), but the dueDate for a recurring task with deadlines is indeed "Mon Jan 01 4001 00:00:00 GMT+0100" when using Apple Script

image

I guess, Things is storing recurring deadlines in another structure I am not aware of (or, I'm afraid, is not available through Script). I'll keep looking.

Copy link
Member

@PitNikola PitNikola left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @loris, thanks for your contribution! This is really impressive, I didn't realise that it's possible to build such extension with Things, I thought they are pretty limited when it comes to API.

Few minor things to improve:

  • Let's add an icon for "Mark as Completed" action, otherwise it looks a bit off. There is Icon.Checkmark that would probably fit well.

CleanShot 2021-10-19 at 22 24 01@2x

  • I noticed that when I run "Mark as Completed" with one of my items, it didn't disappear from the list or gave any indication that it was successful. Do you think we could show a toast and also delete the item from the list? Or maybe change icon to checkmark and then delete after short delay to make it even nicer. What do you think?

@loris
Copy link
Contributor Author

loris commented Oct 20, 2021

Hi @PitNikola, thanks for the review!
Regarding your 2 feedbacks, sorry I should have made it clearer: as you can see in the code, the "Mark as completed" action is wrapper in a environment.isDevelopment condition, so you were not supposed to see it (well you, because you tested in in dev condition, but not real users yet). It is not ready yet, for the reason you invoked in your feedback #2, right now using script to change the status of a to-do also move it to the "Logbook" list, I need to dig deeper to see how it can stay in the list.

Do you think we can release the first version (which is read-only) as it is right now so that I can start getting feedbacks? (For instance, I planned to add a "Create To-Do" form, but I'm not even sure this will be useful since Things has a powerful "Quick entry" form that can be invoked with global shortcut)

Thanks

@loris loris requested a review from PitNikola October 20, 2021 06:23
Copy link
Member

@PitNikola PitNikola left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, got it! Yeah, I was running in Dev env. Ok, then it's fine, we can ship it like this and see.

@PitNikola PitNikola merged commit 55a3e73 into raycast:main Oct 20, 2021
FezVrasta pushed a commit to FezVrasta/extensions that referenced this pull request Nov 24, 2021
* Add Things Extension

* Add caching for faster display of lists

* Improve display of dueDate

* Fix formatDueDate pluralization
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new extension Label for PRs with new extensions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants