This config solves the problem
local wf = hs.window.filter
-- print primary screen id
screen_id = hs.screen.primaryScreen():id()
print(screen_id)
filter = wf.new():setCurrentSpace(true):setDefaultFilter{}:setScreens(screen_id)
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)
-- Bind option + number keys to switch spaces
for i = 1, 6 do
hs.hotkey.bind('alt', tostring(i), function()
hs.spaces.gotoSpace(i+2)
end)
end
print(hs.spaces.allSpaces())