/hs_select_window.spoon

Spoon to select any window for Hammerspoon

Primary LanguageLua

Table of contents

Purpose:

  • jump to any window by selecting part of its name or its application
  • windows are listed in the order they have been active (from most recent)
  • each window is listed by window title and application name
  • supports incremental search

Example

./screenshot.png

type ema

and you get

./screenshot-3.png

type return and you are sent to the top window

How to install

I assume you have installed hammerspoon and you have a ~/.hammerspoon/init.lua file

The easiest way is to clone this repository inside your .hammerspoon directory:

cd ~/.hammerspoon/Spoons
git clone https://github.com/dmgerman/hs_select_window.spoon.git

This should create a directory called ~/.hammerspoon/Spoons/hs_select_window.spoon with an init.lua file inside

Then modify your ~/.hammerspoon/init.lua file and add the following:

hs.loadSpoon("hs_select_window")

-- customize bindings to your preference
local SWbindings = {
   all_windows =  { {"alt"}, "b"},
   app_windows =  { {"alt", "shift"}, "b"}
}   
spoon.hs_select_window:bindHotkeys(SWbindings)

How to use

This spoon binds the keys:

  • option-b: display a list of all windows
  • shift-option-b: display list of windows of the current application

Use either one to select and activate any window.

Note that the current window does not appear in the list of windows.

To be done

  • add functionality to display only windows in the current workspace

Known bugs

  • If you have two different instances of the same application running, the spoon will only track one instance. This is a problem in hammerspoon and the bug has been reported.