Skip to content

Instantly share code, notes, and snippets.

@saagarjha
Created November 6, 2021 22:48
Show Gist options
  • Save saagarjha/82dd0b4e4ff3ac5be4ea49d12fcfa204 to your computer and use it in GitHub Desktop.
Save saagarjha/82dd0b4e4ff3ac5be4ea49d12fcfa204 to your computer and use it in GitHub Desktop.
Enable remote connections in Quartz Debug
// If you haven't already, make sure to run this so the window list works:
// defaults write com.apple.QuartzDebug QuartzDebugPrivateInterface -bool YES
// https://gist.github.com/saagarjha/ed701e3369639410b5d5303612964557
#import "swizzler.h"
#import <AppKit/AppKit.h>
static Swizzler<void, id<NSApplicationDelegate>, NSNotification *> QuartzDebug_applicationDidFinishLaunching_ {
NSClassFromString(@"QuartzDebug"), @selector(applicationDidFinishLaunching:), [](auto self, auto notification) {
QuartzDebug_applicationDidFinishLaunching_(self, notification);
auto menuItem = [NSApp.mainMenu insertItemWithTitle:@"" action:nil keyEquivalent:@"" atIndex:3];
menuItem.submenu = [[NSMenu alloc] initWithTitle:@"Connect"];
menuItem.submenu.itemArray = @[
[[NSMenuItem alloc] initWithTitle:@"Server Mode" action:@selector(toggleServerMode:) keyEquivalent:@""],
[[NSMenuItem alloc] initWithTitle:@"Connect…" action:@selector(showConnectToServer:) keyEquivalent:@""],
[[NSMenuItem alloc] initWithTitle:@"Disconnect" action:@selector(disconnect:) keyEquivalent:@""],
];
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment