Nathan Grigg

Jumpcut, TextExpander edition

I use Jumpcut to save and use my clipboard history. One downside to Jumpcut is that it doesn’t play nicely with TextExpander. Because TextExpander manipulates the clipboard, Jumpcut captures every expanded snippet into its history. Some people may be able to tolerate this kind of pollution, but I cannot.

So I don’t use TextExpander. I have often wanted to, but not enough to give up Jumpcut. There are clipboard managers built into Launchbar and Alfred which purportedly play nicely with TextExpander (I can verify Launchbar but not Alfred), but even this cannot persuade me to give up Jumpcut.

Jumpcut is open source, but I know nothing of Objective-C or Mac development. I do know that TextExpander identifies things it puts on the clipboard with org.nspasteboard.AutoGeneratedType. Luckily for me, Wolf Rentzsch, whose podcast I just discovered, made a patch to ignore passwords put on the clipboard by PasswordWallet, which apparently uses a similar identification scheme. It seemed straightforward to adjust his patch to avoid capturing TextExpander snippets.

Surprisingly, it worked. TextExpander, welcome to the team.

Here is the single line I changed in Jumpcut’s AppController.m:

        pbCount = [[NSNumber numberWithInt:[jcPasteboard changeCount]] retain];
        if ( type != nil ) {
        NSString *contents = [jcPasteboard stringForType:type];
-       if ( contents == nil ) {
+       if ( contents == nil || [jcPasteboard stringForType:@"org.nspasteboard.AutoGeneratedType"] ) {
    //            NSLog(@"Contents: Empty");
            } else {

I have a Jumpcut fork on Github. In addition to this change, I have incorporated some stylistic changes from Dr. Drang’s fork.

Obviously you’ll need Xcode to build it. I’d be happy to send a link to a binary if someone wants it, but I don’t really know what I’m doing. All I know is it works for me.