Calendar Today Widget 1.1
December 1, 2018
Today I released an update of a simple but pretty useful macOS Today Extension widget: Calendar Widget.
What is that
After I switched from Linux + KDE to macOS, I suffered from lack of various stuff, one of which is a simple calendar widget, which is accessible with one click on the system panel. As soon as I started using macOS, I began to look for alternatives.
The first one is a quite simple widget that only allow to display an output of a shell script. It is enough to display the current month, but there is not way to get additional features working, such as Go to next/previous month.
The second one seemed exactly what I needed, unfortunately, the original project and all its forks were abandoned, so I started to maintain my own version. There isn’t anything particularly complicated except that Apple loves to change the Aqua appearance.
- 10.10 Yosemite, 10.11 El Capitan, and 10.12 Sierra used fully dark Notification Center, the original version of Calendar was designed for these versions.
- 10.13 High Sierra significantly changed it and the Notification Center became fully white regardless of system settings. It required to change all colors used in the app.
- Finally, 10.14 Mojave introduced two different themes: Light and Dark.
As you might expect, Mojave required making new changed in the Calendar widget. But in fact, Mojave does most of the work for you, and the only thing developers should do is to use semantic colors (such as
linkColor, etc.) in their application or create a custom color set. All these steps are comprehensively described in the Apple article about supporting new Dark Mode.
It could seem that if I used semantic colors semantic colors from the beginning, no changes would be required to support new Mojave Dark Mode. However, there is a thing which isn’t covered in the migration guide: regardless of the fact that the Calendar app was compiled using Xcode 10, macOS 10.14 executes the widget in backward compatibility mode, ignoring all Dark theme-specific color sets in the Asset catalog and even semantic colors. It revealed that to get all Mojave Dark theme features working in a Today Extension it is required to set the following parameter in
<key>NSExtension</key> <dict> <key>NSExtensionAttributes</key> <dict> <key>NSExtensionPointVersion</key> <string>3.0</string> </dict> </dict>
Surprisingly, Apple has never explained what
NSExtensionPointVersion parameter actually does.
The final result with Light and Dark themes, respectively:
You can grab Calendar Widget app on the Releases page: just extract it to somewhere, double-click and add a new widget in the macOS Notification Center.