NSWindow title bar and toolbar showcase

I built a showcase for several combinations of styles of title bar and toolbar of NSWindow. Just to serve as a note of everything I want to remember about the NSWindow styles.

Title visibility

By default, the title of window is visible. window with title visible

window.titleVisibility = .Visible

This is a window with a toolbar while the title set to invisible: window with title invisible

window.titleVisibility = .Hidden

Example applications: Calendar, Notes, Xcode

Full size content view

When setting the NSFullSizeContentViewWindowMask, the content view extends to the whole window. The title bar and toolbar use a blur effect if visible.

window.styleMask |= NSFullSizeContentViewWindowMask

When both title and toolbar are visible: full size content view

When title is invisible: full size content view without title Example applications: Safari, Photos, Wunderlist

Transparent title bar

If you want to hide the title bar but still need the window buttons (such as close button, minimize button and screen button), you can set the titlebar to transparent:

window.titlebarAppearsTransparent = true

You may want to hide the title and use full size content view to get the following style.

window.titlebarAppearsTransparent = true
window.titleVisibility = .Hidden
window.styleMask |= NSFullSizeContentViewWindowMask

transparent titlebar Example application: Reeder,

Title accessory view

According to the documentation, title accessory view is a custom view you can put along with the title bar.

There are three layout choices.

At the bottom of title bar: title accessory view at the bottom of the title bar It’s at the bottom of title bar or toolbar. You can set the height of the view.

On the left of the title bar: title accessory view on the left of the title bar You can set the width of the view. The height of the title bar is fixed. If you set the height of the title accessory view, it doesn’t affect the height of the title and is clipped by the title bar. If the toolbar exist, it overlaps with the toolbar.

On the right of the title bar: title accessory view on the right of the title bar You can set the width of the view. The height of the title bar is fixed. If you set the height of the title accessory view, it doesn’t affect the height of the title and is clipped by the title bar. If the toolbar exist, it overlaps with the toolbar.

Example application: IA Writer

One thing to remember. You have to set the layout attribute before add the accessory view to the title.

Unified title and toolbar

Looks like this has been deprecated. No matter what you set, the title bar and toolbar are always unified since Yosemite.

I put the code as a project at github. Hope it helps.

About Mount Keeper

In the beginning of this year, we found a photographer to take some photos for my daughter’s birthday. He is a talent figure photographer and we are very satisfied with his service. He is using Mac, of course.

When he knew I am developing software on Mac, he asked me if there’s some software preventing external disk devices from mounting. He wanted to hire someone to help him on photo editing but don’t want any unauthorised copy of the photos of his clients.

I helped him searching around but couldn’t find any application meeting his requirement exactly. In the mean while, it’s an interesting requirement to me. So I decided to make one for him.

That’s how Mount Keeper came from.

Mount Keeper

This week I released the first version of Mount Keeper. It is a disk-mount-block tool integrated in the System Preferences of Mac OS X. It detects attached disk devices such as external hard disks, flash disks, or SD cards, and prevents their mount, mounts them as read-only, or lets the admin user choose, based on preferences.

Mount Keeper

The main features including:

  • Integrated in System Preferences.
  • Three options when disk device is about to mount.
  • Preferences can only be changed by admin user.
  • When “ask for choice” is chosen, authentication is required to mount a disk device.
  • Send notification when any new disk device is attached.
  • Uninstall with one button cleanly

It requires Mac OS X 10.9 or above.

Download. Try it for free for 14 days before you decide to buy a license.

It is granted 100% CLEAN award by Softpedia

Fixed link to the latest archive of Xcode

When using Xcode, I always want to the latest archive to be in a fixed position, for example, to build the installation package or make a new deployment.

Here’s a script

latest_archive_folder=$HOME/Library/Developer/Xcode/Archives/latest
mkdir -p $latest_archive_folder
rm -fr "$latest_archive_folder/$PROJECT_NAME"
ln -s "$ARCHIVE_PATH" "$latest_archive_folder/$PROJECT_NAME"

Put it in the Post-actions of the Archive in Scheme. Every time an archive is generated, the script generates a link with the project name in $HOME/Library/Developer/Xcode/Archives/latest/.