Last active
March 17, 2018 20:02
-
-
Save tburgin/945b93dd85b9b96ba8c97a480ea6ab49 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from AppKit import NSRunningApplication | |
print NSRunningApplication.runningApplicationsWithBundleIdentifier_("com.google.Chrome").count() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <AppKit/AppKit.h> | |
int main(int argc, char *argv[]) { | |
@autoreleasepool { | |
[[NSWorkspace sharedWorkspace] openURLs:@[ [NSURL URLWithString:@"chrome://restart"] ] | |
withAppBundleIdentifier:@"com.google.Chrome" | |
options:NSWorkspaceLaunchWithoutActivation | |
additionalEventParamDescriptor:nil | |
launchIdentifiers:NULL]; | |
} | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from AppKit import NSWorkspace | |
from AppKit import NSWorkspaceLaunchWithoutActivation | |
from Foundation import NSURL | |
URL = NSURL.URLWithString_("chrome://restart") | |
workspace = NSWorkspace.sharedWorkspace() | |
workspace.openURLs_withAppBundleIdentifier_options_additionalEventParamDescriptor_launchIdentifiers_([URL], "com.google.Chrome", NSWorkspaceLaunchWithoutActivation, None, None) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment