manpagez: man pages & more
man lsappinfo(8)
Home | html | info | man
lsappinfo(8)                                                      lsappinfo(8)




NAME

       lsappinfo  -  Control  and  query CoreApplicationServices about the app
       state on the system


SYNOPSIS

       lsappinfo [options] [ command [command options] ] ...


COMMON COMMANDS

       o   front Show the front application.

       o   find [ key=value ]+
           Show the ASN of all applications which  have  the  given  key/value
           present  in  their  application  information.  For  key  the actual
           CFString value for the key can be  used,  or  any  of  the  aliases
           described  below  under Key Strings. For value, see the rules below
           under Key Values.

       o   info    [-only    information-item-key]    [-app     app-specifier]
           [-long][app-specifier]
           Show the information for the application app-specifier

       o   list
           Show the application list and information about each running appli-
           cation

       o   listen  [+notificationcode]*  [-notificationcode]*  [-addasn   asn]
           [-removeasn asn] [ -id # ] duration [--]
           Listen  for  the  given  notifications  ( those with '+', excluding
           those with '-' ) and display each one and  its  payload.  Notifica-
           tions are displayed when they receive when this tool is executing a
           wait or forever command.

       o   launch [[launch-modifier=value]+ [launch-option=value]+ [-arg argu-
           ment] [path-to-bundle] [--]
           Launch  an  application  with CoreApplicationServices in LaunchSer-
           vices. At the minimum, the execpath must be included as one of  the
           launch-options  or  -poseas  and a path-to-bundle. This is a fairly
           low level operation and does not handle a number of conditions that
           the higher level functions do.

       o   metainfo
           Show  the  meta  information, which is the session-wide information
           which CoreApplicationServices maintains for each login session.

       o   processList
           Show the application list, in ascending ASN order.

       o   restart
           Ask the launchservicesd to restart. The requestor  must  be  privi-
           leged.

       o   sharedmemory
           Show the shared memory information page for this session.

       o   unlisten [ -id ID ] [ -all ]
           Unlisten to all notifications on notification ID.

       o   visibleProcessList
           Show the visible ( front-to-back ) application list.




UNCOMMON COMMANDS

       o   allocateASN  Ask  launchservicesd  to allocate an ASN, and print it
           out.

       o   createFile PATH Create a file at the given path

       o   file path Open the file at path and read lines, treating  each  one
           as if it were passed to lsappinfo on the command line.

       o   forever Wait forever before executing the next command

       o   log [ -d | -i | -n | -w | -e | -c | -a ] [ -B ] [ -sender *process-
           name* ] [ string ... -- ] If an option is given, dump  any  Launch-
           Services  logging  information  on  the system until the process is
           terminated with control-C. If a string is provided, log that string
           to syslog.

       o   removeFile PATH Remove the file at the given path

       o   server  [ -xpcservicename ARG ] [ -local ] [ -duration *DURATION* ]
           [ -file *FILEPATH* ] [ -gone FILEGONEPATH ] [ -forever ]  Start  up
           the  launchservicesd server in process, with the optional given xpc
           service name or if -local then processing xpc requests from  future
           commands  for  this  same  process.  Terminate the server after the
           given DURATION seconds, or when the file at FILEPATH exists, or the
           file at path FILEPATHFONE is deleted, or never if -forever.

       o   setinfo  [-app  app-specifier]  [app-info-item=value]+ [--] Set the
           values for the given application information items in the specified
           application.

       o   setmetainfo [meta-info-item=value]+ [--]

       o   wait [ -duration duration ] [ -file FILEPATH ] [ -gone FILEPATHGONE
           ] duration Wait for duration seconds before executing the next com-
           mand,  or  if  FILEPATH  is  given  until  that  file exists, or if
           FILEPATHGONE is given until that file no longer exists.

       o   writePIDToFile PATH Write the current processes pid to  a  file  at
           PATH.




OPTIONS

       o   -v | --verbose Be more verbose about many operations

       o   -q | --quiet Be less verbose about many operations

       o   -defaultSession  Use kLSDefaultSessionID as the sessionID passed to
           all calls (the default)

       o   -currentSession Use kLSCurrentSessionID as the sessionID passed  to
           all calls

       o   -debug  |  -info | -notice | -warning | -err | -critical | -alert |
           -emergency Set the log level for this process to the given level




APPLICATION SPECIFIERS

       There are different ways to  indicate  what  application  the  commands
       operate  on,  collectively called the app-specifier. This may be one of
       the following.

       o   "ASN:0xAAAA:0xBBBB:" where AAAA and BBBB  are  the  values  for  an
           application ASN.

       o   "0xBBBB" where BBBB are the values from the lower part of an appli-
           cation ASN for which the upper part of the ASN is 0x0

       o   "#" where # is a decimal value above 10, representing the  applica-
           tion with the pid #

       o   "name" where name is the display name of a running application

       o   "bundleid" where bundleid is the bundle id of a running application

       o   "me" the asn of the lsappinfo tool




KEY STRINGS

       Any string from this set will map to the  corresponding  constant  from
       the LaunchServices header files.



           kCFBundleNameKey
           kLSASNKey
           kLSASNToBringForwardAtNextApplicationExitKey
           kLSAllowedToBecomeFrontmostKey
           kLSApplicationBackgroundOnlyTypeKey
           kLSApplicationBackgroundPriorityKey
           kLSApplicationCountKey
           kLSApplicationDesiresAttentionKey,
           kLSApplicationForegroundPriorityKey
           kLSApplicationForegroundTypeKey
           kLSApplicationHasRegisteredKey
           kLSApplicationHasSignalledItIsReadyKey
           kLSApplicationInStoppedStateKey
           kLSApplicationInThrottledStateAfterLaunchKey
           kLSApplicationInformationSeedKey
           kLSApplicationIsHiddenKey
           kLSApplicationListSeedKey
           kLSApplicationReadyToBeFrontableKey
           kLSApplicationTypeKey
           kLSApplicationTypeToRestoreKey
           kLSApplicationUIElementTypeKey
           kLSApplicationVersionKey
           kLSApplicationWasTerminatedByTALKey
           kLSApplicationWouldBeTerminatedByTALKey
           kLSArchitectureKey
           kLSBundleIdentifierLowerCaseKey
           kLSBundlePathDeviceIDKey
           kLSBundlePathINodeKey
           kLSBundlePathKey
           kLSCheckInTimeKey
           kLSDebugLevelKey
           kLSDisplayNameKey
           kLSExecutableFormatCFMKey
           kLSExecutableFormatKey
           kLSExecutableFormatMachOKey
           kLSExecutableFormatPoundBangKey
           kLSExecutablePathDeviceIDKey
           kLSExecutablePathINodeKey
           kLSExecutablePathKey
           kLSExitStatusKey
           kLSFileCreatorKey
           kLSFileTypeKey
           kLSFlavorKey
           kLSFrontApplicationSeedKey
           kLSHiddenApplicationCountKey
           kLSLaunchTimeKey
           kLSLaunchedByLaunchServicesKey
           kLSLaunchedByLaunchServicesThruForkExecKey
           kLSLaunchedByLaunchServicesThruLaunchDKey
           kLSLaunchedByLaunchServicesThruSessionLauncherKey
           kLSLaunchedInQuarantineKey
           kLSMenuBarOwnerApplicationSeedKey
           kLSModifierLaunchedForPersistenceKey
           kLSModifierRefConKey
           kLSNotifyBecameFrontmostAnotherLaunchKey
           kLSNotifyBecameFrontmostFirstActivationKey
           kLSNotifyLaunchRequestLaunchModifiersKey
           kLSOriginalExecutablePathDeviceIDKey
           kLSOriginalExecutablePathINodeKey
           kLSOriginalExecutablePathKey
           kLSOriginalPIDKey
           kLSPIDKey
           kLSParentASNKey
           kLSParentASNWasInferredKey
           kLSPersistenceSuppressRelaunchAtLoginKey
           kLSPreviousASNKey
           kLSPreviousPresentationModeKey
           kLSPreviousValueKey
           kLSRecordingAppleEventsKey
           kLSRequiresCarbonKey
           kLSRequiresClassicKey
           kLSSessionIDKey
           kLSShellExecutablePathKey
           kLSUIDsInSessionKey
           kLSUIPresentationModeAllHiddenValue
           kLSUIPresentationModeAllSuppressedValue
           kLSUIPresentationModeContentHiddenValue
           kLSUIPresentationModeContentSuppressedValue
           kLSUIPresentationModeKey
           kLSUIPresentationModeNormalValue
           kLSUIPresentationOptionsKey
           kLSUnhiddenApplicationCountKey
           kLSVisibleApplicationCountKey
           kLSVisibleApplicationListSeedKey
           kLSWantsToComeForwardAtRegistrationTimeKey
           launchedThrottled



       Likewise, these short strings also make to the corresponding constants.



           allowedtobecomefrontmost
           applicationTypeToRestore
           applicationWasTerminatedByTAL
           applicationtype
           arch
           asn
           bundleid
           bundlelastcomponent
           bundlename
           bundlenamelc
           bundlepath
           changecount
           creator
           debuglevel
           displayname
           execpath
           executablepath
           filecreator
           filename
           filetype
           hidden
           isconnectedtowindowserver
           isready
           isregistered
           isstopped
           isthrottled
           launchedForPersistence
           launchedinquarantine
           name
           parentasn
           pid
           presentationmode
           presentationoptions
           psn
           recordingAppleEvents
           session
           shellpath
           supressRelaunch
           version




KEY VALUES

       In numerous places a key can be set to a value. The format of value can
       be any of the following

       o   "string" A string, surrounded by double quotes.

       o   numeric-digits   |  -numeric-digits  |  numeric-digits.numeric-dig-
           its[E]numeric-digits A numeric value, either an integer type  or  a
           double floating point type.

       o   $hex-digits A numeric value given by the hex value hex-digits.

       o   "ASN:0xAAAA:0xBBBB:" An ASN, where AAAA and BBBB are the values for
           an application ASN.

       o   App:str An ASN, where str matches one of the  application-specifier
           formats.

       o   ( [[str,] str] ) A CFArrayRef, where each str is converted as if it
           were a key value.

       o   true The kCFBooleanTrue value.

       o   false The kCFBooleanFalse value.

       o   null The kCFNull value.

       o   Any of the application information item, or launch modifier strings
           The  equivalent,  exported  LaunchServices  CFStringRef key for the
           item or launch modifier.




APPLICATION INFORMATION ITEM KEYS

       o   asn An application ASN, which is unique identifier assigned to each
           application when the application is launched and persists until the
           application exits, and likely is unique for the entire time a  user
           is logged in. When displayed, an ASN looks like "ASN:0x0-0x1f01f:".

       o   parentasn The ASN of the application which launched  this  applica-
           tion.

       o   bundlename The bundle name, if one exists, for the application.

       o   bundlenamelc  The  bundle name, if one exists, for the application,
           but with every upper case character converted into  the  equivalent
           lower case character.

       o   bundlepath The bundle path, if the application is bundled

       o   executablepath The executable path of the application

       o   filetype The file type of the application, if it has one.

       o   filecreator The creator type of the application, if it has one.

       o   pid The pid of the application.

       o   filename  The filename of the executable (the last component of the
           executable path), converted into a lowercase string

       o   bundlelastcomponent The last component of  the  bundle  path,  con-
           verted into a lowercase string.

       o   displayname | name The display name of this application

       o   bundleid The bundle identifier of the application, if one exists.

       o   applicationtype  The  type  of  the  application  (generally "Fore-
           ground", "Background", or "UIElement")

       o   allowedtobecomefrontmost The application is allowed  to  be  front-
           most.

       o   version The version string for the application, if it has one

       o   presentationmode  The UIPresentationMode for this application (only
           for foreground applications),  generally  one  of  "Normal",  "Con-
           tentSupressed", "ContentHidden", "Suppressed", "AllHidden"

       o   presentationoptions

       o   session A number indicating which audit session this application is
           running in.

       o   hidden If this application is a foreground application, then if  it
           is hidden, "true", or "false" if it is not hidden

       o   changecount A number which changes whenever any items in the appli-
           cation's information dictionary is changed.

       o   debuglevel

       o   isregistered If this application has registered, then "true",  oth-
           erwise "false".

       o   isready  If  this  application  has entered its main runloop and is
           able to respond to requests to hide or show itself, "true",  other-
           wise "false".

       o   isstopped  If  this application was launched stopped, and if it has
           not been  started  yet,  then  "true",  otherwise  "false"  or  not
           present.

       o   launchedinquarantine  If this application was launched in a quaran-
           tined state, then "true", otherwise "false" or not present.

       o   arch The architecture of the code running this application,  gener-
           ally "x86_64" or "i386".

       o   recordingAppleEvents  If this application is recording AppleEvents,
           then "true", otherwise "false" or not present.

       o   supressRelaunch If this application should not be re-launched after
           a  logout and login, then "true", otherwise "false" or not present.

       o   applicationTypeToRestore

       o   applicationWasTerminatedByTAL

       o   isthrottled If this  application  was  launched  in  the  throttled
           state,  and  if it has not been unthrottled, then "true", otherwise
           false or not present.

       o   applicationWouldBeTerminatedByTALKey

       o   launchedhidden If the application was launched hidden, then "true",
           otherwise  "false" or not present. This is not whether the applica-
           tion is currently hidden, just whether at the time it was  launched
           the request was to have it hide itself.

       o   launchandhideothers  If  the  application was launched and asked to
           hide all other application, then "true", otherwise "false"  or  not
           present.  This  is not whether the application is currently hidden,
           just whether at the time it was launched the request was to have it
           hide all other applications.

       o   launchForPersistence  If  the application was launched with launch-
           ForPersistence=true, then "true", otherwise "false" or not present.




LAUNCHMODIFIER KEYS

       o   async=[true|false] Launch asynchronously

       o   refcon=[#] Launch with the given numeric refcon.

       o   nofront=[true|false]  If  true, do not bring the application to the
           front when it finishes launching

       o   stopped=[true|false] Launch the process but do not start it.

       o   launchandhide=[true|false] Launch the process and cause it to  hide
           itself when it finishes launching

       o   \launchandhideothers`=[true|false]  Launch the process and couse it
           to hide all other applications when it finishes launching

       o   launchForPersistence=[true|false]

       o   launchWithASLRDisabled=[true|false]




NOTIFICATION CODES

       Notifications are sent out by LaunchServices  when  various  conditions
       arrive.  Each  notification has a type, called the notification-code, a
       dictionary of data items which are specific to the notification, a time
       the notification was sent, and an optional affected ASN.

       o   launch



       Sent when an application is launched

       o   creation



       Sent  when  an  entry  for  an application is created on the system and
       associated with an ASN.

       o   birth



       Sent when an

       o   death



       Sent when an application exits.

       o   abnormaldeath



       Sent when an application exits with a non-zero exit status.

       o   childDeath



       Sent when an application exits, with affected ASN set to the parent ASN
       of the application which exited.

       o   abnormalChildDeath



       Sent  when  an  application  exits  with  a  non-zero exit status, with
       affected ASN set to the parent ASN of the application which exited.

       o   launchFailure



       Sent when an application launch fails, after a launch notification  has
       been sent out.

       o   appCreation



       Sent  when an application is "created", which happens immediately after
       the application is created and certain items are added into the  appli-
       cation information dictionary.

       o   childAppCreation



       Sent  when an application is "created", which happens immediately after
       the application is created and certain items are added into the  appli-
       cation  information dictionary, with affected ASN set to the asn of the
       parent ASN of this application.

       o   appReady



       Sent when an applications signals to LaunchServices that it is ready to
       accept  hide/show  events,  generally when it has entered its main run-
       loop.

       o   childAppReady



       Sent when an applications signals to LaunchServices that it is ready to
       accept  hide/show  events,  generally when it has entered its main run-
       loop, with affected ASN set to the parent ASN of the application  which
       signalled ready.

       o   readyToAcceptAppleEvents



       Sent   when   an  application  signals  that  it  is  ready  to  accept
       AppleEvents.

       o   launchTimedOut

       o   launchFinished

       o   allTALAppsRegistered



       Sent when talagentd decides that all applications which  were  launched
       for persistence have registered.

       o   becameFrontmost



       Sent when an application is made into the front application.

       o   lostFrontmost



       Sent  when an application which previously was the front application is
       no longer the front application.

       o   orderChanged



       Sent when the front-to-back order of the application list changes.

       o   bringForwardRequest



       Someone has requested that  the  application  with  affected  ASN  make
       itself frontmost.

       o   menuBarAcquired



       Sent when the application which is responsible for drawing the menu bar
       (generally the frontmost foreground application) changes

       o   menuBarLost



       Sent when the application which was responsible for  drawing  the  menu
       bar  (generally  the  frontmost  foreground  application)  is no longer
       responsible

       o   hidden



       Sent when the application is hidden

       o   shown



       Sent when the application is shown

       o   showRequest



       Someone has requested that the application with the  affected  applica-
       tion asn should show (un-hide) itself.

       o   hideRequest



       Someone  has  requested that the application with the affected applica-
       tion asn should hide itself.

       o   pullwindowsforward



       Someone has requested that the application with the  affected  applica-
       tion asn should show itself and pull all of its windows forward.

       o   appInfoChanged



       Sent when the information for the application is changed.

       o   appInfoKeyAdded



       Sent  when  a  key is added to the information for the application. The
       data for the notification will include the  key  being  added  and  its
       value.

       o   appInfoKeyChanged



       Sent  when  a  value  for  an  item  in  the application information is
       changed. The data for the  notification  will  include  the  key  being
       changes and its new and old value.

       o   appInfoKeyRemoved



       Sent  when  the  value  for  an  item in the application information is
       removed. The data for the  notification  will  include  the  key  being
       removed and its value.

       o   appTypeChanged



       Sent  when  the "ApplicationType" key in the application information is
       changed.

       o   appNameChanged



       Sent when the  application  name  in  the  application  information  is
       changed.

       o   wantsAttentionChanged



       Sent  when  the  LSWantsAttention key in the application information is
       changed.

       o   presentationModeChanged



       Sent when an application changes its presentation mode.

       o   pidChanged



       Sent when an application changes its pid. In practice  this  can  never
       happen,  except  when  LaunchServices  launches  a process which itself
       forks or spawns a new process, and then checks-in from that new pid.

       o   frontPresentationModeChanged



       Sent when the presentation mode of the system changes,  generally  when
       the  foreground  application  changes its own presentation mode or when
       the front application changes and the old  and  new  applications  have
       different presentation modes.

       o   presentationModeChangedBecauseFrontApplicationChanged



       Sent  when the presentation mode of the system changes only because the
       front application changed and the old and new applications have differ-
       ent presentation modes.

       o   launchrequest

       o   started



       Sent when a formally stopped application is started.

       o   sessionLauncherRegister



       Sent  when  the  ASN of the session launcher application registers with
       LaunchServices.

       o   sessionLauncherUnregistered



       Sent when the application registered as the session  launcher  unregis-
       ters or exits.

       o   nextAppToBringForwardAtQuitRegistered



       Sent  when  the meta-information item for the next application to bring
       forward ASN is changed

       o   nextAppToBringForwardAtQuitUnregistered

       o   systemProcessRegistered



       Sent when the system process  (generally  loginwindow)  registers  with
       LaunchServices.

       o   systemProcessUnregistered



       Sent  when  the system process (generally loginwindow) unregisters with
       LaunchServices.

       o   frontReservationCreated



       Sent when a front-reservation is created.

       o   frontReservationDestroyed



       Sent when a front reservation is destroyed.

       o   permittedFrontASNsChanged



       Sent when the array of permitted-front-applications changes.

       o   suppressRelaunch



       Sent when an application changes its "LSSupressRelaunch" key.

       o   terminatedByTALChanged



       Sent when an application changes its "TerminatedByTAL" key.

       o   launchedThrottledChanged



       Sent when  an  application  changes  *  applicationWouldBeTerminatedBy-
       TALChanged * applicationProgressValueChanged * applicationVisualNotifi-
       cation * wakeup

       Request that the application with affected ASN resume running its  main
       runloop.

       o   sessionCreated



       Sent  when  a  session is created, generally when the first application
       registers inside the session. Affected ASN is always NULL,  since  this
       does not refer to any particular application.

       o   sessionDestroyed



       Sent  when  a  session is destroyed. Affected ASN is always NULL, since
       this does not refer to any particular application.

       o   invalid



       This represents an invalid notification code, and is never sent.

       o   all



       This represents all notification codes, and is  never  sent,  but  gets
       used when specifying which notifications to listen for.


EXAMPLES

       o   List all of the running applications



       lsappinfo list

       o   Show all the notifications which are being sent out



       lsappinfo listen +all forever

       o   Show  the  notifications sent out whenever the front application is
           changed, for the next 60 seconds



       lsappinfo listen +becameFrontmost wait 60

       o   Launch TextEdit.app, asyncronously, and don't bring it to the front



       lsappinfo launch nofront=true async=true /Applications/TextEdit.app/

       o   Find the ASN for the running application "TextEdit", by bundle id



       lsappinfo find bundleid=com.apple.TextEdit

       o   Find the ASN for the running application "TextEdit", by name



       lsappinfo find name="TextEdit"

       o   Show the information for the running application "TextEdit"



       lsappinfo info "TextEdit"



                                  April 2013                      lsappinfo(8)

Mac OS X 10.9 - Generated Fri Oct 18 14:58:05 CDT 2013
© manpagez.com 2000-2024
Individual documents may contain additional copyright information.