While switching windows with keyboard on MacOS, the default CMD+TAB command shows all the active windows. I use hammerspoon to switch only between windows on a single desktop.
This is the script I use for achieving that.
local wf = hs.window.filter filter = wf.new():setCurrentSpace(true):setDefaultFilter{} switcher_space = hs.window.switcher.new(filter) hs.window.switcher.ui.showThumbnails = false hs.window.switcher.ui.showSelectedThumbnail = false hs.hotkey.bind('alt', 'tab', 'Next window', function() switcher_space:next() hs.alert.closeAll() end) hs.hotkey.bind('alt-shift', 'tab', 'Prev window', function() switcher_space:previous() hs.alert.closeAll() end) Similar to what we have in the documentation.
This is working fine for a single monitor. But when I connect one more monitor the switcher_space has windows on the active desktop with the windows on desktop on the other monitor. I would like to see only the windows from the active monitor (currently focused).
While reading the documentation I found that I have to use setScreens method on window filter. But using it like this
screen_id = hs.screen.primaryScreen():id() filter = wf.new():setScreens(screen_id):setCurrentSpace(true):setDefaultFilter{} throws
invalid key in filter table: _allowedScreens