Posts

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.

As for calendar, I found two projects: Today Scripts and Calendar.

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.

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 selectedTextColor, 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 Info.plist to 3.0:

<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:

Screen Shot on macOS 10.14 Mojave

Download

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.