Showing posts with label OSX. Show all posts

0

Some Keyboard Maestro macros

Posted on Wednesday, 17 July 2013

I've started using Keyboard Maestro recently and it is one impressive piece of software.

Here are a couple of the macros I've written that aren't completely tied to my system:

  • Type current Safari URL
    • This will type the URL of the frontmost Safari tab/window into your current application. Handy if you're chatting with someone and want to paste them a hilarious YouTube URL without switching apps, copying the URL to the clipboard and switching back.
    • It does not use the clipboard, it actually types the URL into the current application, so any modifier keys you hold will change what is being typed. I've configured the macro to fire when the specified hotkey is released, to minimise the chances of this happening. 
  • Toggle Caffeine
    • Very simple, just toggles the state of Caffeine with a hotkey.

0

Thoughts on a modular Mac Pro

Posted on Monday, 10 June 2013

There have been some rumours recently that the next iteration of the Mac Pro is going to be modular, but we have had very little information about how this modularity might be expressed.

In some ways the current Mac Pro is already quite modular - at least compared to every other Mac/MacBook. You have easy access to lots of RAM slots, you have multiple standards-compliant disk bays, PCI slots and CPU sockets.

This affords the machine an extremely atypical level of upgradeability and expandability, for a Mac. Normal levels for a PC though.

Even with that modularity in mind, the machine itself is fairly monolithic - if you do need more than 4 disk drives, or more PCI cards than it can take, you have limited or no expansion options. You could burn a PCI slot for a hardware disk controller and attach some disks to it externally, but you are quickly descending into an exploding mess of power supplies, cables and cooling fans.

If Apple decides to proceed along that route, the easiest and most obvious answer is that they slim down the main Pro itself and decree that all expansion shall take place over Thunderbolt (currently 10Gb/s bidirectional, but moving to 20Gb/s bidirectional later this year when the Thunderbolt 2 Falcon Ridge controllers launch). This is a reasonable option, but even though Thunderbolt is essentially an external PCI-Express bus, its available bandwidth is considerably lower than the peak levels found on an internal PCI-E bus (currently around 125Gb/s).

A much better option, it would seem to me, would be to be able to go radically modular and expand the Mac itself, but how could that be possible? How can you just snap on some more PCI slots if you want those, or some more disks if that's what you need?

I will say at this point that I have absolutely no concrete information and I am not an electronic engineer, so what you read below is poorly informed speculation and should be treated as that :)

I think the answer is Intel's QuickPath Interconnect (QPI), a high bandwidth (over 200GB/s), low latency point-to-point communication bus for connecting the main components of an Intel based computer.

If you have any Intel CPU since around 2009, you probably have a QPI bus being used in your computer. Looking at the latest iteration of their CPUs, QPI is always present - on the uniprocessor CPUs it is used on the chip package to connect the CPU core to the elements of the northbridge that have migrated into the CPU package (such as the PCI-Express controller), however, on these chips the QPI bus is not presented externally.

On the multiprocessor-capable chips, it is, and is the normal way to interconnect the CPUs themselves, but it can be used for other point-to-point links, such as additional north bridges providing PCI-Express busses.

So you could buy a central module from Apple that contains 1, 2 or 4 CPUs (assuming Ivy Bridge Xeons) and all of the associated RAM slots, with maybe two minimal disk bays for the core OS to boot from, and a few USB3.0 and Thunderbolt ports. For the very lightest of users, this would likely be a complete computer - you have some disk, some RAM, CPUs and assuming the Xeons carry integrated GPUs, the Thunderbolt ports can output video. It would not be much of a workstation, but it would essentially be a beefed up Mac Mini.

I would then envision two kinds of modules that would stack on to the central module. The simplest kind would be something like a module with a disk controller chip and a load of disk bays and, not needing the raw power of QPI, this would simply connect to the existing PCI-Express bus of the main module.

There would clearly be a limit to how many of these modules you could connect, since there are a limited number of PCI-E lanes provided by any one controller (typically around 40 lanes on current chipsets), but with the second type of module, you could then take the expansion up a considerable number of notches.

That second kind would have a large and dense connector that is a QPI. These modules could then attach whatever they wanted to the system - more CPUs (up to whatever maximum is supported by that generation of Xeon - likely 8 in Ivy Bridge), or very very powerful IO modules. My current working example of this is a module that is tasked with capturing multiple 4K video streams to disk simultaneously.
This module would provide its own PCI-Express controller (linked back to the main module over QPI), internally connected to a number of video capture chips/cards and to one or more disk controller chips/cards which would connect to a number of disk bays. It sounds a lot like what would happen inside a normal PC, just without the CPU/RAM and that's because it's exactly that.
This would allow for all of the video capture to be happening within the module. It would be controlled as normal from the software running in the main module, which would be issuing the same instructions as if the capture hardware was on the main system PCI-E bus, causing the capture cards to use DMA to write their raw video directly to the disk controller exactly as if they were on the main system PCI-E bus. The difference would be that there would be no other hardware on the PCI-E bus, so you would be able to make reasonable promises around latency and bandwidth, knowing that no user is going to have a crazy extra set of cards in PCI slots, competing for bandwidth. Even if you have two of these modules capturing a really silly amount of video simultaneously. It's a model for being able to do vast amounts of IO in parallel in a single computer.

