Notes on adding support for Dark Mode

This week I added support for macOS Mojave’s new Dark Mode to the GUI apps in Munki: https://github.com/munki/munki/commit/dea412d72e277265bc98dea2b358be5a830739b6

I initially thought adding Dark Mode support would be problematic. Most of the documentation and advice I’d seen seemed to imply that you had to build against the 10.14 SDK to get support for Dark Mode.
Continue reading “Notes on adding support for Dark Mode”

Notes on adding support for Dark Mode

Sample code for MacADUK 2017: Introduction to PyObjC

If you will be attending my session at MacADUK 2017, you might find it useful to have copies of the sample Python code and scripts I’ll be talking about and demonstrating.

I’ve set up a GitHub repo. The sample code is basically complete, but I might make some minor changes over the next several days.

You can download the code samples here: https://github.com/gregneagle/macaduk2017/archive/master.zip

or if you are familiar with Git, you can clone them locally:
git clone https://github.com/gregneagle/macaduk2017.git

Hope to see you in London!

Sample code for MacADUK 2017: Introduction to PyObjC

Accessing More Frameworks with Python

This post is based on a column I wrote for MacTech magazine in 2012. MacTech used to make older columns available online, but they haven’t done that for the past several years for some reason.
I’m planning to go through my older columns and dust off and republish some that I think are still relevant or useful.

Recently, we built a command-line tool using Python and the PyObjC bridge to control display mirroring.
PyObjC supports a lot of OS X frameworks “out-of-the-box”, and accessing them from Python can be as simple as:

include CoreFoundation

But what if the problem you want to solve requires a framework that isn’t included with the PyObjC bindings? In turns out that you can create your own bindings. In this post we’ll explore this aspect of working with Python and OS X frameworks.

OUR SAMPLE PROBLEM

In my organization, we sometimes have a need to set displays to a certain ColorSync profile. The ColorSync profile to use for a given display is a per-user preference, so if you need to set it for all users of a machine, you can’t just manually set it while logged in as one user and call it good.

If you are managing display profiles for a group of machines, or a conference room machine that has network logins, you need a way to manage display profiles for all users. Using MCX or doing some defaults scripting might come to mind. Let’s look at that possibility.

Continue reading “Accessing More Frameworks with Python”

Accessing More Frameworks with Python