yabai icon indicating copy to clipboard operation
yabai copied to clipboard

Space commands not working with MacOS Sonoma 14.0

Open lsliwaradioluz opened this issue 1 year ago • 17 comments

Hello,

just wanted to ask if anybody noticed space commands stopped working after updating to MacOS Sonoma 14.0. Commands such as

yabai -m space --focus 3 or yabai -m space --create

yield no error but have no effect either. I can see they're somewhat working because when I attempt to switch to the currently active space, yabai informs me that: cannot focus an already focused space..

What I've tried so far is uninstalling and installing yabai, following all of the required configuration steps. But perhaps there is something else I should do after upgrading to Sonoma?

Keep in mind other commands I am using (e.g. yabai -m window --grid 1:2:0:0:1:1) work as expected.

lsliwaradioluz avatar Oct 04 '23 20:10 lsliwaradioluz

I have the same issue. Curiously focusing a space works, when another screen than the one the space belongs to, is in focus when issuing the command

tromars avatar Oct 04 '23 22:10 tromars

@tromars thanks for chiming in.

I myself am not using an additional monitor so it does not work for me at all...

lsliwaradioluz avatar Oct 05 '23 06:10 lsliwaradioluz

Can confirm

Tylopilus avatar Oct 05 '23 16:10 Tylopilus

I have the same issue, yabai also restarts on each failed space command

mgallecom avatar Oct 05 '23 16:10 mgallecom

Same here. no effect at all.

yabai -m window --space next --focus works though.

It moves the current window to the next space and focuses on the next space. weird.

kyuwoo-choi avatar Oct 06 '23 09:10 kyuwoo-choi

I can confirm this as well.

EVENT_HANDLER_APPLICATION_LAUNCHED: osascript (25808) is not observable, subscribing to activationPolicy changes
EVENT_HANDLER_APPLICATION_TERMINATED: osascript (25808) (not observed)
EVENT_HANDLER_APPLICATION_LAUNCHED: osascript (25814) is not observable, subscribing to activationPolicy changes
EVENT_HANDLER_APPLICATION_TERMINATED: osascript (25814) (not observed)
EVENT_HANDLER_APPLICATION_LAUNCHED: osascript (25820) is not observable, subscribing to activationPolicy changes
EVENT_HANDLER_APPLICATION_LAUNCHED: osascript (25826) is not observable, subscribing to activationPolicy changes
... (same output as above with different ids)
EVENT_HANDLER_APPLICATION_LAUNCHED: osascript (25842) is not observable, subscribing to activationPolicy changes
EVENT_HANDLER_APPLICATION_TERMINATED: osascript (25842) (not observed)
EVENT_HANDLER_APPLICATION_LAUNCHED: osascript (25852) is not observable, subscribing to activationPolicy changes
EVENT_HANDLER_APPLICATION_LAUNCHED: osascript (25847) is not observable, subscribing to activationPolicy changes
EVENT_HANDLER_APPLICATION_TERMINATED: osascript (25847) (not observed)
EVENT_HANDLER_APPLICATION_TERMINATED: osascript (25852) (not observed)
EVENT_HANDLER_APPLICATION_LAUNCHED: osascript (25858) is not observable, subscribing to activationPolicy changes
EVENT_HANDLER_APPLICATION_TERMINATED: osascript (25858) (not observed)
EVENT_HANDLER_APPLICATION_LAUNCHED: osascript (25863) is not observable, subscribing to activationPolicy changes
EVENT_HANDLER_APPLICATION_TERMINATED: osascript (25863) (not observed)
EVENT_HANDLER_APPLICATION_LAUNCHED: osascript (25864) is not observable, subscribing to activationPolicy changes
EVENT_HANDLER_APPLICATION_TERMINATED: osascript (25864) (not observed)
EVENT_HANDLER_WINDOW_TITLE_CHANGED: kitty 378
EVENT_HANDLER_WINDOW_TITLE_CHANGED: kitty 378
EVENT_HANDLER_DAEMON_MESSAGE: space --focus 3
EVENT_HANDLER_WINDOW_TITLE_CHANGED: kitty 378
event_signal_flush: transmitting window_title_changed to 1 subscriber(s)
EVENT_HANDLER_WINDOW_TITLE_CHANGED: kitty 378
EVENT_HANDLER_WINDOW_TITLE_CHANGED: kitty 378
event_signal_flush: transmitting window_title_changed to 1 subscriber(s)
EVENT_HANDLER_WINDOW_TITLE_CHANGED: kitty 378
EVENT_HANDLER_WINDOW_TITLE_CHANGED: kitty 378
EVENT_HANDLER_DAEMON_MESSAGE: query --windows --window
EVENT_HANDLER_DAEMON_MESSAGE: query --windows --window
EVENT_HANDLER_DAEMON_MESSAGE: query --windows --window
EVENT_HANDLER_DAEMON_MESSAGE: query --windows --window

