Hammerspoon / hammerspoon

Staggeringly powerful macOS desktop automation with Lua
http://www.hammerspoon.org
MIT License
12.15k stars 587 forks source link

Problem with hs.spaces.moveWindowToSpace in 1.0.0 #3666

Open hououinkami opened 3 months ago

hououinkami commented 3 months ago

Hi! After I upgraded hammerspoon to 1.0.0, the function hs.spaces.moveWindowToSpace stopped working for all windows except for the Hammerspoon console. My macOS version is Monterey 12.7.6, the sample code just like this: local currentWin = hs.window.focusedWindow() hs.spaces.moveWindowToSpace(currentWin, 9) Thanks!

jottr commented 3 months ago

I'm having the same issue. This used to work, and now, instead of moving the application window to the currently focused space, it activates the space with the application on it.

Hammerspoon 1.0.0

ProductName:        macOS # Sonoma
ProductVersion:     14.5
BuildVersion:       23F79
local spaces = require('hs.spaces')
local application = require('hs.application'

hs.hotkey.bind('ctrl', 'space', function()
  local app = hs.application.get('wezterm')
  print(app)
  if not app then
    application.launchOrFocus('wezterm')
  elseif app:isFrontmost() then
    app:hide()
  else
    local currentSpace = spaces.focusedSpace()
    print(currentSpace)
    spaces.moveWindowToSpace(app:mainWindow(), currentSpace)
  end
end

I see that @asmagill tried to fix this functionality on Sonoma. It also seems this ticket is basically a duplicate of https://github.com/Hammerspoon/hammerspoon/issues/3636. Not sure if the referenced ticket should be reopened or conversation should continue here @cmsj.

hitzhangjie commented 1 month ago

I'm having the same problem.