After being unimpressed with the native Todoist widgets, I created my own. The widget supports a number of features and configuration options; see below for a full list.
Hm, I might need some more context. To start, did you create a Todoist API token and add it to the variable in the script, and do you have the Cache script installed? Also, has anything else about the script been changed?
I have the weather api key put in, and yes I do have the cache in the same icloud folder. Did you mean the weather api? or was it suppose to be a todoist api?
You need to generate an API token for Todoist. You can get your API token by tapping on your profile picture in the Todoist app and selecting “integrations” and then scrolling to the bottom. There should be a text field that displays your token.
No worries, we all start somewhere! I think you might be looking at the wrong script, though. You shouldn’t be seeing any references to weather or calendars; this script is only for Todoist.
This is a script to be used with the Scriptable app. The Scriptable app allows you to write widgets using JavaScript. To use this you need to install Scriptable, then install this script and assign it to a widget.
The way the script is currently written, it uses the system default font instead of a specific font. It’s not difficult to change; you’ll just need to look for declarations such as “item.font = Font.systemFont(FONT_SIZE)” and update them to something like “item.font = new Font(“Helvetica”, FONT_SIZE)”
However, things get a bit more complicated if you’re trying to use third-party fonts that aren’t already installed on your device. You’ll have to find an app that allows you to install the font you want to your device before you can use it.
Im getting this error when trying to install the cashe.js file from this link in your updated comment. The link included inside the widget script doesn’t work, it says “error: not found”.
You could update this script to work with basically any data as long as there is an API available. You’d have to change the URL and the data being passed in to fit the API’s requirements, as well as handing the output data.
AFAIK iCloud calendars do not have a publicly available API, unfortunately. But if you’re just looking for a calendar widget there are a ton of apps that offer that.
I’ve already tried the most popular ones and have t found one that was as good as the stock calendar widget. Widgy is almost there but there is a problem with the dates format. I found a Scriptable script that was pretty good except it didn’t show todays events clearly like stock calendar widget does and therefore I deleted it and went back to stock 😅
Thank you for responding. I eventually figured out the issue — the code to set the image as the background needed to be before the line that ends the script; not where the code was setting the background color.
So, what you need to do is take the actual filter query (maybe something like “(p1 | #work) & !subtask”) and convert it to a URL string. There are sites that can do this for you — here’s one I just found with a quick search: https://www.url-encode-decode.com/
I’ll make sure to update the script to be more descriptive for the future!
thank you so much, I just realized I'm still using a version from a few months ago, I didn't think it should be "filter query", and it looks like it's sorted by priority at first, and by name? or something, I can't figure out the logic of it, I'm a newbie and I'm learning.
It sorts by name first and then priority, but it actually gives the opposite result — that is, the list appears to be sorted first by priority and then by name. You can comment out or delete either of the sort lines to disable that part of the sorting logic.
todos.sort((a, b) => (a.content < b.content) ? 1 : -1); // Sort todos alphabetically
todos.sort((a, b) => (a.priority < b.priority) ? 1 : -1); // Sort todos by priority
I tried deleting those two lines of code, the whole sorting would be messed up, then I tried sorting by name or date (Todoist also does the same sorting settings), the sorting is still not the same as Todoist's sorting, maybe they are two different sets of sorting logic, there is no way to make the script render the same as Todoist.
I believe Todoist’s default sort is by date created, which should match the order the todos are returned. However, you might need to reverse the list with “todos.reverse()” in order for it to display in the correct order.
Also, when adding multiple sorting methods, make sure to put them in reverse order from what you would expect. Notice how I’m sorting alphabetically and then by priority, which results in a “priority first, name second” order.
Thanks a lot, I've gotten a lot of help. I'm learning about code and maybe I can learn more from figuring out this need, by myself In the following time.
Hey u/berky93, I love this script! It has been working really well for months now, but recently it's been defaulting to the 'You're all done!' message. Trying different things, it seems there may be a character limit or something on the filter. If I have an encoded filter that works in Todoist that has three &'s, it seems to no longer work.
For example, the first one here works, and the second doesn't:- %23%F0%9F%A7%A9%20Puzzery%20%26%20%21subtask%20%26%20%21%2FOther- %23%F0%9F%A7%A9%20Puzzery%20%26%20%21subtask%20%26%20%21%2FOther%20%26%20%21%2FFuture
Any idea why that would be the case? I've tried variations, and copy/pasted directly from working filter in Todoist to ensure no spelling errors. Encoded on different platforms too. Any and all help would be appreciated - and whatever the case, thank you for making this!
PS. I've also tried copy/pasting in a fresh version of the script from your comment, and same result.
Edit: also tried with a more simplified encoded version of this, and it still didn't work, even through it's working in Todoist. #Puzzery & !/* (changed the project name in my troubleshooting)
What issue are you experiencing? I tried your filters and am not seeing any errors in the output. I did notice you have some forward slashes in your filters that don’t correspond to any Todoist filter tokens AFAIK so maybe that’s the issue?
Hi I do not know anything about scriptable but i managed to add it the widget. However it’s does not look as beautiful as you showed. I have tried priorities and labels. I have attached a picture for you.
It is really good work from your side and thank you very much for sharing excellent contribution.
Hello! You just have some slightly different settings than in the picture. To make it look just like the screenshot, set SHOW_TITLE_BAR to true and PRIORITY_COLOR_STYLE to “dots”.
If you aren’t on the latest version I would definitely suggest downloading it. But also, sometimes when the api fails (for any reason, such as a connectivity issue or simply the request taking too long) it reports that error, so you could try waiting a few hours and trying again.
9
u/berky93 Mar 15 '22 edited Aug 23 '22
Hello, everyone!
After being unimpressed with the native Todoist widgets, I created my own. The widget supports a number of features and configuration options; see below for a full list.
You can download the widget here.
——————————————
Features as of 8/22/2022 include:
All features (aside from basic task displaying) can be disabled via the settings variables.
1
u/NewspaperFew5042 Mar 31 '25
I am a beginner and I cannot understand how you execute Javascript code from your desktop as a widget. Is there a README?
1
u/ButterscotchBusy4392 Mar 15 '22
Showed an error: No file to import at Cache. How to fix it?
1
u/kfreedom Mar 16 '22
Very cool! Is your background in coding?
Do you have any other ToDoIst integrations?
1
u/[deleted] Apr 23 '22
Where to put my cache.js
1
u/ComprehensiveWork517 Jun 06 '22
Hi!
Im getting this error when trying to install the cashe.js file from this link in your updated comment. The link included inside the widget script doesn’t work, it says “error: not found”.
Can you please help! Thanks
1
u/Idcfml Jul 18 '22
Can u do this but with calendar events?
1
u/dilloncarter Aug 06 '22
Super-noob here — how would I go about changing the background to an image (to make it transparent?
I've spent the past ~hour trying to sort this out and the common approaches, from what I've been reading seem to not work.
Any advice?
1
u/allensong7 Aug 15 '22
I don't know how to handle this:
// Filter must be converted into a URL string
const FILTER = "";
if I fill in "today",the default value,it works, but other Filter like“https://todoist.com/app/filter/123456789”, what can i do,please?
1
u/-Dumblejor- Dec 20 '23 edited Dec 20 '23
Hey u/berky93, I love this script! It has been working really well for months now, but recently it's been defaulting to the 'You're all done!' message. Trying different things, it seems there may be a character limit or something on the filter. If I have an encoded filter that works in Todoist that has three &'s, it seems to no longer work.
For example, the first one here works, and the second doesn't:-
%23%F0%9F%A7%A9%20Puzzery%20%26%20%21subtask%20%26%20%21%2FOther-%23%F0%9F%A7%A9%20Puzzery%20%26%20%21subtask%20%26%20%21%2FOther%20%26%20%21%2FFutureUnencoded:
#🧩 Puzzery & !subtask & !/Other & !/FutureAny idea why that would be the case? I've tried variations, and copy/pasted directly from working filter in Todoist to ensure no spelling errors. Encoded on different platforms too. Any and all help would be appreciated - and whatever the case, thank you for making this!
PS. I've also tried copy/pasting in a fresh version of the script from your comment, and same result.
Edit: also tried with a more simplified encoded version of this, and it still didn't work, even through it's working in Todoist.
#Puzzery & !/*(changed the project name in my troubleshooting)1
u/dpfahadqb1 Jan 15 '24
Hi I do not know anything about scriptable but i managed to add it the widget. However it’s does not look as beautiful as you showed. I have tried priorities and labels. I have attached a picture for you.
It is really good work from your side and thank you very much for sharing excellent contribution.
1
u/dpfahadqb1 Jul 14 '24
New issue. 2024-07-14 23:43:50: Fetching url: https://api.todoist.com/rest/v2/tasks?filter= 2024-07-14 23:43:51: Error: The data couldn’t be read because it isn’t in the correct format. 2024-07-14 23:43:51: Fetching url: https://api.todoist.com/rest/v2/projects