Software

Yoink users have been automating adding various files to Yoink via Automator Workflows for a while now – from adding mail attachments or screenshots, to adding files from the Terminal.
Douglas (@douglasjsellers on twitter) today adds to this list of wonderful workflows an Automator Workflow that lets you quickly add files that you created/saved recently.

Here’s what he says about it:

I cooked up my Automator Service that lets you send the last file that you saved (from any application) to Yoink.
When bound to a key combination this allows you to do things like “Export to Web” from Adobe Photoshop, hit the key combo and then the newly created png is on Yoink.
Or say you’re editing a file in Emacs and you want to add it as an email attachment. You save the file, hit the key combo and the file will then be in Yoink for easy dragging into your email.
I also use it heavily to get recently downloaded files from chrome to Yoink.

The Automator Workflow

Screenshot of Automator Workflow for Yoink

The main part of this workflow consists of a complex shell script that finds files that were recently saved, excluding files that are less likely to be needed in Yoink – obviously, this is something everybody needs to configure for themselves, but since this is an Automator Workflow, it is easily done.

Download

The Automator Workflow is available for download here (~130 KB).
My thanks to Douglas for his awesome work.

Installation & Keyboard Shortcut Setup

To install this workflow, download it from above, unzip it, double-click it and click on Install when this dialog comes up:

Instaling the Automator WorkflowClick on Install if you’d like to install the service, click on Open with Automator if you’d like to make changes

To create a keyboard shortcut for this service:

  1. Launch System Preferences
  2. Click on Keyboard -> Shortcuts -> Services
  3. Find ’Send Last File to Yoink’ in the list, under ‘General’
  4. Click on ‘add shortcut’ and enter the shortcut you’d like to use to activate the service

If you have any feedback regarding this workflow or if you’d like to share a workflow of your own, please be sure to get in touch either via twitter or eMail. Thank you and enjoy 🙂

Read more

SiriMote App Icon

Introducing: SiriMote

Apart from pairing the Remote with your Mac to test Apple TV apps running in Xcode’s Simulator, the Remote is not of much use on the Mac.
That’s where SiriMote comes into play: It enables you to use the Apple TV Siri Remote with all sorts of applications.

Using SiriMote

SiriMote requires you to pair your Apple TV Siri Remote with your Mac.
Once finished with pairing (detailed instructions are shown in the app), you’re ready to go.

Aside from controlling your Mac’s system volume with the Remote, you can now use it to control:

iTunes Icon (Apple Inc.)

iTunes

Play/Pause, Fast Forward, Rewind, Next Track, Previous Track

Keynote Icon (Apple Inc.)

Keynote

Next Slide, Previous Slide

QuickTime Player X Icon (Apple Inc.)

QuickTime

Play/Pause, Fast Forward, Rewind

VLC Icon (Videolan)

VLC

Play/Pause, Fast Forward, Rewind, Next Track, Previous Track

… as well as many other applications. How? Keep reading 😉

Pricing and Availability

SiriMote is a free download from my website. OS X El Capitan 10.11 and a Mac with Bluetooth 4.0 is required.

I decided to make it a free app as I’m uncertain as to how long the app will be needed.
I suspect at some point, Apple might actually implement this functionality right into the OS.
If you like the app, though, I’d love for you to take a look at my other applications – thank you 🙂

How it Works

SiriMote Main Window

SiriMote translates remote buttons into media key presses of your Mac’s keyboard. For example, when you press Volume Up on the Siri Remote, the app will translate that into the Volume Up key on your keyboard and send it to the system.
Likewise, it translates the Play/Pause button on the Remote to the Play/Pause media key on your Mac’s keyboard and sends that to the system.

That enables your Remote to interact with any application that hooks into the media key event system.

The Mac App Store and the OS X Sandbox

SiriMote is not available from the Mac App Store, as it uses an API that does not work in the OS X sandbox to send media key events (CGEventPost).
As the Mac App Store requires the app to run in the sandbox environment, I couldn’t submit it. Either way, you will stay up-to-date as it uses Sparkle to deliver app-updates easily and quickly.

Links

SiriMote Website: http://eternalstorms.at/sirimote
SiriMote Direct Download: http://bit.ly/sirimotezip
SiriMote on ProductHunt: https://www.producthunt.com/tech/sirimote

Read more

I’m participating in TwoDollarTuesday’s Black Friday sale with some of my apps (MacStories has great coverage of over 200 deals as well) :

 

Yoink IconYoink
Simplify and improve drag and drop
40% off – Mac App Store; Website

Screenfloat IconScreenFloat
Create floating screenshots to keep references to anything visible on your screen
28% off – Mac App Store; Website

Transloader IconTransloader
start downloads on your Mac remotely from your iPhone or iPad
30% off – Mac App Store; Website

