This Week's Sponsor:

Winterfest 2024

The Festival of Artisanal Software


Screen Sharing For Alfred Brings VNC To Your Fingertips

Screen Sharing is a feature built into Mac OS X for remotely controlling another computer through the use of virtual network computing (VNC). Apple’s native screen sharing client is buried in the operating system making it nearly impossible to find the app when you actually need it. On top of that, it really lacks basic features like being able to store a connection for future use. Due to these shortcomings, most people turn to third party applications for managing their VNC connections. A quick search in the Mac App Store will turn up some pretty great options including Edovia’s Screens. Although apps like these work extremely well, not everyone wants to spend that much to easily connect to a remote computer. This is why I created the Screen Sharing for Alfred extension. I wanted Alfred to be able to function as my VNC client and really extend the functionality of the Apple’s native Screen Sharing app.

Screen Sharing for Alfred adds the ability to store information about VNC connections and quickly access them with a simple keyboard command. It is written in a beautiful fusion of shell scripting and AppleScript so it is fast, efficient, and capable of interacting with the user through AppleScript’s GUI prompts. It also incorporates David Ferguson’s genius Extension Updater system in case any new features are added in the future. For those unfamiliar with Updater, it is an extension for Alfred that allows developers to make bug fixes and add new features to released extensions – then when users run Updater, it will download the latest version of any extensions that have updates available.

Getting Started

 

Since it is a shell script, you may have to give it permission to run on your computer. This can be done quite easily from the Terminal by changing directories to the Screen Sharing for Alfred folder that was added to your ../Alfred/extensions/scripts/ directory and issuing this command:

chmod +x script.sh

The keyword to trigger this extension is vnc but I am not going to type that before each of the commands I list here. You can also find all of these commands and more by using the vnc help command. Now let’s take a closer look at some of the functionality that this extension provides.

Add - After you install the extension this will be the first command you want to run. Aside from displaying the help window, the extension won’t let you do much until you add some information about a host. You will be prompted by a window asking you to give the host a name. This can be anything you want it to be.

Next you will enter the address of the host. This is the information that is actually used by Screen Sharing.app to connect to the host. This can be an IP address or bonjour hostname as shown below.

Hit OK, and now that host is stored in Alfred for future use. You will also see a nice Growl notification to let you know that the host was successfully added to the list.

Connect - After adding some hosts to the extension, you are going to want to use the connect command to start a Screen Sharing (VNC) session. Type connect, hit Enter and you will be prompted with a nice GUI list of available hosts to choose from. Select one and hit the Connect button (or just double-click on the host name).

The address of your stored VNC host is then passed to OS X’s native Screen Sharing.app and a session is started.

Remove - You may eventually need to remove a host from the list. To do this you can simply type rm or remove, either one will work. You will be prompted with a GUI list of stored items. Select one and hit the Remove button.

Open - Not every VNC session is with a host you want to save so I added the open command for this situation. This command simply opens Screen Sharing.app which allows you to type in a quick address and connect. I may add the ability to pass the address from Alfred as a second variable in the next version.

List - To get a quick view of what hosts are stored in your Screen Sharing extension simply type ls or list and a Growl notification containing your hosts is displayed.

Kill All - Finally, to completely blow out all stored connections and start fresh, I added the killall command. A confirmation prompt will prevent you from erasing them all by accident. You will see a Growl notification to let you know they were successfully removed.

This is quickly becoming my favorite extension because I am using it all the time. I use VNC everyday at home and work so this extension was forged out of necessity which ultimately made it even more awesome. I am really excited to share it with you folks and I hope you’ll find it useful as well. Also, it should go without saying but you do need a PowerPack license for Alfred to use Screen Sharing for Alfred. If you don’t already have one, just head over Alfred’s website and pick one up today. It is worth the price.

Download: Screen Sharing for Alfred

Access Extra Content and Perks

Founded in 2015, Club MacStories has delivered exclusive content every week for nearly a decade.

What started with weekly and monthly email newsletters has blossomed into a family of memberships designed every MacStories fan.

Learn more here and from our Club FAQs.

Club MacStories: Weekly and monthly newsletters via email and the web that are brimming with apps, tips, automation workflows, longform writing, early access to the MacStories Unwind podcast, periodic giveaways, and more;

Club MacStories+: Everything that Club MacStories offers, plus an active Discord community, advanced search and custom RSS features for exploring the Club’s entire back catalog, bonus columns, and dozens of app discounts;

Club Premier: All of the above and AppStories+, an extended version of our flagship podcast that’s delivered early, ad-free, and in high-bitrate audio.