After installing the latest update of Mac OS X macOS (macOS 10.12, Sierra), I noticed that my hotkey for iTerm2's slide-down window was not working anymore.
Turns out that Karabiner has a known issue with macOS Sierra and does not work any more.
The developers are already developing a fix and in the meantime provide Karabiner-Elements as a hot-fix package. From what I understand, the functionality of the KE is limited to single key remapping, but can be combined with Keyboard Maestro/Better Touch Tool for more sophisticated shortcuts (just search the GitHub Issues of Karabiner/KE).
KE does not come with a (useful) GUI interface and can be configured via a JSON file.

iTerm's hotkey is configured to be the F18 key, so I need to my Caps-Lock key (WHO NEEDS THIS KEY ANYWAY) to this key.
I configured it in Karabiner already and it also doable in Karabiner-Elements.
The following is my karabiner.json:

{
    "profiles": [
        {
            "name": "Default profile",
            "selected": true,
            "simple_modifications": {
                "caps_lock": "f18"
            }
        }
    ]
}

Next, I have assigned F18 to the Hotkey Window profile in iTerm:

F18 mapped to the Hotkey Window profile

It's all working again!

(picture credit: Toby on Flickr)

Location-aware Functional Keys

The problem

The problem with the Apple Media Keys is that they hide the standard function keys. This is great for media consumption, as I can adjust the display brightness or sound volume with just one hand.
However in Eclipse, the current IDE I spend most of my working hours in, the F-keys are mapped to often used actions, such as debug stepping and running code. This is great, as I can debug my code step by step with just a few keys with my eyes staying on the display.

The solution

OS X provides a setting for either one of the two modes directly accessible without touching the Fn key, but this is tedious doing it everytime I switch from home to work or vice versa.

Enter ControlPlane. This app lets you do Actions based on your Context. For instance, most of my Contexts are activated, when my MacBook is connected to a certain monitor or sees a certain WiFi network, but other Evidence Sources are also possible.

The missing link between the automatically detected environment (work or home) and the correct setting (media keys or function keys) is the often neglected, because miserably documented, AppleScript.

I found a script for toggling the setting in a forum post. I took it and created two separate scripts, one for activating the setting (at work) and one for deactivating (at home).

Next I created a Shell Execution Action for each of the scripts (osascript path/to/script), one when entering the work Context, and one when leaving.

But wait! We are not done yet.

Mavericks introduced fine-granular settings for Accessibility. Each Accessibility feature has to be enabled for specific apps, when Apps request those features. But ControlPlane does not request the feature to script UI elements, so it does not get added to the list, thus our AppleScript execution fails. Giving the AppleScript Editor the rights is not enough, because when ControlPlane is executing the script the AppleScript Editor is no longer the executing app.

So, how to get the some executing app listed there?

The trick is to wrap both scripts in an Automator app; and so I wrapped both scripts and told ControlPlane to execute both apps and hide them (just to be sure I do not see them executing).

I put the code and the basic instructions into a gist:

Mac OS X Lion - Samba-Share und avahi

Gerade bin ich am Einrichten der Samba-Freigabe meines Homeservers.
Per avahi annoncierte AFP-Freigaben können ohne Probleme gemounted werden.
Bei der SMB-Freigabe jedoch erscheint sofort eine Fehlermeldung, wenn ich die Freigabe im Finder auswähle.

Die Lösung zum Problem habe ich im macuser.de-Forum gefunden:

Der Port muss von 139 auf 445 geändert werden.

<service-group>
    <name replace-wildcards="yes">%h (SMB)</name>
    <service>
        <type>_smb._tcp</type>
        <port>445</port>
    </service>
    <service>
         <type>_device-info._tcp</type>
         <port>0</port>
         <txt-record>model=Xserve</txt-record>
    </service>
</service-group>

Der Eintrag Xserve unter txt-record sorgt im Übrigen dafür, dass das Icon eines Xserve im Finder angezeigt wird.

PDF-Drucker unter Mac OS X

Dinge nicht am Drucker zu drucken, sondern als PDF auszugeben geht ja am Mac eigentlich relativ einfach über das Drucken-Menü (CMD+P).

Wenn die App, die man gerade benutzt das nur leider nicht bietet, dann ist man erstmal ein wenig ratlos.
Wenn man dann nach "Virtuellen Druckern" für OS X sucht, findet man erstmal ein Bash-Script, das nur unter Panther (10.3) aber nicht unter 10.2 getestet wurde.
Ob das unter 10.7 Lion noch läuft, habe ich garnicht erst getestet, da man mit ALT+Klick auf das Plus in den Druckereinstellungen garnicht mehr weiterkommt.
Danach bin ich dann zum Glück auf CUPS-PDF gestoßen. Kompatibilität ist für Snow Leopard garantiert, unter Lion hab ich das jetzt auch erfolgreich testen können.

CUPS-PDF Printer-Dialog

Das Teil ist eigentlich nur ein Backend für den CUPS-Daemon und taucht dann wie ein normaler Drucker im Druckdialog auf.