After having discovered the extremely powerful Hammerspoon app, and finally landing on a configuration that I am very happy with, I thought I should share it with others to enjoy. I've tried to comment init.lua
to make it easier to understand.
I use this config together with some Karabiner remapping to achieve a fast and usable config with a short learning curve.
- Reload on Save
- Hyper Key
- Additional hotkeys to switch spaces
- Window Switcher menu
- Quick per-application window switcher (Across spaces!)
- Rounded screen corners
- MiroWindowManager with reduced animation times
- Drag to resize and move windows
- App launcher
- Sky Rocket Spoon
- KSheet Spoon
Hyper is what people like to call a special shortcut comprised of multiple modifier keys. In this case the hyper key is the following:
Hyper = ctrl+alt+cmd
I've used Karabiner and the default mac hotkey settings to remap the useless capslock key into something extremely powerful. If you tap capslock, it triggers “f19” which I have remapped to open Raycast. Hold it and it acts like the hyper modifier. You can find the Karabiner config for that here. Perfect.
I use Hyper + <key>
to either launch or switch to certain applications. This is easily configured in the init.lua file so feel free to modify it for your own use.
examples:
- Hyper+V = Launch or switch to Vivaldi
- Hyper+S = Launch or switch to Slack
- Hyper+C = Launch or switch to Calendar
- Hyper+E = Launch or switch to Excel ... you get the idea
Many other configs online have similar features, but what is unique about this config is that if the app is already focused and you hit the key combination again, focus will cycle through the open windows of the current application. This works across spaces, and is really great when you have a bunch of windows open at the same time.
Thanks to the help of dmgerman who's code allowed me to implement my app switcher, I've also maintained his app switcher menu.
- alt+b opens a switcher dialogue for all open windows
- alt+shift+b opens a switcher dialogue for all open windows for the current app
- hyper+tab switches to the last focused window
- I’ve also remapped right ctrl+right/left to switch spaces left and right.
- hyper+home brings up Mission Control, but with the spaces visible automatically. This is buggy, but seems to work good enough.
- hyper+1/2/3 sets the current window to take up left quarter, center half and right quarter respectively.
- hyper+escape Centers the window on the screen
- Animations speeds are set to zero.
MiroWindowsManager is a great spoon to maneuver windows in a convenient fashion. Maybe one day I will graduate to a tiling window manger, but for now dragging a window to the sides will make it take up that half of the screen. Dragging to the top makes it take up the whole screen.
MiroWindowsManager also has some hotkeys mapped to it. I use the following:
- Hyper+up = Resize the window to take up the top half of the screen
- Hyper+down = Resize the window to take up the bottom half of the screen
- Hyper+right = Resize the window to take up the right half of the screen
- Hyper+left = Resize the window to take up the left half of the screen
- Hyper+f = Resize the window to take up the whole screen
Tapping the respective keys again does extra things, best to head to MiroWindowsManager page to learn more. I have modified the code slightly to still get square windows, despite my widescreen display.
The Skyrocket Spoon allows to resize and move windows conveniently without having to grab a window by the corner of window decoration.
In my config:
- ctrl+shift allows you to move a window with the mouse
- alt+shift allows you to resize a window with the mouse.
Ksheet Shows the current shortcuts for the active application. I have modified it for dark mode. It is toggled on and off with hyper+home.
Just the RoundedCorners Spoon. I think it looks nice. feel free to disable to get those pixels back. Might cause burn in if you have an OLED panel, so be careful.
- Install Hammerspoon
- copy the contents of this repo into you
~/.hammerspoon
folder - Reload the config
Next, open up the settings app > keyboard > Shortcuts, and then remap spotlight by clicking the current shortcut and tapping capslock. If you prefer Alfred or Raycast, remap that in the app settings instead.