Glimpses IconGlimpses
turn your photos and music into stunning still motion videos
40% off – Mac App Store; Website 

 

I hope you’ve had a great Thanks Giving and are enjoying the Black Friday Sale that’s going on 🙂

Read more

In an effort to show preferences for configuring Force Touch in my apps (in particular, Yoink) only when a Force Touch device is actually available, I had to find a way to figure out how to detect Force Touch devices.

If this was iOS, I’d be done by now

On iOS, Apple provides a simple API for this:

UIForceTouchCapabilityUnavailable and UIForceTouchCapabilityAvailable

which you can check by calling UIView’s – (UIForceTouchCapability)traitCollection;. Lo and behold, a simple API like this is sadly not available on OS X. On the Mac, you have to do it yourself.

IOKit is where it’s at

Using IOKit, you can sort of set up a set of properties you’re looking for in a device and see if it returns anything. This does not only include an external or internal keyboard, mouse or trackpad, but also graphic cards, for example. To find out what the right properties are, I downloaded Apple’s Hardware IO Tools for Xcode 7.1 from their developer downloads site (Apple Developer account required) and launched the app IORegistryExplorer.

Digging down the IO Registry

I do have a Magic Trackpad 2 “attached” to my Mac via Bluetooth, so I tried searching for the term “Trackpad”, and sure enough, I saw my internal and external ones:

IORegistry TrackpadsThe Trackpads attached to my Mac, either via Bluetooth or internally.

Having found the Magic Trackpad 2, the next step is to see what properties it offers and if they are unique to the class of the device:

Trackpad PropertiesJackpot!

Sure enough, there it is – ForceSupported: True. I could not find such a key in the internal trackpad’s properties, hinting that it might be exclusive to devices that do support Force Touch. There’s also an entry for “Manufacturer”, which is “Apple Inc.”. Perfect.

Looking for Devices with IOKit

Now all I have to do is filtering devices by the Manufacturer – “Apple Inc.” -, iterate over the resulting devices, and filter out devices that have a DefaultMultitouchProperties key, containing a ForceSupported key with a value of true. If such a device is found, it means a device with Force Touch capabilities is available.

Code Listing #1

In this method, I create a dictionary mDict that is used to find matching devices. In this case, I’m looking for devices with the Manufacturer set to “Apple Inc.”. I query for possible devices using IOServiceGetMatchingServices. I can then iterate over the returned io_iterator_t iterator and recursively over the children in the core of all of this: – (BOOL)_containsForceTouchDevice:io_iterator_t)iterator;.

Code Listing #2

Here, we iterate recursively over iterator’s objects, checking for the DefaultMultitouchProperties key and, subsequently the ForceSupported key (and value).

Testing it with other Trackpads

The code you see above is final. However, in a previous version, all I could use to test it with was my Magic Trackpad 2 – an internal Force Touch Trackpad (the likes of which the new MacBooks and MacBook Pros feature) was not available to me directly. So I sent the first draft of the code to my friend (and fellow developer) Maurice Kelly (@mauricerkelly on twitter) who was kind enough to volunteer as my “test subject”; and – of course – it didn’t work. Turns out I shouldn’t assume the vendorID to be the same (which I used in the first draft just like the Manufacturer to filter the possible results). After leaving it out, it worked fine over all currently available Force Touch Trackpads.

Hot (Un-)Plugging

Sometimes you might want to get notified when devices are plugged in to or unplugged from the Mac. In Yoink, I’d like to display preferences specific to Force Touch if according hardware is available, but not show them if there isn’t any hardware connected that supports it. Also, as a nice touch, I’d like to hide the preferences if according hardware is disconnected and show it again when it is connected. We can accomplish this like that:

Code Listing #3

Sandbox

The code works just as well in the Sandbox environment, these entitlements have to be set, though, for the notifications to work:

Sandbox Entitlements

com.apple.security.device.usb and com.apple.security.device.bluetooth

Future Proof?

I’m not sure this code is future proof. The basic APIs will stay around, sure, but it all depends on the keys DefaultMultitouchProperties, ForceSupported and their according values which are not defined in the IOKit header files, which I unsuccessfully searched for constants pertaining to force/pressure. So, depending on this, the code might break with future versions of the Force Touch Trackpad and I’ll have to keep testing it as Apple releases new hardware. Nevertheless, I’m quite happy with the code and it works very well.

Getting the Source Code

I’ve uploaded a sample project to my server, you can download it here. The category on NSApplication in which this is available can be downloaded from Github. The example app is pretty simple:

Force Touch Device Detection Example App Screenshot

At launch, it asks if a Force Touch capable device is available and displays an according message. If subsequently the availability status changes, the message will be updated accordingly.

If you’d like to get in touch, you can mail me or write me on twitter. I’m looking forward to hearing from you 🙂

Read more