Hammerspoon Workflow

An Alfred Workflow

Short Description

Control you desktop with Hammerspoon.

Last Updated

08 Jun 2015


Mountain Lion
Snow Leopard
Yes Yes No No No



Bundle ID



Hammerspoon Workflow

This is a direct port of my Mjolnir Workflow.

This workflow is for running scripts using Hammerspoon to control your windows. This is just a sample of the things that can be done. Follow this layout and you can do many neat things with Hammerspoon.

First off, download Hammerspoon from https://github.com/Hammerspoon/hammerspoon/releases/latest. Once installed, reload Hammerspoon and run the "hs:install" to set the configuration file this workflow expects. After that, everything should just work.


Configure Hammerspoon with the configuration file that this workflow needs. The original is backed up into the users home directory as hs.orig.


This will upgrade the installation instead of writing over the users code. This will work properly for all releases higher than 1.4.


This tells Hammerspoon to reload the configuration file.


This opens the Hammerspoon console to the foreground.


This nudges the current window up.


This nudges the current window down.


This nudges the current window to the left.


This nudges the current window to the right.


This toggles system caffenate. If the AnyBar workflow and program is installed properly, a caffienate status bar is now available. It shows greyed "zzz" when caffienate is disabled and red "zzz" if enabled.


This moves the current window to the left 1/3 of the screen.


This moves the current window to the right 2/3 of the screen.


This moves the current window to the left half of the screen.


This moves the current window to the right half of the screen.


This snaps the current window to the closes grid box area.


This requires you to put the x, y for a starting position in a 3x3 matrix for the current window. Then you give the width and height. Therefore, to move the current window to the upper left most block in a 3x3 matric, you would do "hs:setgrid 0, 0, 1, 1". There is also a hotkey set to this value as an example.


Type in a command string and it will be sent to Hammerspoon directly!

There is also an external trigger HammerspoonCommand that will pass whatever is sent in the trigger to Hammerspoon using the command processor as in "hs:command". This gives other workflows or scripts the ability to interact with Hammerspoon through Alfred.


This will list all applications. When an application is selected, it will show all of it's windows in a matrix on the screen and ask the user for the coordinates of the one to show. It will then put all the windows back to their original position and bring the one selected to the foreground. If the application has only one window, it will simply bring it to the front.

I also created a hotkey for doing Expose on FoldingText. The user can create more in the same manner. Just be careful to get the name of the application correct!


This command undoes the very last window move. This assumes all window movements were done with Hammerspoon and this workflow functions.

This workflow is also set up with a Remote page as well. Have fun controlling your windows from your iPad or iPhone.