Skip to content

Instantly share code, notes, and snippets.

@zhuowei
Last active October 22, 2021 17:15
Show Gist options
  • Save zhuowei/92b106f9484d005d8263929a269180d3 to your computer and use it in GitHub Desktop.
Save zhuowei/92b106f9484d005d8263929a269180d3 to your computer and use it in GitHub Desktop.
Restores old tab bar in Safari 15.0 (16612.1.29.41.4, 16612)
// Restores old tab bar in Safari 15.0 (16612.1.29.41.4, 16612)
// clang -fmodules -shared -Wall -Os -o libsafariinject.dylib safariinject.m
//
// If SIP off:
// DYLD_INSERT_LIBRARIES=$PWD/libsafariinject.dylib /Applications/Safari.app/Contents/MacOS/Safari
//
// If SIP on, you can demo this by manually removing Safari's code signing signature, but many
// features (eg saved logins) won't be readable by the resigned app:
// cp -a /Applications/Safari.app ./
// codesign --remove Safari.app/Contents/MacOS/Safari
// DYLD_INSERT_LIBRARIES=$PWD/libsafariinject.dylib ./Safari.app/Contents/MacOS/Safari
@import Darwin;
@import Foundation;
@import ObjectiveC;
@interface FeatureAvailability
+ (bool)isUnifiedBarEnabled;
@end
static bool wdb_FeatureAvailability_isUnifiedBarEnabled_hook(id self, SEL selector) {
return false;
}
__attribute__((constructor)) void wdb_hook_init() {
Method method = class_getClassMethod(NSClassFromString(@"FeatureAvailability"),
@selector(isUnifiedBarEnabled));
if (!method) {
abort();
}
method_setImplementation(method, (IMP)&wdb_FeatureAvailability_isUnifiedBarEnabled_hook);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment