If you craved for launching Terminal commands from your Spotlight search window, today is your lucky day. I also had that wish and dedicated my whole Sunday to master the arcanes of mach_inject, taskgated, self-signed certificates, Hopper disassembler, class-dump, security add-trusted-cert, macinstallerapp, etc. etc. in order to deliver you this nice application (with installer) which will load a bundle into SystemUIServer process and swizzle some methods in order to make our dreams come true 😉
As you can see above, with my plugin Spotlight is now aware that what you’re typing might actually be interpreted as command line input. If you select that possibility, a Terminal window will be launched and execute your query verbatim. For the ping google.com example this is what pops up:
As announced earlier, I have been quite professional with this one and prepared an installer. My main motivation was that it requires a fair amount of modifications before it can inject code into Spotlight, enough to discourage an average user. If you’re interested what’s happening behind the scenes, just open the Installer and look for sample.tar and its content, especially install2.sh which pretty much summarises the installation process.
In any case… unpack, run the installer, enjoy and give feedback!