Closed dominiklohmann closed 5 years ago
Alright so here's a first version of Dock.app for the beta 1, version 19A471t.
Scripting addition features that are broken:
This seems to be no bigger update to Dock.app than the usual minor update to macOS. All the accessibility API features seem to still work as usual.
Catalyst apps seem to behave really well and are now as responsive as native windows, they feel really good, especially considering it's a first beta.
Can you upload the new Skylight.framework as well? (/System/Library/Privateframeworks/SkyLight.framework
)
Can you upload the new Skylight.framework as well? (
/System/Library/Privateframeworks/SkyLight.framework
)
Here you go: SkyLight.framework.zip
Found a new thing that might be interesting.
Hovering over the green menu bar button now shows three options (these were all available before, but the popup is new):
But if you hold down alt while doing so, you get these options. They are animated (no smoother than what fn + rightclick drag does in yabai, so there's no fancy stuff to reverse engineer) and because of their animation they to make windows break free from tiling in yabai.
@dominiklohmann
Thanks for uploading the new version of Dock.app and SkyLight.framework. So far there have not been any changes that will break what we are doing. I have updated the scripting addition with full support for this developer version - as a proof of concept. This will likely be the only time I do so until a public beta becomes available.
Are you positive opacity stopped working, or did you maybe just forget to enable the config setting? The function we use to set alpha looks unchanged in SkyLight. We are calling the CGS equivalent one though, maybe they just stubbed that out?
Can you confirm the following functionality from the master branch once you have the time to do so:
Can you confirm the following functionality from the master branch once you have the time to do so:
This might take a while since I've only got one device right now and I'm definitely not putting a beta 1 build on the only MacBook available to me right now. I blame the local Apple Store for killing my MacBooks display while replacing the keyboard last week, so I had to give it back to them as soon as the replacement display they ordered was available. At least the repair is free this way. 🤷♂
Are you positive opacity stopped working, or did you maybe just forget to enable the config setting?
Pretty sure I enabled it properly, but I'll check again when I'm able to run the beta again. We're on hold for another 9–13 days here I think. Won't matter much though since the public beta won't be available until July so the support requests to get yabai working shouldn't be all that many until then.
I'm running Catalina on a testing setup and found out about yabai (great works as always btw) so I gave it a test drive. First issue I noticed, the check in EVENT_HANDLER_MISSION_CONTROL_CHECK_FOR_EXIT
(looking for Dock) doesn't seem to work here (no dock window) :(
Took a better look and the dock windows are returned, but they are missing the kCGWindowName
key. Strangely the same code from Swift has a kCGWindowName
entry...
Took a better look and the dock windows are returned, but they are missing the kCGWindowName key. Strangely the same code from Swift has a kCGWindowName entry...
This is likely a bug in the developer preview then? If not, as long as we get a window id (kCGWindowNumber
?) we can easily retrieve the title using SLSCopyWindowProperty(cid, wid, CFSTR("kCGSWindowTitle"), &cfstring_title);
I was doing something like this
@@ -888,24 +888,22 @@ static EVENT_CALLBACK(EVENT_HANDLER_MISSION_CONTROL_CHECK_FOR_EXIT)
CFStringRef owner = CFDictionaryGetValue(dictionary, kCGWindowOwnerName);
if (!owner) continue;
-
CFStringRef name = CFDictionaryGetValue(dictionary, kCGWindowName);
- if (!name) continue;
- if (CFEqual(CFSTR_DOCK, owner) && CFEqual(CFSTR_DOCK, name)) {
+ if (CFEqual(CFSTR_DOCK, owner) && (!name || CFEqual(CFSTR_DOCK, name))) {
found = true;
break;
}
}
in the mean time, since the only other dock owned window seems to be the desktop (and that returns a window name), but I'll check later if it return the name the other way.
I tried SLSCopyWindowProperty
and it still doesn't return the name ahah I'm wondering what printing the result from swift does differently
So I'm finally back to having two laptops, so I've just installed beta 2 on my secondary device. Most (all?) of the stuff that requires the scripting addition does not work. Further testing comes later when I've configured all my apps and dotfiles again (which I should really put in a git repo instead of doing this manually every time... ffs past me).
Here's Dock.app and Skylight.framework for beta 2: Dock.zip SkyLight.framework.zip
The dock window check that was reported broken by @choco works on beta 2, tested like this:
yabai -m signal --add event=mission_control_enter \
action="terminal-notifier -message mission_control_enter"
yabai -m signal --add event=mission_control_exit \
action="terminal-notifier -message mission_control_exit"
The notifications fire as expected.
Updated the scripting addition for new version of the developer preview. It would be nice if someone could test all the functionality mentioned in my comment in #13
Just updated (and double checked that I did in fact reinstall sa). I take back my command about mission control check working—the exit fires immediately after the enter, although the enter check works properly.
Onto the other things on the list. It's looking bad so far.
focus a window
yabai -m window --focus ...
has no effect.
focus space
yabai -m space --focus ...
has no effect.
create space
yabai -m space --create
has no effect.
destroy space
yabai -m space --destroy
has no effect.
move space to display
yabai -m space --display ...
has no effect.
I'm positive that the functions are located properly. Does the scripting addition even load - is /tmp/yabai-sa_$USER.socket
created? Do you get any messages in Console
filtered by Dock
when you issue pkill Dock
while yabai is running. Should say something like:
[yabai-sa] (0x10e032000) setFrontWindow found at address 0x10E0895DB (0x575db)
Does the scripting addition even load - is /tmp/yabai-sa_$USER.socket created?
Welp, there's the issue. Didn't even think of checking this. I wonder what went wrong, hopefully it's not locked down too much. SIP is disabled.
@dominiklohmann
TotalSpaces seem to work on Catalina: https://discuss.binaryage.com/t/totalspaces-support-on-macos-10-15-catalina/7253/4
So I don't see why ours would suddenly stop loading, weird.
I'm getting this in console: [yabai-sa] could not locate pointer to dock.spaces! spaces functionality will not work!
The yabai-sa socket is created in /tmp, I checked by deleting it and restarting yabai.
I attached my Dock.app and Skylight.framework (also on Catalina beta 2)
I'm running yabai built from source so let me know if I could add some debug printfs to check why it wouldn't work.
On my end the scripting addition fails to install to /System/Library/ScriptingAdditions, which I'll further investigate now. Really unsure sure what's happening here.
I just downloaded the TotalSpaces trial I referenced above to verify that I did indeed locate the functions correctly. It should be working when installed properly.
@alin23
Make sure to reinstall the scripting addition. Run the following:
make sa
make install
sudo yabai --uninstall-sa
sudo yabai --install-sa
pkill Dock
./bin/yabai -V
Found something: On Catalina, the system is moved to a read-only file system on Macs with a T2 Chip, which is why mkdir
inside of /System fails. This seems like major trouble. There are two APFS containers, and the /System is one is read-only and I fail to see how to make it writable. csrutil status
returns disabled. sudo chmod +w /System/Library/ScriptingAdditions
returns no error but has no effect.
This might be happening because I did a clean install this time around and did not have the osax still installed.
@alin23 Are you sure --install-sa
works for you? Because you might just be using the scripting addition that was still installed from your previous Mojave installation.
I will try some things from the Recovery OS, maybe I can get something to work there.
@dominiklohmann
For what it's worth, on Mojave I can place the scripting addition in /Library/ScriptingAdditions/
and it will load just fine into Dock.app. Note that SIP is still disabled.
Similar to how iOS is configured, macOS is now on a separate partition from user data, which acts as if it is read-only (but in beta 1, it’s merely SIP-protected). In the beta, you’ll see “Macintosh HD” and “Macintosh HD — Data”. Data is a separate volume mounted in /System/Volumes. OS-installed applications live in /System/Applications, but the Finder presents them in /Applications as well. Apple calls the technology “firmlinking”. Beta 2 will be fully read-only by default.
Emphasis mine. ~My goodness, this sounds super bad.~ Did not need to panic, see below.
@koekeishiya For what it's worth, on Mojave I can place the scripting addition in /Library/ScriptingAdditions/ and it will load just fine into Dock.app. Note that SIP is still disabled.
Tried this, it works. Added a diff below that can be applied. The /System one is definitely dead though.
Every single SA feature works now. Did not need to panic. Phew!
diff --git a/src/osax/sa.m b/src/osax/sa.m
index 6729943..674fed5 100644
--- a/src/osax/sa.m
+++ b/src/osax/sa.m
@@ -1,21 +1,21 @@
#include "sa.h"
-#define OSAX_DIR "/System/Library/ScriptingAdditions/yabai.osax"
-#define CONTENTS_DIR "/System/Library/ScriptingAdditions/yabai.osax/Contents"
-#define CONTENTS_MACOS_DIR "/System/Library/ScriptingAdditions/yabai.osax/Contents/MacOS"
-#define RESOURCES_DIR "/System/Library/ScriptingAdditions/yabai.osax/Contents/Resources"
-#define BUNDLE_DIR "/System/Library/ScriptingAdditions/yabai.osax/Contents/Resources/payload.bundle"
-#define BUNDLE_CONTENTS_DIR "/System/Library/ScriptingAdditions/yabai.osax/Contents/Resources/payload.bundle/Contents"
-#define BUNDLE_CONTENTS_MACOS_DIR "/System/Library/ScriptingAdditions/yabai.osax/Contents/Resources/payload.bundle/Contents/MacOS"
+#define OSAX_DIR "/Library/ScriptingAdditions/yabai.osax"
+#define CONTENTS_DIR "/Library/ScriptingAdditions/yabai.osax/Contents"
+#define CONTENTS_MACOS_DIR "/Library/ScriptingAdditions/yabai.osax/Contents/MacOS"
+#define RESOURCES_DIR "/Library/ScriptingAdditions/yabai.osax/Contents/Resources"
+#define BUNDLE_DIR "/Library/ScriptingAdditions/yabai.osax/Contents/Resources/payload.bundle"
+#define BUNDLE_CONTENTS_DIR "/Library/ScriptingAdditions/yabai.osax/Contents/Resources/payload.bundle/Contents"
+#define BUNDLE_CONTENTS_MACOS_DIR "/Library/ScriptingAdditions/yabai.osax/Contents/Resources/payload.bundle/Contents/MacOS"
-#define INFO_PLIST_FILE "/System/Library/ScriptingAdditions/yabai.osax/Contents/Info.plist"
-#define DEFINITION_FILE "/System/Library/ScriptingAdditions/yabai.osax/Contents/Resources/yabai.sdef"
-#define BUNDLE_INFO_PLIST_FILE "/System/Library/ScriptingAdditions/yabai.osax/Contents/Resources/payload.bundle/Contents/Info.plist"
+#define INFO_PLIST_FILE "/Library/ScriptingAdditions/yabai.osax/Contents/Info.plist"
+#define DEFINITION_FILE "/Library/ScriptingAdditions/yabai.osax/Contents/Resources/yabai.sdef"
+#define BUNDLE_INFO_PLIST_FILE "/Library/ScriptingAdditions/yabai.osax/Contents/Resources/payload.bundle/Contents/Info.plist"
-#define BIN_INJECTOR "/System/Library/ScriptingAdditions/yabai.osax/Contents/MacOS/loader"
-#define BIN_CORE "/System/Library/ScriptingAdditions/yabai.osax/Contents/Resources/payload.bundle/Contents/MacOS/payload"
+#define BIN_INJECTOR "/Library/ScriptingAdditions/yabai.osax/Contents/MacOS/loader"
+#define BIN_CORE "/Library/ScriptingAdditions/yabai.osax/Contents/Resources/payload.bundle/Contents/MacOS/payload"
-#define CMD_SA_REMOVE "rm -rf /System/Library/ScriptingAdditions/yabai.osax 2>/dev/null"
+#define CMD_SA_REMOVE "rm -rf /Library/ScriptingAdditions/yabai.osax 2>/dev/null"
static char sa_def[] =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
@@ -125,10 +133,10 @@ static bool scripting_addition_write_file(char *buffer, unsigned int size, char
static void scripting_addition_prepare_binaries(void)
{
- system("chmod +x \"/System/Library/ScriptingAdditions/yabai.osax/Contents/MacOS/loader\"");
- system("chmod +x \"/System/Library/ScriptingAdditions/yabai.osax/Contents/Resources/payload.bundle/Contents/MacOS/payload\"");
- system("codesign -f -s - \"/System/Library/ScriptingAdditions/yabai.osax/Contents/MacOS/loader\" 2>/dev/null");
- system("codesign -f -s - \"/System/Library/ScriptingAdditions/yabai.osax/Contents/Resources/payload.bundle/Contents/MacOS/payload\" 2>/dev/null");
+ system("chmod +x \"/Library/ScriptingAdditions/yabai.osax/Contents/MacOS/loader\"");
+ system("chmod +x \"/Library/ScriptingAdditions/yabai.osax/Contents/Resources/payload.bundle/Contents/MacOS/payload\"");
+ system("codesign -f -s - \"/Library/ScriptingAdditions/yabai.osax/Contents/MacOS/loader\" 2>/dev/null");
+ system("codesign -f -s - \"/Library/ScriptingAdditions/yabai.osax/Contents/Resources/payload.bundle/Contents/MacOS/payload\" 2>/dev/null");
}
bool scripting_addition_is_installed(void)
@dominiklohmann @koekeishiya yep, that was it. Replacing /System/Library/ScriptingAdditions
with /Library/ScriptingAdditions
fixes everything. I didn't notice that /System
is not writable.
@dominiklohmann @koekeishiya yep, that was it. Replacing
/System/Library/ScriptingAdditions
with/Library/ScriptingAdditions
fixes everything. I didn't notice that/System
is not writable.
I believe all system files are being moved to an unwriteable volume (under the security section)
The hover menu on the maximise button can be accessed with keyboard shortcuts if properly configured in System Preferences (see screenshot).
Moving a window left or right, zooming it or reverting to its original position is animated (lags ever so slightly), which makes me wonder if there's some new private API for moving and resizing windows that could be reverse engineered. Or they could just be calling the move/resize functions several times, not sure.
I uploaded a screencast → here.
@dominiklohmann
I assume the code for this is inside the AppKit framework. From what I've seen so far windows on macOS seem to follow the following abstraction:
_CGSWindow (WindowServer's knowledge of a window - essentially is the backing store and "primitive" properties only)
->
NSCGSWindow (Intermediary representation used by the macOS GUI frameworks to bridge a _CGSWindow and NSWindow). I have tested by manipulating a window (owned by my own application) through this interface, and it is sort of weird to see how it all comes together.
->
NSWindow (The window accessible to GUI applications). Responsibility for telling the underlaying representation what its dimensions are, how it expects to be drawn to the screen, event handling and what not happens at this level.
@koekeishiya do you have any idea how to properly transition between 10.14 and 10.15? Some thoughts:
If there are no downsides I really think the transition should be happening as soon as possible. Definitely before the public beta goes live (rumors say pub beta 1 is dev beta 3).
The downside of moving it into /Library
is that people running High Sierra can no longer reactivate SIP. I suppose I need to do some ifdefs to decide the path based on the OS version?
As for Mojave+, I think we should be moving it to /Library
right about.. right now. I'd rather deal with the few issues that may arise now, especially since yabai is not officially released yet.
There is nothing stopping people that are running Mojave from manually running sudo rm -rf /System/Library/ScriptingAdditions/yabai.osax
at any point.
Edit: ifdefs won't work since we are going to provide prebuilt binaries..
Added code to check the current operating system version. If Mojave and newer use /Library/..
and if High Sierra use /System/..
.
If you have previously installed yabai on Mojave, simply do: sudo rm -rf /System/Library/ScriptingAdditions/yabai.osax
and reinstall using sudo yabai --install-sa
.
Might also be a good opportunity to put out word that chunkwm will not run properly on macOS 10.15. Unless you plan to update it, that is.
Might also be a good opportunity to put out word that chunkwm will not run properly on macOS 10.15. Unless you plan to update it, that is.
I've made it explicit that chunkwm only runs on High Sierra and Mojave. I've also made it so that the scripting-addition bundled with chunkwm will not be installable on any macOS version newer than Mojave.
On beta 2 after setting
yabai -m config window_opacity on
yabai -m config active_window_opacity 1.0
yabai -m config normal_window_opacity 0.90
I was left with a blank black screen until removing the lines from my config in safe mode. I'm not sure where to find log files or anything else that could be helpful so if you would like any more information let me know!
I can reproduce the issue with window opacity on beta 2, here's a crash report of WindowServer:
The user space entry to trigger said function in the WindowServer is _SLSSetWindowListAlpha and is unchanged from Mojave 10.14.5 and Catalina Beta 2. This is likely a regression by Apple (it crashes deep inside the WindowServer implementation).
I think a regression here is likely. As I mentioned above, in beta 1 opacity was not working at all, so they're definitely changing something up here.
Public beta is out. There's no new dev beta out so it's probably the same build as beta 2. If you're reading this, do yourself a favour and don't make this your daily driver yet if you use Photos or iCloud Drive.
Dev Beta 3 (Public Beta 2?) is out.
If anyone else has trouble installing, Apple re-released this update a few hours ago. If you already downloaded the old files that were not working on computers with a T2 chip because of a BridgeOS version mismatch, delete them manually in /Library/Updates and download again.
The scripting addition is broken again. Files for reverse engineering are attached below.
updated for macOS Catalina Dev 3.
Another note regarding the read-only system container:
The following works when SIP is disabled to make it writable. Just gotta run it from a LaunchDaemon if you want to modify /System.
sudo mount -uw /
This is not particularly relevant to yabai now that the path is different, but should someone get the old scripting addition stuck from updating to Mojave -> Catalina Dev Beta 1 -> Catalina Dev Beta 2+, this is a way to remove it.
macOS Catalina 10.15 beta 4 (19A512f) is out. It's safe to assume this will be out as public beta 3 tomorrow or so.
This beta required a full reinstall, no diff/upgrade was provided.
Scripting addition checklist: ~Everything works for once!~ Edit: Almost everything works for once!
Here's SkyLight.framework and Dock.app, although you likely don't need them.
What does not work still, however, is the window title. Yabai still only gets empty strings. We might have to go through the AX API here.
Seems like notifications are now disabled by default for some apps. This switch was disabled by default for me after upgrading, with only some apps prompting whether they were allowed to send notifications.
Edit: Speaking of notifications... this needs a version bump.
You should only be seeing that message if the scripting-addition responds that some of it pattern matching has failed.
Edit: If yo run yabai in verbose mode it will log the version and the attributes which can be used to detect which one is failing. Alternatively check the logs printed in console for the Dock when the scripting addition is loaded.
It's space --create
that fails. Erroneously checked only destroy apparently. Updated the above post.
Fixed.
~Nope.~ Fixed it.
@koekeishiya I needed to uninstall manually before installing the SA. Wasn't this changed just recently?
Tested just now, works for me: https://github.com/koekeishiya/yabai/blob/master/src/osax/sa.m#L272
~Wrote down a note to test this again next time the SA is updated.~ Figured the SA issue out. You forgot to bump the version and my update script uses --check-sa
, which is why it did not work as intended.
I have also had this crash a few times now in Catalina, ever since beta 3. Happens very rarely, and I'm not sure what triggers it:
When trying to install I get this message :
==> Installing yabai from koekeishiya/formulae
Error: Your Xcode (10.2.1) is too outdated.
Please update to Xcode 11.0 (or delete it).
Should I actually update to xcode 11 ?
As usual, here's the yearly thread. This first post will always be updated to reflect the current beta situation, and edits will be made clear via strikethrough.
The patch notes can be found here for registered developers: https://developer.apple.com/documentation/macos_release_notes/macos_10_15_beta_release_notes
The SDK diffs are ~not yet available as of writing this, but will likely be~ available in a searchable format here: http://codeworkshop.net/objc-diff/sdkdiffs/macos/10.15/
I'll be installing later today and will be testing, this thread will be continuously updated throughout the betas whenever I find time to test things. Please post questions below and make this issue your thread for all things macOS beta.
Interesting things:
zsh
is now the default shell on macOS 10.15~Edit: on a personal note, I'll be without a second device for a while—the local apple store broke my display while replacing my keyboard last week, causing it to flicker in the lower third. I'm being told the replacement will take ~10–14~ 17–21 days, so bear with me as this thread returns to full activity sometime between June 14th and June 18th.~
As of June 24th, the public beta is out. It's the same build as dev beta 2. If you're reading this, do yourself a favour and don't make this your daily driver yet if you use Photos or iCloud Drive.