-
Notifications
You must be signed in to change notification settings - Fork 591
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hs.spaces.moveWindowToSpace does not work on macOS 15.0 Sequoia #3698
Comments
It does, if that happens to be the number of the current space. Otherwise it should output On x86 Sonoma 14.7: Using What OS version are you on? |
I can replicate the issue on my OS Logs are,
|
I am currently on 15.0.1 Sequoia but the issue happens since 15.0 (as per the title). Sorry if my logs weren't clear enough. Regardless of whether I was moving it to the current space or not, it will always return
|
I can confirm the same behavior, it is always returning true, still nothing happens. It started after upgrading to Sequoia.
|
They discussed here already. It seems like there's no good option to make it work |
@marcelja Thanks for bringing this to my attention! The comment here #3636 (comment) seems to have done the trick for me. |
I tried to modify provided script to suit my needs, namely moving unfocused window to current space, hack is not sufficient for this behavior, for me it's still open issue. |
I've tried everything as inspired by code here and was unable to make it work. my original config reads
the logs reads
could not figure out what was wrong, it logs everything as expected. any comment is appreciated. |
I was having the same issue. But the API started working again once I did the following
It would be nice if there was a way to do this programmatically. |
@niknbr I have only (Assing To) All Desktops, which does not help, any chance you know why there is such difference? |
@krykra7 My bad. It is "All Desktops". If it helps here is the reference to the function I use it with function moveWindowToCurrentScreen(appName)
local app = hs.application.get(appName)
local window = app:mainWindow()
-- Set window frame when moved to different monitor
local mainScreen = hs.screen.mainScreen()
local mainScreenFrame = mainScreen:frame()
window:setFrame(mainScreenFrame)
-- Move window
local currentSpace = hs.spaces.focusedSpace()
hs.spaces.moveWindowToSpace(window, currentSpace) -- Started working after setting it to "All Desktops"
window:focus()
end
|
@niknbr isn't the whole point of the "Assign to All desktops" command to have all windows of this app always visible in every space? And why someone would want to move them around if they are appearing on every desktop anyway? |
This is frustrating. I've tried the following work-arounds without success:
Both these actions work when performed manually with the mouse and keyboard. They fail when automated with HammerSpoon. |
My main purpose of using hammerspoon was to summon, hide and show terminal in any space and any screen which stopped working with broken hs.spaces.windowSpaces(). After many attempts with provided tips I finally had to switch to yabai + hammerspoon (with ipc module) for achieving my goal. If somebody is interested in such solution just let me know and I will provide my scripts. |
@krykra7 I would like to know you achieved this. |
@tomasz-grabowski-netbulls Sure, you would need yabai, ipc module enabled in hammerspoon, jq and software for handling shortcuts. For shortcuts hammerspoon is fine but I found that require("hs.ipc")
hs.ipc.cliInstall("/opt/homebrew/") -- this is important for remotely calling hammerspoon
hs.hotkey.bind({ "ctrl" }, "F12", function()
-- execute script that handles terminal with yabai
local output, status, type = hs.execute("/script/location/dropdown.sh")
end)
-- This worked before macOS 15.0 Sequoia, just as reference
-- hs.hotkey.bind({ "ctrl" }, "F12", function()
-- local appName = "kitty"
-- local app = hs.application.get(appName)
-- local currentSpace = hs.spaces.focusedSpace()
--
-- if app then
-- hs.spaces.moveWindowToSpace(app:mainWindow(), currentSpace)
-- if not app:mainWindow() then
-- app:selectMenuItem({ appName, "New OS window" })
-- elseif app:isFrontmost() then
-- app:hide()
-- else
-- app:activate()
-- end
-- else
-- hs.application.launchOrFocus(appName)
-- end
-- end)
#!/usr/bin/env bash
yabai="/opt/homebrew/bin/yabai"
hs="/opt/homebrew/bin/hs"
app="kitty"
while getopts "a:" opt; do
case $opt in
a)
app="$OPTARG"
;;
*)
echo "Invalid option."
;;
esac
done
current_space=$($yabai -m query --spaces --space | jq '.index')
current_focused_window=$($yabai -m query --windows --window | jq '.id')
app_window=$($yabai -m query --windows | jq ".[] | select(.app == \"$app\") | .id")
app_space=$($yabai -m query --windows | jq ".[] | select(.app == \"$app\") | .space")
# Handle app is not running yet
if [ -z "$app_window" ]; then
open -a "$app"
while [ -z "$app_window"]; do
app_window=$(yabai -m query --windows | jq ".[] | select(.app == \"$app\") | .id")
done
yabai -m window --focus "$app_window"
exit 0
fi
if [ "$current_space" == "$app_space" ]; then
if [ "$current_focused_window" == "$app_window" ]; then
$hs -c "hs.application.get(\"$app\"):hide()"
else
$yabai -m window --focus "$app_window"
fi
else
$yabai -m window $app_window --space $current_space
$yabai -m window --focus "$app_window"
fi I'm using hammerspoon only for hiding app here, because yabai only support minimizing which starts animation and it seems the easier way than using osascript or other tricks. |
I figured out the issue with dragging windows to spaces in Mission Control. I didn't realize that Mission Control was a full screen application and that the windows were buttons with screen shots for images, not application windows. Here's a replacement for Use it like:
There's a few limitations listed in the README. The main one is that I use the window title to find the window button in Mission Control. If anyone knows how to set a window title to a unique string, or can think of another way to mark a window so it can be found in Mission Control, then this utility can be a lot more robust. |
Also stuck with this issue, but because my needs are very minimal, I manually wrote two functions as a temporary workaround. I’m sharing them here in case they might inspire someone else.
|
It simply returns
true
without actually moving the window.The text was updated successfully, but these errors were encountered: