
#HAMMERSPOON WINDOW SWITCHER PDF#
Pressing hyper in combination with the left home row jumps directly between my most frequently used apps (Chrome, Sublime, iTerm2, Mail, Path Finder) and a pair of keys that mark a certain window and focus it, for all the other apps I use occasionally like PDF readers when writing LaTeX. I have a custom modifier key on my keyboard that is dedicated to window management I call hyper. I love being able to customize my window management shortcuts perfectly for the kind of things I normally do. Just goes to show the variety of user interface scripting tasks Hammerspoon can do. It’s one of my zanier uses of Hammerspoon but it is nice to use nonetheless. Previously I had to contort my hand into a cramped position on my chest to scroll with the trackpad while lying on my back. Personally I use this module to scroll pages hands-free while lying down on the couch with my laptop. It is based off some low-latency high-accuracy mouth noise recognizers I wrote during my research term at the UWaterloo HCI lab. Most recently I contributed a module for recognizing mouth noises. It uses Hammerspoon’s various powerful built-in modules including the drawing module, the app watcher module, and the window listener module. This module was very different to write since it was pure Lua.
#HAMMERSPOON WINDOW SWITCHER WINDOWS#
I later repurposed it to switch between Sublime Windows for the same reason when I switched back to Sublime Text. This module allowed me to wrangle Emacs windows to more easily switch between different projects. This was originally motivated by my switching to Spacemacs and it not having a good solution for working on many different projects like Vim tabs. The tabs sit in the top right of the title bar and allow you to easily switch between windows of an app with keyboard shortcuts (e.g ctrl+tab number) and later by clicking.

The second Hammerspoon module I wrote was one that allows you to add tabs to any OSX Application. It didn’t take much time, and is very enjoyable to use, and because the module was added to the core Hammerspoon distribution, lots of other people can also benefit from it.

The module was written mostly in a single evening as a native Lua module (originally for Mjolnir, the precursor to Hammerspoon). They allow you to switch to any window with only two keystrokes: One shortcut to bring up icons and letters for every window, and then simply hitting the key corresponding to the window you want. The first Hammerspoon module I wrote was a port of Slate’s window hints, which if you’ve ever used Vimium or Vimperator, are like link hints for windows. This post explores some of the ways I’ve used Hammerspoon to greatly enhance my general OSX-using experience. I think of it more as a general-purpose tool for modifying OSX’s user interface than just a window manager. It’s fully configurable with Lua, has tons of built in modules and it is simple to write your own modules. Hammerspoon gives me most of the power that a fancy Linux tiling window manager and configurable desktop would give me, without having to switch operating systems. switcher_space.ui.Advanced Hackery With The Hammerspoon Window ManagerĪlong with Dash, Sketch and Papers, one of the main reasons I haven’t yet switched to Linux is Hammerspoon. In case it is rather slow, try turning of thumbnails and set the animation duration to 0. Hs.hotkey.bind('alt-shift','tab','Prev window',function()switcher_space:previous()end)Īnd one can happily switch between windows in the current space using alt+ tab and alt+ shift+ tab. Hs.hotkey.bind('alt','tab','Next window',function()switcher_space:next()end) Using hs.window.switcher one just adds (as mentioned in the docs) to the a switcher_space = hs.(hs.():setCurrentSpace(true):setDefaultFilter)

What gives Hammerspoon its power is a set of extensions that expose specific pieces of system functionality, to the user. At its core, Hammerspoon is just a bridge between the operating system and a Lua scripting engine. This is a tool for powerful automation of OS X. Aside, it can do much more than just window switching! I am surprised / shocked that nobody mentioned hammerspoon. See also this question, where I posted the same answer.
