Awesome
As of October 2023 this project is now archived. However, there is a continuation with even more amazing features over at ReinforceZwei/scriptable-calendar-widget.
<p align="center" > <img alt="scriptable calendar" src ="./assets/scriptable-calendar-widget.jpg"> </p>
Setting Up
- Copy the script in calendar.js to a new script in Scriptable app.
- Run the script first which should prompt Scriptable to ask for calendar access.
- If it didn't and you haven't given Scriptable calendar access before, try changing the
debug
setting totrue
and trying again. - To have the widget open the iOS calendar app, switch
debug
back tofalse
afterwards.
- If it didn't and you haven't given Scriptable calendar access before, try changing the
- Add a medium sized Scriptable widget to your homescreen.
- Long press the widget and choose "Edit Widget".
- Set the
Script
to be the script you just created andWhen Interacting
toRun Script
which will then launch Calendar app when you tap on the widget. - Return to your home screen which should now hopefully show the Scriptable calendar widget.
Customization
debug
- set totrue
to show the widget in Scriptable,false
to open a calendar app.calendarApp
- Tapping on the widget launches a calendar app (as long asdebug: false
), by default it launches the iOS Calendar app, however it can be changed to anything as long as the app supports callback URLs. Changing thecalshow
to something else would open other apps. E.g. for Google Calendar it isgooglecalendar
, for Fantastical it isx-fantastical3
.backgroundImage
- Image path to use as the widget background, which is taken either from the widget parameters, from theparams
variable at the top, or just replaceparams.bg
with the image path. To get an image that can then be used to have a "transparent" widget background use this script and save it to the Scriptable folder on iCloud. Then set either the widget parameter (long press on the widget -> edit widget -> parameter) to{ "bg": "my-image.jpg"}
wheremy-image
is the name of your transparent background OR change the line which has{ bg: "1121.jpg" }
to include your image name.calFilter
- Optionally an array of calendars to show, shows all calendars if empty. Can be supplied as a widget parameter to only affect that particular widget.widgetBackgroundColor
- In case of no background image, what color to use.todayTextColor
- color of today's datemarkToday
- show a circle around today or nottodayCircleColor
- if we mark days, then in what colorshowEventCircles
- adds colored background for all days that have an event. The color intensity is based roughly on how many events take place that day.discountAllDayEvents
- if true, all-day events don't count towards eventCircle intensity valueeventCircleColor
- if showing event circles, then in what colorweekdayTextColor
- color of weekdaysweekendLetters
- color of the letters in the top rowweekendLettersOpacity
- a value between 0 and 1 to dim the color of the lettersweekendDates
- color of the weekend dayslocale
- a Unicode locale identifier string, this would change the weekday letters to the specified language.textColor
- color of all the other texteventDateTimeOpacity
- opacity value for event timeswidgetType
- for small widgets it determines which side to show. This would be set through widget parameters in order to set it per widget basis, rather than setting here and having all small widgets be the same type. (check: Small widgets)showAllDayEvents
- would either show or hide all day events.showCalendarBullet
- would show a●
in front of the event name which matches the calendar color from which the event originates.startWeekOnSunday
- would start the week either on a Sunday or a Monday.showEventsOnlyForToday
- would either limit the events to today or a specified number of future days withnextNumOfDays
nextNumOfDays
- ifshowEventsOnlyForToday
is set tofalse
, this allows specifying how far into the future to look for events. There is probably a limit by iOS on how far into the future it can look.showCompleteTitle
- would truncate long event titles so that they can fit onto a single line to fit more events into the view.showPrevMonth
- would show days from the previous month if they fit into the calendar view.showNextMonth
- would show days from the next month if they fit into the calendar view.individualDateTargets
- would allow tapping on a date to open that specific day in the calendar set by thecalendarApp
setting. (atm, supports default iOS calendar and Fantastical callback urls, should be possible to add more).flipped
- the layout for the medium-sized widget can be either the default,events - calendar
, or a flipped,calendar - events
layout. This setting can also be given as a widget parameter (something like:{ "flipped": true }
) to just affect that particular widget.
Small Widgets
The script also supports small widgets in which case the widget parameter (long press on the widget -> edit widget -> parameter) should be set to something like:
{ "bg": "top-left.jpg", "view": "events" }
{ "bg": "top-right.jpg", "view": "cal" }
Where "events"
specifies the events view and "cal"
the calendar view. (Setting the background is not necessary).
Large Widgets
The script should detect on its own that it is running in a large widget and will adjust accordingly.
Development
npm install
- install dev dependenciesnpm run dev
- this watches for file changes, bundles them, fixes syntax and copies the output file to iCloud. This workflow is not tested on any other system but mine which is a macOS, so it is very likely to break on anything else.