This is the debug output when running yabai -m space --focus 3. Is the osascript log line relevant here?

Ridhamz-nd avatar Oct 06 '23 16:10 Ridhamz-nd

I can also confirm:

$ yabai -m space --focus 4
cannot focus space due to an error with the scripting-addition.
$ yabai --version
yabai-v5.0.9

githubuser88442 avatar Oct 06 '23 21:10 githubuser88442

Likewise, issue with spaces and overal rendering.

Thevetat avatar Oct 09 '23 15:10 Thevetat

This was initially broken for me on Sonoma 14.0, I was able to resolve this by:

  • Re-Ran sudo nvram boot-args=-arm64e_preview_abi
  • Restart
  • Updated Yabai to v5.0.9 via homebrew brew upgrade koekeishiya/formulae/yabai
  • Individually added Yabai to privacy settings: Screen Recording & Accessibility

I don't know the exact step that resulted in the fix here, I assume it may be permissions related.

Confirming I am now able to:

  • ✅ Create new spaces viayabai -m space --create
  • ✅ Focus via yabai -m space --focus next

karsonenns avatar Oct 09 '23 16:10 karsonenns

@karsonenns your steps worked for me. Thanks! :)

Ridhamz-nd avatar Oct 09 '23 17:10 Ridhamz-nd

Can confirm, karsonenns steps + rerunning the scripting-addition setup (new hash for the upgrade) got my spaces working again. Thanks a bunch yall.

Thevetat avatar Oct 09 '23 18:10 Thevetat

I have same problem, had tried @karsonenns steps but still not working.

vietvudanh avatar Oct 10 '23 09:10 vietvudanh

Upgrade and try to config "scripting-addition" again: https://github.com/koekeishiya/yabai/wiki/Installing-yabai-(latest-release)#configure-scripting-addition I got "cannot focus space due to an error with the scripting-addition" info. Now it worked.

lekifier avatar Oct 11 '23 02:10 lekifier

I created a script to do this, you need to do this each time you update yabai because the hash of the program has changed.

Make sure to put your username in the script

#!/bin/bash

# Get the SHA-256 hash of the yabai program
YABAI_PATH=$(which yabai)
if [ -z "$YABAI_PATH" ]; then
    echo "yabai not found!"
    exit 1
fi
HASH=$(shasum -a 256 "$YABAI_PATH" | awk '{print $1}')

# Check if HASH is non-empty
if [ -z "$HASH" ]; then
    echo "Failed to get hash for yabai!"
    exit 1
fi

# Construct the new sudoers entry
SUDOERS_ENTRY="{your_username} ALL=(root) NOPASSWD: sha256:$HASH $YABAI_PATH --load-sa"

# Write the entry to /private/etc/sudoers.d/yabai
echo "$SUDOERS_ENTRY" | sudo tee /private/etc/sudoers.d/yabai > /dev/null

# Set the appropriate permissions for the sudoers file
sudo chmod 0440 /private/etc/sudoers.d/yabai

echo "Updated /private/etc/sudoers.d/yabai successfully!"

kabeersvohra avatar Oct 16 '23 18:10 kabeersvohra

@kabeersvohra's script worked for me! I also had to run yabai --restart-service afterwards for the changes to reflect as well!

githubuser88442 avatar Oct 16 '23 21:10 githubuser88442

@kabeersvohra you can use id -un or whoami to get the current username.

windowsrefund avatar Jan 12 '24 16:01 windowsrefund

Upgrade and try to config "scripting-addition" again: https://github.com/koekeishiya/yabai/wiki/Installing-yabai-(latest-release)#configure-scripting-addition I got "cannot focus space due to an error with the scripting-addition" info. Now it worked.

I updated and reconfigured the sudoers file, and now I'm able to switch spaces without any issues.

CassandraCat avatar Jan 26 '24 15:01 CassandraCat