diff options
Diffstat (limited to 'AppKit/GTMNSWorkspace+Running.h')
-rw-r--r-- | AppKit/GTMNSWorkspace+Running.h | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/AppKit/GTMNSWorkspace+Running.h b/AppKit/GTMNSWorkspace+Running.h new file mode 100644 index 0000000..7e9dc6d --- /dev/null +++ b/AppKit/GTMNSWorkspace+Running.h @@ -0,0 +1,80 @@ +// +// GTMNSWorkspace+Running.h +// +// Copyright 2007-2008 Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may not +// use this file except in compliance with the License. You may obtain a copy +// of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations under +// the License. +// + +#import <AppKit/AppKit.h> +#import "GTMDefines.h" + +// Process Dictionary keys +// Make sure to use numberToProcessSerialNumber: on the return values +// of these keys to get valid PSNs on both Leopard and Tiger. +// Numeric types come back as a NSNumber. +GTM_EXTERN NSString *const kGTMWorkspaceRunningPSN; // long long +GTM_EXTERN NSString *const kGTMWorkspaceRunningParentPSN; // long long + +GTM_EXTERN NSString *const kGTMWorkspaceRunningFlavor; // SInt32 +GTM_EXTERN NSString *const kGTMWorkspaceRunningAttributes; // SInt32 +GTM_EXTERN NSString *const kGTMWorkspaceRunningFileType; // NSString +GTM_EXTERN NSString *const kGTMWorkspaceRunningFileCreator; // NSString +GTM_EXTERN NSString *const kGTMWorkspaceRunningPID; // long +GTM_EXTERN NSString *const kGTMWorkspaceRunningLSBackgroundOnly; // bool +GTM_EXTERN NSString *const kGTMWorkspaceRunningLSUIElement; // bool +GTM_EXTERN NSString *const kGTMWorkspaceRunningIsHidden; // bool +GTM_EXTERN NSString *const kGTMWorkspaceRunningCheckedIn; // bool +GTM_EXTERN NSString *const kGTMWorkspaceRunningLSUIPresentationMode; // Short +GTM_EXTERN NSString *const kGTMWorkspaceRunningBundlePath; // NSString +GTM_EXTERN NSString *const kGTMWorkspaceRunningBundleExecutable; // NSString +GTM_EXTERN NSString *const kGTMWorkspaceRunningBundleName; // NSString +GTM_EXTERN NSString *const kGTMWorkspaceRunningBundleIdentifier; // NSString +GTM_EXTERN NSString *const kGTMWorkspaceRunningBundleVersion; // NSString + +// A category for getting information about other running processes +@interface NSWorkspace (GTMWorkspaceRunningAdditions) + +// Returns a YES/NO if a process w/ the given identifier is running +- (BOOL)gtm_isAppWithIdentifierRunning:(NSString *)identifier; + +// Returns a dictionary with info for our process. +//See Process Dictionary Keys above for values +- (NSDictionary *)gtm_processInfoDictionary; + +// Returns a dictionary with info for the active process. +// See Process Dictionary Keys above for values +- (NSDictionary *)gtm_processInfoDictionaryForActiveApp; + +// Returns a dictionary with info for the process. +//See Process Dictionary Keys above for values +- (NSDictionary *)gtm_processInfoDictionaryForPID:(pid_t)pid; + +// Returns a dictionary with info for the process. +// See Process Dictionary Keys above for values +- (NSDictionary *)gtm_processInfoDictionaryForPSN:(const ProcessSerialNumberPtr)psn; + +// Returns true if we were launched as a login item. +- (BOOL)gtm_wasLaunchedAsLoginItem; + +// Returns true if we were launched by a given bundleid +- (BOOL)gtm_wasLaunchedByProcess:(NSString*)bundleid; + +// Returns true if the PSN was found for the running app with bundleID +- (BOOL)gtm_processSerialNumber:(ProcessSerialNumber*)outPSN + withBundleID:(NSString*)bundleID; + +// Converts PSNs stored in NSNumbers to real PSNs +- (ProcessSerialNumber)gtm_numberToProcessSerialNumber:(NSNumber*)number; + +@end |