There would almost certainly need to be a fairly low limit on the number of QPI modules that could attach to the system, but being able to snap on even two or three modules would elevate the maximum capabilities of the Pro to levels far beyond almost any other desktop workstation.

As a prospective owner of the new Mac Pro, my two reasonable fears from this are:

  • They go for the Thunderbolt-only route and my desk looks like an awful, noisy mess
  • They go for the radical modularity and I can't afford even the core module
(While I'm throwing around random predictions, I might as well shoot for a name for the radical modularity model. I would stick with the Lightning/Thunderbolt IO names and call it Super Cell)

Edit: I'd like to credit Thomas Hurst for helping to shape some of my thinking about QPI.

2

Alfred 2 clipboard history

Posted on Tuesday, 30 April 2013

The toweringly awesome Alfred 2 app for OS X has a great clipboard history browser. This is how I suggest you configure and use it:


  • Map a hotkey to the viewer (I suggest making it something involving the letter V, since Cmd-V is a normal Paste. I use Cmd-Shift-Option-Ctrl V because I have my Caps Lock key mapped to Cmd-Shift-Option-Ctrl)
  • Turn off the option to show snippets at the top of the Clipboard History, because snippets are a whole different thing and not relevant to pasting history
  • Turn on the option to auto-paste when you hit Enter on a given item
With these options all configured, all you have to do is hit the hotkey, select the old clipboard item you want and hit Enter. It will then be pasted into the active window.

This is also useful to preview the current contents of the clipboard before pasting (which is always a good idea if you're pasting into a sensitive terminal or a work IRC channel and want to avoid spamming some random/harmful nonsense in).

0

Using Caps Lock as a new modifier key in OS X

Posted on Tuesday, 27 November 2012

I've started using Slate for window management in OS X. It's lovely being able to drive specific operations with the keyboard, but what's not lovely is trying to find a spare keyboard shortcut that doesn't need lots of fingers and doesn't clash with another app.

Taking inspiration from this article and the article it took inspiration from, I've taken to mapping Caps Lock to Shift+Ctrl+Option+Command, which is such a crazy set of modifiers that no app would ever have a default keyboard shortcut based on it. That means I get a single key which acts like all four normal modifier keys combined, so I get a whole blank keyboard of shortcuts all to myself!

The specifics of how I did this:

  1. Open System Preferences, then Keyboard, then Modifier Keys
  2. For each keyboard listed, set Caps Lock to No Action
  3. Install KeyRemap4MacBook and PCKeyboardHack, then restart your Mac
  4. Open System Preferences, then PCKeyboardHack
  5. Tick Change Caps Lock and set the keycode it sends, to 80 (which is really F19. If you have a keyboard which has a real F19 key, you need to change this to a different key you don't have)
  6. Go back to the main System Preferences page (click Show All, or re-open System Preferences) and open KeyRemap4MacBook
  7. Choose the Misc & Uninstall tab and click Open private.xml. This will give you a Finder window with a private.xml visible
  8. Right click private.xml and choose Open With then TextEdit.app
  9. Paste the following between the <root> and </root> tags:
    <item>
        <name>Remap F19 to Hyper</name>
        <appendix>OS X doesn't have a Hyper. This maps F19 to Control + Shift + Option + Command.</appendix>

        <identifier>usercustom.f19_to_hyper</identifier>

        <autogen>
            --KeyToKey--
            KeyCode::F19,

            KeyCode::COMMAND_L,
            ModifierFlag::OPTION_L | ModifierFlag::SHIFT_L | ModifierFlag::CONTROL_L
        </autogen>
    </item>
  10. Save and Quit the private.xml window, close the Finder window
  11. Back in the KeyRemap4MacBook preferences, switch to the Change Key tab and click ReloadXML
  12. You should now see Remap F19 to Hyper at the top of the list. Tick it.
  13. At this point you should be done, but we can easily test to make sure...
  14. Switch to the Misc & Uninstall tab in the KeyRemap4MacBook preferences and Launch EventViewer
  15. Press your Caps Lock key and you should see a series of events appear, each of which adds/removes one of the Shift/Ctrl/Option/Command keys. The middle row should have Shift Ctrl Opt Cmd in the flags column. If you see that, you are done!
  16. Configure lots of shiny new Hyper shortcuts in Slate or whatever other app you like!