Changeset 99


Ignore:
Timestamp:
02/20/03 02:08:05 (21 years ago)
Author:
Nicholas Riley
Message:

appswitch 1.0

Location:
trunk/appswitch/appswitch
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/appswitch/appswitch/README

    r97 r99  
    1 appswitch 1.0b2 [11 February 2003]
    2 ===============
     1appswitch 1.0 [19 February 2003]
     2=============
    33
    44A command-line interface to the Mac OS X process manager.
     
    7373---------------
    7474
     751.0   - 19 February 2003
     76 - added description of -q delay bug (no workaround)
     771.0b3 - 13 February 2003
     78 - display spaces instead of ? characters when unprintable
     79 - properly handle very narrow window width with -l
     80 - further revised and clarified man page
     81 - added -q, -K, -L options
    75821.0b2 - 11 February 2003
    7683 - display ? characters for unprintable creator code characters
  • trunk/appswitch/appswitch/VERSION

    r97 r99  
    1 1.0b2
     11.0b3
  • trunk/appswitch/appswitch/appswitch.1

    r97 r99  
    1 .Dd Mon Feb 11 2003               \" DATE
    2 .Dt APPSWITCH 1 LOCAL      \" Program name and manual section number
    3 .Os appswitch 1.0b2
     1.Dd Wed Feb 19 2003      \" DATE
     2.Dt APPSWITCH 1 LOCAL    \" Program name and manual section number
     3.Os appswitch 1.0
    44.Sh NAME
    55.Nm appswitch
     
    77.Sh SYNOPSIS
    88.Nm appswitch
    9 .Op Fl sShHkFlP          \" [-sShHkFlP]
     9.Op Fl sShHqkKFlLP       \" [-sShHqkKFlLP]
    1010.Op Fl c Ar creator      \" [-c creator]
    1111.Op Fl i Ar bundleID     \" [-i bundleID]
     
    3434match method is faster than a match by bundle identifier.
    3535.It Fl p Ar pid
    36 Match by process identifier, a positive number.
     36Match by process identifier, a positive integer.
    3737.It Ar path
    3838Match by bundle path.  For packaged applications, this is the package
     
    5050.Bl -tag -width -indent
    5151.It Fl s
    52 Show the application, making the application's windows frontmost. Do
     52Show the application, making the application's windows frontmost.  Do
    5353not switch to the application.
    5454.It Fl h
    5555Hide the application's windows.
     56.It Fl q
     57Quit the application.
    5658.It Fl k
    57 Kill (force quit) the application.
     59Kill (force quit) the application.  Sends the
     60.Dv SIGINT
     61signal to the application, which the application may
     62ignore.  Equivalent to selecting
     63.Dq Force Quit
     64from an application's menu in the Dock for the first time.
     65.It Fl K
     66Kill (force quit) the application.  Sends the
     67.Dv SIGKILL
     68signal to the application, which the application may not ignore.
     69Equivalent to selecting
     70.Dq Force Quit
     71from an application's menu in the Dock for the second time.
    5872.It Fl l
    5973List applications in a format similar to that of
    60 .Xr ps 1 . The columns of the listing are as follows:
     74.Xr ps 1 .
     75The columns of the listing are as follows:
    6176.Bl -tag -width indent
    6277.It PSN
     
    6580applications.
    6681.It PID
    67 The process identifier, a positive number which uniquely identifies
     82The process identifier, a positive integer which uniquely identifies
    6883native Mac OS X processes, usable with the
    6984.Fl p
     
    103118characters if the window width cannot be determined.
    104119.El
     120.It Fl L
     121List applications in a format similar to that of
     122.Xr ps 1 .
     123The columns of the listing are as above, but the path field is not
     124truncated to the window width, and a bundle identifier is added in
     125parentheses after the path, usable with the
     126.Fl i
     127matching option.
    105128.It Fl P
    106 Print the application's process identifier (PID), a positive number
     129Print the application's process identifier (PID), a positive integer
    107130and unique identifier for all applications except Classic
    108131applications.
     
    135158.Xr sleep 1
    136159command before it.
    137 .Sh AUTHORS
     160.Pp
     161The
     162.Fl q
     163option is very slow on Mac OS X 10.2.4 and earlier; this is an
     164acknowledged bug in AECreateAppleEvent with no known workaround. Chris
     165Espinosa from Apple has stated that they plan to fix it in a future
     166release.
     167.Sh AUTHOR
    138168.An "Nicholas Riley" Aq appswitch@sabi.net
    139169.\" .Sh HISTORY           \" Document history if command behaves in a unique manner
  • trunk/appswitch/appswitch/appswitch.pbproj/nicholas.pbxuser

    r92 r99  
    1414                );
    1515                perUserDictionary = {
    16                         PBXPerProjectTemplateStateSaveDate = 66554412;
    17                         "PBXTemplateGeometry-F5314676015831810DCA290F" = {
    18                                 ContentSize = "{618, 257}";
    19                                 LeftSlideOut = {
    20                                         Collapsed = NO;
    21                                         Frame = "{{0, 23}, {618, 234}}";
    22                                         Split0 = {
    23                                                 ActiveTab = 2;
    24                                                 ActiveTabName = PBXBuildResultsModule;
    25                                                 Collapsed = YES;
    26                                                 Frame = "{{0, 0}, {618, 234}}";
    27                                                 Split0 = {
    28                                                         Frame = "{{1e+06, 1e+06}, {618, 0}}";
    29                                                 };
    30                                                 SplitCount = 1;
    31                                                 Tab0 = {
    32                                                         Frame = "{{0, 0}, {952, 321}}";
    33                                                 };
    34                                                 Tab1 = {
    35                                                         Debugger = {
    36                                                                 Collapsed = NO;
    37                                                                 Frame = "{{0, 0}, {781, 452}}";
    38                                                                 Split0 = {
    39                                                                         Frame = "{{0, 24}, {781, 428}}";
    40                                                                         Split0 = {
    41                                                                                 Frame = "{{0, 0}, {383, 428}}";
    42                                                                         };
    43                                                                         Split1 = {
    44                                                                                 DebugVariablesTableConfiguration = (
    45                                                                                         Name,
    46                                                                                         123,
    47                                                                                         Value,
    48                                                                                         85,
    49                                                                                         Summary,
    50                                                                                         155.123,
    51                                                                                 );
    52                                                                                 Frame = "{{392, 0}, {389, 428}}";
    53                                                                         };
    54                                                                         SplitCount = 2;
    55                                                                 };
    56                                                                 SplitCount = 1;
    57                                                                 Tab0 = {
    58                                                                         Frame = "{{0, 0}, {100, 50}}";
    59                                                                 };
    60                                                                 Tab1 = {
    61                                                                         Frame = "{{0, 0}, {100, 50}}";
    62                                                                 };
    63                                                                 TabCount = 2;
    64                                                                 TabsVisible = YES;
    65                                                         };
    66                                                         Frame = "{{0, 0}, {781, 452}}";
    67                                                         LauncherConfigVersion = 7;
    68                                                 };
    69                                                 Tab2 = {
    70                                                         Frame = "{{0, 0}, {618, 228}}";
    71                                                         LauncherConfigVersion = 3;
    72                                                         Runner = {
    73                                                                 Frame = "{{0, 0}, {618, 228}}";
    74                                                         };
    75                                                 };
    76                                                 Tab3 = {
    77                                                         BuildMessageFrame = "{{0, 0}, {620, 195}}";
    78                                                         BuildTranscriptFrame = "{{0, 204}, {620, 2}}";
    79                                                         BuildTranscriptFrameExpanded = YES;
    80                                                         Frame = "{{0, 0}, {618, 228}}";
    81                                                 };
    82                                                 Tab4 = {
    83                                                         Frame = "{{0, 0}, {612, 295}}";
    84                                                 };
    85                                                 TabCount = 5;
    86                                                 TabsVisible = NO;
    87                                         };
    88                                         SplitCount = 1;
    89                                         Tab0 = {
    90                                                 Frame = "{{0, 0}, {300, 533}}";
    91                                                 GroupTreeTableConfiguration = (
    92                                                         TargetStatusColumn,
    93                                                         18,
    94                                                         MainColumn,
    95                                                         267,
    96                                                 );
    97                                         };
    98                                         Tab1 = {
    99                                                 ClassesFrame = "{{0, 0}, {280, 398}}";
    100                                                 ClassesTreeTableConfiguration = (
    101                                                         PBXBookColumnIdentifier,
    102                                                         20,
    103                                                         PBXClassColumnIdentifier,
    104                                                         237,
    105                                                 );
    106                                                 Frame = "{{0, 0}, {278, 659}}";
    107                                                 MembersFrame = "{{0, 407}, {280, 252}}";
    108                                                 MembersTreeTableConfiguration = (
    109                                                         PBXBookColumnIdentifier,
    110                                                         20,
    111                                                         PBXMethodColumnIdentifier,
    112                                                         236,
    113                                                 );
    114                                         };
    115                                         Tab2 = {
    116                                                 Frame = "{{0, 0}, {200, 100}}";
    117                                         };
    118                                         Tab3 = {
    119                                                 Frame = "{{0, 0}, {200, 100}}";
    120                                                 TargetTableConfiguration = (
    121                                                         ActiveObject,
    122                                                         16,
    123                                                         ObjectNames,
    124                                                         202.296,
    125                                                 );
    126                                         };
    127                                         Tab4 = {
    128                                                 BreakpointsTreeTableConfiguration = (
    129                                                         breakpointColumn,
    130                                                         197,
    131                                                         enabledColumn,
    132                                                         31,
    133                                                 );
    134                                                 Frame = "{{0, 0}, {250, 100}}";
    135                                         };
    136                                         TabCount = 5;
    137                                         TabsVisible = NO;
    138                                 };
    139                                 NavBarShownByDefault = YES;
    140                                 StatusViewVisible = YES;
    141                                 Template = F5314676015831810DCA290F;
    142                                 ToolbarVisible = YES;
    143                                 WindowLocation = "{819, 244}";
    144                         };
    145                         "PBXTemplateGeometry-F5534CB2020F3F8A0DCA290F" = {
    146                                 ContentSize = "{594, 303}";
    147                                 LeftSlideOut = {
    148                                         Collapsed = NO;
    149                                         Frame = "{{0, 23}, {594, 280}}";
    150                                         Split0 = {
    151                                                 ActiveTab = 1;
    152                                                 ActiveTabName = PBXRunSessionModule;
    153                                                 Collapsed = YES;
    154                                                 Frame = "{{0, 0}, {594, 280}}";
    155                                                 Split0 = {
    156                                                         Frame = "{{1e+06, 1e+06}, {594, 0}}";
    157                                                 };
    158                                                 SplitCount = 1;
    159                                                 Tab0 = {
    160                                                         Frame = "{{0, 0}, {804, 321}}";
    161                                                 };
    162                                                 Tab1 = {
    163                                                         Debugger = {
    164                                                                 Collapsed = NO;
    165                                                                 Frame = "{{0, 0}, {594, 274}}";
    166                                                                 Split0 = {
    167                                                                         Frame = "{{0, 24}, {594, 250}}";
    168                                                                         Split0 = {
    169                                                                                 Frame = "{{0, 0}, {290, 250}}";
    170                                                                         };
    171                                                                         Split1 = {
    172                                                                                 DebugVariablesTableConfiguration = (
    173                                                                                         Name,
    174                                                                                         123,
    175                                                                                         Value,
    176                                                                                         85,
    177                                                                                         Summary,
    178                                                                                         62.123,
    179                                                                                 );
    180                                                                                 Frame = "{{299, 0}, {295, 250}}";
    181                                                                         };
    182                                                                         SplitCount = 2;
    183                                                                 };
    184                                                                 SplitCount = 1;
    185                                                                 Tab0 = {
    186                                                                         Frame = "{{0, 0}, {100, 50}}";
    187                                                                 };
    188                                                                 Tab1 = {
    189                                                                         Frame = "{{0, 0}, {100, 50}}";
    190                                                                 };
    191                                                                 TabCount = 2;
    192                                                                 TabsVisible = YES;
    193                                                         };
    194                                                         Frame = "{{0, 0}, {594, 274}}";
    195                                                         LauncherConfigVersion = 7;
    196                                                 };
    197                                                 Tab2 = {
    198                                                         Frame = "{{0, 0}, {594, 274}}";
    199                                                         LauncherConfigVersion = 3;
    200                                                         Runner = {
    201                                                                 Frame = "{{0, 0}, {594, 274}}";
    202                                                         };
    203                                                 };
    204                                                 Tab3 = {
    205                                                         BuildMessageFrame = "{{0, 0}, {614, 262}}";
    206                                                         BuildTranscriptFrame = "{{0, 271}, {614, 2}}";
    207                                                         BuildTranscriptFrameExpanded = YES;
    208                                                         Frame = "{{0, 0}, {612, 295}}";
    209                                                 };
    210                                                 Tab4 = {
    211                                                         Frame = "{{0, 0}, {612, 295}}";
    212                                                 };
    213                                                 TabCount = 5;
    214                                                 TabsVisible = NO;
    215                                         };
    216                                         SplitCount = 1;
    217                                         Tab0 = {
    218                                                 Frame = "{{0, 0}, {300, 533}}";
    219                                                 GroupTreeTableConfiguration = (
    220                                                         TargetStatusColumn,
    221                                                         18,
    222                                                         MainColumn,
    223                                                         267,
    224                                                 );
    225                                         };
    226                                         Tab1 = {
    227                                                 ClassesFrame = "{{0, 0}, {280, 398}}";
    228                                                 ClassesTreeTableConfiguration = (
    229                                                         PBXBookColumnIdentifier,
    230                                                         20,
    231                                                         PBXClassColumnIdentifier,
    232                                                         237,
    233                                                 );
    234                                                 Frame = "{{0, 0}, {278, 659}}";
    235                                                 MembersFrame = "{{0, 407}, {280, 252}}";
    236                                                 MembersTreeTableConfiguration = (
    237                                                         PBXBookColumnIdentifier,
    238                                                         20,
    239                                                         PBXMethodColumnIdentifier,
    240                                                         236,
    241                                                 );
    242                                         };
    243                                         Tab2 = {
    244                                                 Frame = "{{0, 0}, {200, 100}}";
    245                                         };
    246                                         Tab3 = {
    247                                                 Frame = "{{0, 0}, {200, 386}}";
    248                                                 TargetTableConfiguration = (
    249                                                         ActiveObject,
    250                                                         16,
    251                                                         ObjectNames,
    252                                                         202.296,
    253                                                 );
    254                                         };
    255                                         Tab4 = {
    256                                                 BreakpointsTreeTableConfiguration = (
    257                                                         breakpointColumn,
    258                                                         197,
    259                                                         enabledColumn,
    260                                                         31,
    261                                                 );
    262                                                 Frame = "{{0, 0}, {250, 386}}";
    263                                         };
    264                                         TabCount = 5;
    265                                         TabsVisible = NO;
    266                                 };
    267                                 NavBarShownByDefault = YES;
    268                                 StatusViewVisible = YES;
    269                                 Template = F5534CB2020F3F8A0DCA290F;
    270                                 ToolbarVisible = YES;
    271                                 WindowLocation = "{72, 222}";
    272                         };
    273                         "PBXTemplateGeometry-F5CA7ECB015C094F0DCA290F" = {
    274                                 ContentSize = "{796, 742}";
    275                                 LeftSlideOut = {
    276                                         Collapsed = NO;
    277                                         Frame = "{{0, 0}, {796, 742}}";
    278                                         Split0 = {
    279                                                 Collapsed = NO;
    280                                                 Frame = "{{0, 0}, {796, 742}}";
    281                                                 Split0 = {
    282                                                         Frame = "{{0, 0}, {796, 742}}";
    283                                                 };
    284                                                 SplitCount = 1;
    285                                                 Tab0 = {
    286                                                         Frame = "{{0, 0}, {484, 208}}";
    287                                                 };
    288                                                 Tab1 = {
    289                                                         Debugger = {
    290                                                                 Collapsed = NO;
    291                                                                 Frame = "{{0, 0}, {664, 208}}";
    292                                                                 Split0 = {
    293                                                                         Frame = "{{0, 24}, {664, 184}}";
    294                                                                         Split0 = {
    295                                                                                 Frame = "{{0, 0}, {325, 184}}";
    296                                                                         };
    297                                                                         Split1 = {
    298                                                                                 DebugVariablesTableConfiguration = (
    299                                                                                         Name,
    300                                                                                         123,
    301                                                                                         Value,
    302                                                                                         85,
    303                                                                                         Summary,
    304                                                                                         96.123,
    305                                                                                 );
    306                                                                                 Frame = "{{334, 0}, {330, 184}}";
    307                                                                         };
    308                                                                         SplitCount = 2;
    309                                                                 };
    310                                                                 SplitCount = 1;
    311                                                                 Tab0 = {
    312                                                                         Frame = "{{0, 0}, {100, 50}}";
    313                                                                 };
    314                                                                 Tab1 = {
    315                                                                         Frame = "{{0, 0}, {100, 50}}";
    316                                                                 };
    317                                                                 TabCount = 2;
    318                                                                 TabsVisible = YES;
    319                                                         };
    320                                                         Frame = "{{0, 0}, {664, 208}}";
    321                                                         LauncherConfigVersion = 7;
    322                                                 };
    323                                                 Tab2 = {
    324                                                         Frame = "{{0, 0}, {664, 50}}";
    325                                                         LauncherConfigVersion = 3;
    326                                                         Runner = {
    327                                                                 Frame = "{{0, 0}, {664, 50}}";
    328                                                         };
    329                                                 };
    330                                                 Tab3 = {
    331                                                         BuildMessageFrame = "{{0, 0}, {614, 262}}";
    332                                                         BuildTranscriptFrame = "{{0, 271}, {614, 2}}";
    333                                                         BuildTranscriptFrameExpanded = YES;
    334                                                         Frame = "{{0, 0}, {612, 295}}";
    335                                                 };
    336                                                 Tab4 = {
    337                                                         Frame = "{{0, 0}, {612, 295}}";
    338                                                 };
    339                                                 TabCount = 5;
    340                                                 TabsVisible = NO;
    341                                         };
    342                                         SplitCount = 1;
    343                                         Tab0 = {
    344                                                 Frame = "{{0, 0}, {313, 531}}";
    345                                                 GroupTreeTableConfiguration = (
    346                                                         TargetStatusColumn,
    347                                                         18,
    348                                                         MainColumn,
    349                                                         280,
    350                                                 );
    351                                         };
    352                                         Tab1 = {
    353                                                 ClassesFrame = "{{0, 0}, {280, 398}}";
    354                                                 ClassesTreeTableConfiguration = (
    355                                                         PBXBookColumnIdentifier,
    356                                                         20,
    357                                                         PBXClassColumnIdentifier,
    358                                                         237,
    359                                                 );
    360                                                 Frame = "{{0, 0}, {278, 659}}";
    361                                                 MembersFrame = "{{0, 407}, {280, 252}}";
    362                                                 MembersTreeTableConfiguration = (
    363                                                         PBXBookColumnIdentifier,
    364                                                         20,
    365                                                         PBXMethodColumnIdentifier,
    366                                                         236,
    367                                                 );
    368                                         };
    369                                         Tab2 = {
    370                                                 Frame = "{{0, 0}, {200, 100}}";
    371                                         };
    372                                         Tab3 = {
    373                                                 Frame = "{{0, 0}, {200, 557}}";
    374                                                 TargetTableConfiguration = (
    375                                                         ActiveObject,
    376                                                         16,
    377                                                         ObjectNames,
    378                                                         202.296,
    379                                                 );
    380                                         };
    381                                         Tab4 = {
    382                                                 BreakpointsTreeTableConfiguration = (
    383                                                         breakpointColumn,
    384                                                         197,
    385                                                         enabledColumn,
    386                                                         31,
    387                                                 );
    388                                                 Frame = "{{0, 0}, {250, 100}}";
    389                                         };
    390                                         TabCount = 5;
    391                                         TabsVisible = NO;
    392                                 };
    393                                 NavBarShownByDefault = YES;
    394                                 StatusViewVisible = NO;
    395                                 Template = F5CA7ECB015C094F0DCA290F;
    396                                 ToolbarVisible = NO;
    397                                 WindowLocation = "{687, 68}";
    398                         };
    399                         "PBXTemplateGeometry-F5E465990156DFB90DCA290F" = {
    400                                 ContentSize = "{352, 553}";
    401                                 LeftSlideOut = {
    402                                         ActiveTab = 0;
    403                                         ActiveTabName = PBXGroupTreeModule;
    404                                         Collapsed = YES;
    405                                         Frame = "{{0, 23}, {352, 530}}";
    406                                         Split0 = {
    407                                                 Collapsed = NO;
    408                                                 Frame = "{{1e+06, 1e+06}, {0, 530}}";
    409                                                 Split0 = {
    410                                                         Frame = "{{0, 0}, {0, 530}}";
    411                                                 };
    412                                                 SplitCount = 1;
    413                                                 Tab0 = {
    414                                                         Frame = "{{0, 0}, {484, 208}}";
    415                                                 };
    416                                                 Tab1 = {
    417                                                         Debugger = {
    418                                                                 Collapsed = NO;
    419                                                                 Frame = "{{0, 0}, {664, 208}}";
    420                                                                 Split0 = {
    421                                                                         Frame = "{{0, 24}, {664, 184}}";
    422                                                                         Split0 = {
    423                                                                                 Frame = "{{0, 0}, {325, 184}}";
    424                                                                         };
    425                                                                         Split1 = {
    426                                                                                 DebugVariablesTableConfiguration = (
    427                                                                                         Name,
    428                                                                                         123,
    429                                                                                         Value,
    430                                                                                         85,
    431                                                                                         Summary,
    432                                                                                         96.123,
    433                                                                                 );
    434                                                                                 Frame = "{{334, 0}, {330, 184}}";
    435                                                                         };
    436                                                                         SplitCount = 2;
    437                                                                 };
    438                                                                 SplitCount = 1;
    439                                                                 Tab0 = {
    440                                                                         Frame = "{{0, 0}, {100, 50}}";
    441                                                                 };
    442                                                                 Tab1 = {
    443                                                                         Frame = "{{0, 0}, {100, 50}}";
    444                                                                 };
    445                                                                 TabCount = 2;
    446                                                                 TabsVisible = YES;
    447                                                         };
    448                                                         Frame = "{{0, 0}, {664, 208}}";
    449                                                         LauncherConfigVersion = 7;
    450                                                 };
    451                                                 Tab2 = {
    452                                                         Frame = "{{0, 0}, {664, 50}}";
    453                                                         LauncherConfigVersion = 3;
    454                                                         Runner = {
    455                                                                 Frame = "{{0, 0}, {664, 50}}";
    456                                                         };
    457                                                 };
    458                                                 Tab3 = {
    459                                                         BuildMessageFrame = "{{0, 0}, {614, 262}}";
    460                                                         BuildTranscriptFrame = "{{0, 271}, {614, 2}}";
    461                                                         BuildTranscriptFrameExpanded = YES;
    462                                                         Frame = "{{0, 0}, {612, 295}}";
    463                                                 };
    464                                                 Tab4 = {
    465                                                         Frame = "{{0, 0}, {612, 295}}";
    466                                                 };
    467                                                 TabCount = 5;
    468                                                 TabsVisible = NO;
    469                                         };
    470                                         SplitCount = 1;
    471                                         Tab0 = {
    472                                                 Frame = "{{0, 0}, {328, 530}}";
    473                                                 GroupTreeTableConfiguration = (
    474                                                         TargetStatusColumn,
    475                                                         18,
    476                                                         MainColumn,
    477                                                         295,
    478                                                 );
    479                                         };
    480                                         Tab1 = {
    481                                                 ClassesFrame = "{{0, 0}, {343, 348}}";
    482                                                 ClassesTreeTableConfiguration = (
    483                                                         PBXBookColumnIdentifier,
    484                                                         20,
    485                                                         PBXClassColumnIdentifier,
    486                                                         300,
    487                                                 );
    488                                                 Frame = "{{0, 0}, {341, 578}}";
    489                                                 MembersFrame = "{{0, 357}, {343, 221}}";
    490                                                 MembersTreeTableConfiguration = (
    491                                                         PBXBookColumnIdentifier,
    492                                                         20,
    493                                                         PBXMethodColumnIdentifier,
    494                                                         299,
    495                                                 );
    496                                         };
    497                                         Tab2 = {
    498                                                 Frame = "{{0, 0}, {319, 576}}";
    499                                         };
    500                                         Tab3 = {
    501                                                 Frame = "{{0, 0}, {341, 578}}";
    502                                                 TargetTableConfiguration = (
    503                                                         ActiveObject,
    504                                                         16,
    505                                                         ObjectNames,
    506                                                         308.296,
    507                                                 );
    508                                         };
    509                                         Tab4 = {
    510                                                 BreakpointsTreeTableConfiguration = (
    511                                                         breakpointColumn,
    512                                                         266,
    513                                                         enabledColumn,
    514                                                         31,
    515                                                 );
    516                                                 Frame = "{{0, 0}, {319, 576}}";
    517                                         };
    518                                         TabCount = 5;
    519                                         TabsVisible = YES;
    520                                 };
    521                                 NavBarShownByDefault = YES;
    522                                 StatusViewVisible = YES;
    523                                 Template = F5E465990156DFB90DCA290F;
    524                                 ToolbarVisible = YES;
    525                                 WindowLocation = "{19, 217}";
    526                         };
     16                        PBXPerProjectTemplateStateSaveDate = 67398120;
    52717                        PBXWorkspaceContents = (
    52818                                {
     
    53121                                                        Split0 = {
    53222                                                                NavContent0 = {
    533                                                                         bookmark = E16C83ED03F83AD700050002;
     23                                                                        bookmark = E1098C8203FDAAC300050002;
    53424                                                                        history = (
    53525                                                                                E16C83D103F83AD700050002,
     
    54434                                                                                E16C83DA03F83AD700050002,
    54535                                                                                E16C83DB03F83AD700050002,
    546                                                                                 E16C83DC03F83AD700050002,
    54736                                                                                E16C83DD03F83AD700050002,
    54837                                                                                E16C83DE03F83AD700050002,
    54938                                                                                E16C83DF03F83AD700050002,
    550                                                                                 E16C83E003F83AD700050002,
     39                                                                                E16C840303FB5E7100050002,
     40                                                                                E16C842A03FB74A500050002,
     41                                                                                E132404B03FD7BD400050002,
     42                                                                        );
     43                                                                        nextStack = (
     44                                                                                E16C842C03FB74A500050002,
    55145                                                                        );
    55246                                                                        prevStack = (
     
    761255                                        Template = 64ABBB4501FA494900185B06;
    762256                                        ToolbarVisible = YES;
    763                                         WindowLocation = "{21, 114}";
     257                                        WindowLocation = "{4, 111}";
    764258                                },
    765259                                {
     
    892386                                },
    893387                        );
    894                         PBXWorkspaceStateSaveDate = 66554412;
     388                        PBXWorkspaceStateSaveDate = 67398120;
    895389                };
    896390                perUserProjectItems = {
     391                        E1098C8203FDAAC300050002 = E1098C8203FDAAC300050002;
     392                        E132404B03FD7BD400050002 = E132404B03FD7BD400050002;
    897393                        E16C83D103F83AD700050002 = E16C83D103F83AD700050002;
    898394                        E16C83D203F83AD700050002 = E16C83D203F83AD700050002;
     
    906402                        E16C83DA03F83AD700050002 = E16C83DA03F83AD700050002;
    907403                        E16C83DB03F83AD700050002 = E16C83DB03F83AD700050002;
    908                         E16C83DC03F83AD700050002 = E16C83DC03F83AD700050002;
    909404                        E16C83DD03F83AD700050002 = E16C83DD03F83AD700050002;
    910405                        E16C83DE03F83AD700050002 = E16C83DE03F83AD700050002;
    911406                        E16C83DF03F83AD700050002 = E16C83DF03F83AD700050002;
    912                         E16C83E003F83AD700050002 = E16C83E003F83AD700050002;
    913407                        E16C83E103F83AD700050002 = E16C83E103F83AD700050002;
    914408                        E16C83E203F83AD700050002 = E16C83E203F83AD700050002;
     
    923417                        E16C83EB03F83AD700050002 = E16C83EB03F83AD700050002;
    924418                        E16C83EC03F83AD700050002 = E16C83EC03F83AD700050002;
    925                         E16C83ED03F83AD700050002 = E16C83ED03F83AD700050002;
     419                        E16C840303FB5E7100050002 = E16C840303FB5E7100050002;
     420                        E16C842A03FB74A500050002 = E16C842A03FB74A500050002;
     421                        E16C842C03FB74A500050002 = E16C842C03FB74A500050002;
    926422                };
    927423                projectwideBuildSettings = {
     
    936432                );
    937433        };
     434        E1098C8203FDAAC300050002 = {
     435                fRef = 08FB7796FE84155DC02AAC07;
     436                isa = PBXTextBookmark;
     437                name = "main.c: matchApplication";
     438                rLen = 0;
     439                rLoc = 11680;
     440                rType = 0;
     441                vrLen = 1813;
     442                vrLoc = 10964;
     443        };
     444        E132404B03FD7BD400050002 = {
     445                fRef = 08FB7796FE84155DC02AAC07;
     446                isa = PBXTextBookmark;
     447                name = "main.c: matchApplication";
     448                rLen = 0;
     449                rLoc = 11680;
     450                rType = 0;
     451                vrLen = 1716;
     452                vrLoc = 11138;
     453        };
    938454        E16C83D103F83AD700050002 = {
    939455                fRef = E16C83EF03F83AD700050002;
     
    1046562                vrLoc = 0;
    1047563        };
    1048         E16C83DC03F83AD700050002 = {
    1049                 fRef = E1A0BD3203EFAD9E00050001;
    1050                 isa = PBXTextBookmark;
    1051                 name = "CPS.h: 281";
    1052                 rLen = 0;
    1053                 rLoc = 4865;
    1054                 rType = 0;
    1055                 vrLen = 1136;
    1056                 vrLoc = 4090;
    1057         };
    1058564        E16C83DD03F83AD700050002 = {
    1059565                fRef = E16C83EE03F83AD700050002;
     
    1086592                vrLoc = 2592;
    1087593        };
    1088         E16C83E003F83AD700050002 = {
    1089                 fRef = 08FB7796FE84155DC02AAC07;
    1090                 isa = PBXTextBookmark;
    1091                 name = "main.c: 117";
    1092                 rLen = 0;
    1093                 rLoc = 4782;
    1094                 rType = 0;
    1095                 vrLen = 1813;
    1096                 vrLoc = 0;
    1097         };
    1098594        E16C83E103F83AD700050002 = {
    1099595                fRef = E1A0BD3203EFAD9E00050001;
     
    1131627                name = "main.c: main";
    1132628                rLen = 0;
    1133                 rLoc = 12674;
     629                rLoc = 16052;
    1134630                rType = 0;
    1135631                vrLen = 1650;
     
    1151647                name = "main.c: matchApplication";
    1152648                rLen = 0;
    1153                 rLoc = 10201;
     649                rLoc = 12708;
    1154650                rType = 0;
    1155651                vrLen = 1426;
     
    1161657                name = "main.c: 51";
    1162658                rLen = 0;
    1163                 rLoc = 2325;
     659                rLoc = 2379;
    1164660                rType = 0;
    1165661                vrLen = 801;
     
    1191687                name = "main.c: 117";
    1192688                rLen = 0;
    1193                 rLoc = 4782;
     689                rLoc = 5052;
    1194690                rType = 0;
    1195691                vrLen = 1813;
     
    1216712                vrLoc = 2592;
    1217713        };
    1218         E16C83ED03F83AD700050002 = {
    1219                 fRef = 08FB7796FE84155DC02AAC07;
    1220                 isa = PBXTextBookmark;
    1221                 name = "main.c: 18";
    1222                 rLen = 0;
    1223                 rLoc = 1589;
    1224                 rType = 0;
    1225                 vrLen = 1813;
    1226                 vrLoc = 0;
    1227         };
    1228714        E16C83EE03F83AD700050002 = {
    1229715                isa = PBXFileReference;
     
    1296782                name = NSFileManager.h;
    1297783                path = /System/Library/Frameworks/Foundation.framework/Versions/C/Headers/NSFileManager.h;
     784                refType = 0;
     785        };
     786        E16C840303FB5E7100050002 = {
     787                fRef = E1A0BD3203EFAD9E00050001;
     788                isa = PBXTextBookmark;
     789                name = "CPS.h: 156";
     790                rLen = 13;
     791                rLoc = 2465;
     792                rType = 0;
     793                vrLen = 622;
     794                vrLoc = 2176;
     795        };
     796        E16C842A03FB74A500050002 = {
     797                fRef = E16C842F03FB74A500050002;
     798                isa = PBXTextBookmark;
     799                name = "CFString.h: 252";
     800                rLen = 142;
     801                rLoc = 12196;
     802                rType = 0;
     803                vrLen = 2097;
     804                vrLoc = 10692;
     805        };
     806        E16C842C03FB74A500050002 = {
     807                fRef = E16C842E03FB74A500050002;
     808                isa = PBXTextBookmark;
     809                name = "CFString.h: 252";
     810                rLen = 142;
     811                rLoc = 12196;
     812                rType = 0;
     813                vrLen = 2097;
     814                vrLoc = 10692;
     815        };
     816        E16C842E03FB74A500050002 = {
     817                isa = PBXFileReference;
     818                name = CFString.h;
     819                path = /System/Library/Frameworks/CoreFoundation.framework/Versions/A/Headers/CFString.h;
     820                refType = 0;
     821        };
     822        E16C842F03FB74A500050002 = {
     823                isa = PBXFileReference;
     824                name = CFString.h;
     825                path = /System/Library/Frameworks/CoreFoundation.framework/Versions/A/Headers/CFString.h;
    1298826                refType = 0;
    1299827        };
  • trunk/appswitch/appswitch/main.c

    r97 r99  
    2424const char *APP_NAME;
    2525
    26 #define VERSION "1.0b2"
     26#define VERSION "1.0"
    2727
    2828struct {
     
    3636    } matchType;
    3737    enum {
    38         APP_NONE, APP_SWITCH, APP_SHOW, APP_HIDE, APP_KILL, APP_LIST, APP_PRINT_PID
     38        APP_NONE, APP_SWITCH, APP_SHOW, APP_HIDE, APP_QUIT, APP_KILL, APP_KILL_HARD, APP_LIST, APP_PRINT_PID
    3939    } appAction;
     40    Boolean longList;
    4041    enum {
    4142        ACTION_NONE, ACTION_SHOW_ALL, ACTION_HIDE_OTHERS
     
    4647} OPTS =
    4748{
    48     kLSUnknownCreator, NULL, NULL, -1, NULL, MATCH_UNKNOWN, APP_NONE, ACTION_NONE, FINAL_NONE
     49    kLSUnknownCreator, NULL, NULL, -1, NULL, MATCH_UNKNOWN, APP_NONE, ACTION_NONE, FINAL_NONE, false
    4950};
    5051
     
    7071            "  -h            hide application\n"
    7172            "  -H            hide other applications\n"
    72             "  -k            kill application\n"
     73            "  -q            quit application\n"
     74            "  -k            kill application (SIGINT)\n"
     75            "  -K            kill application hard (SIGKILL)\n"
    7376            "  -l            list applications\n"
     77            "  -L            list applications including full paths and bundle identifiers\n"
    7478            "  -P            print application process ID\n"
    7579            "  -F            bring current application's windows to front\n"
     
    132136    if (argc == 1) usage();
    133137
    134     const char *opts = "c:i:p:a:sShHklPF";
     138    const char *opts = "c:i:p:a:sShHqkKlLPF";
    135139
    136140    while ( (ch = getopt(argc, argv, opts)) != -1) {
     
    159163                break;
    160164            case 's':
    161                 if (OPTS.appAction != APP_NONE) errexit("choose only one of -s, -h, -k, -l, -P options");
     165                if (OPTS.appAction != APP_NONE) errexit("choose only one of -s, -h, -q, -k, -K, -l, -L, -P options");
    162166                OPTS.appAction = APP_SHOW;
    163167                break;
    164168            case 'h':
    165                 if (OPTS.appAction != APP_NONE) errexit("choose only one of -s, -h, -k, -l, -P options");
     169                if (OPTS.appAction != APP_NONE) errexit("choose only one of -s, -h, -q, -k, -K, -l, -L, -P options");
    166170                OPTS.appAction = APP_HIDE;
    167171                break;
     172            case 'q':
     173                if (OPTS.appAction != APP_NONE) errexit("choose only one of -s, -h, -q, -k, -K, -l, -L, -P options");
     174                OPTS.appAction = APP_QUIT;
     175                break;
    168176            case 'k':
    169                 if (OPTS.appAction != APP_NONE) errexit("choose only one of -s, -h, -k, -l, -P options");
     177                if (OPTS.appAction != APP_NONE) errexit("choose only one of -s, -h, -q, -k, -K, -l, -L, -P options");
    170178                OPTS.appAction = APP_KILL;
    171179                break;
     180            case 'K':
     181                if (OPTS.appAction != APP_NONE) errexit("choose only one of -s, -h, -q, -k, -K, -l, -L, -P options");
     182                OPTS.appAction = APP_KILL_HARD;
     183                break;
    172184            case 'l':
    173                 if (OPTS.appAction != APP_NONE) errexit("choose only one of -s, -h, -k, -l, -P options");
     185                if (OPTS.appAction != APP_NONE) errexit("choose only one of -s, -h, -q, -k, -K, -l, -L, -P options");
    174186                OPTS.appAction = APP_LIST;
    175187                break;
     188            case 'L':
     189                if (OPTS.appAction != APP_NONE) errexit("choose only one of -s, -h, -q, -k, -K, -l, -L, -P options");
     190                OPTS.appAction = APP_LIST;
     191                OPTS.longList = true;
     192                break;
    176193            case 'P':
    177                 if (OPTS.appAction != APP_NONE) errexit("choose only one of -s, -h, -k, -l, -P options");
     194                if (OPTS.appAction != APP_NONE) errexit("choose only one of -s, -h, -q, -k, -K, -l, -P options");
    178195                OPTS.appAction = APP_PRINT_PID;
    179196                break;
     
    227244}
    228245
     246Boolean bundleIdentifierForApplication(CFStringRef *bundleID, char *path) {
     247    CFURLRef url = CFURLCreateFromFileSystemRepresentation(NULL, path, strlen(path), false);
     248    if (url == NULL) return false;
     249    CFBundleRef bundle = CFBundleCreate(NULL, url);
     250    if (bundle != NULL) {
     251        *bundleID = CFBundleGetIdentifier(bundle);
     252#if DEBUG
     253        CFShow(*bundleID);
     254#endif
     255    }
     256    CFRelease(url);
     257    return true;
     258}
     259
     260OSStatus quitApplication(CPSProcessSerNum *psn) {
     261    AppleEvent event;
     262    AEAddressDesc appDesc;
     263    OSStatus err;
     264
     265    AEInitializeDesc(&appDesc);
     266    err = AECreateDesc(typeProcessSerialNumber, psn, sizeof(*psn), &appDesc);
     267    if (err != noErr) return err;
     268
     269    // XXX AECreateAppleEvent is very slow in Mac OS X 10.2.4 and earlier.
     270    // XXX This is Apple's bug: <http://lists.apple.com/archives/applescript-implementors/2003/Feb/19/aecreateappleeventfromco.txt>
     271    err = AECreateAppleEvent(kCoreEventClass, kAEQuitApplication, &appDesc, kAutoGenerateReturnID, kAnyTransactionID, &event);
     272    if (err != noErr) return err;
     273
     274    AppleEvent nullReply = {typeNull, nil};
     275    err = AESendMessage(&event, &nullReply, kAENoReply, kNoTimeOut);
     276    (void)AEDisposeDesc(&event);
     277    if (err != noErr) return err;
     278
     279    (void)AEDisposeDesc(&nullReply); // according to docs, don't call unless AESend returned successfully
     280
     281    return noErr;
     282}
     283
    229284CPSProcessSerNum matchApplication(CPSProcessInfoRec *info) {
    230285    long pathMaxLength = pathconf("/", _PC_PATH_MAX);
     
    249304        char *banner = "       PSN   PID TYPE CREA NAME                ";
    250305                     // 12345678.0 12345 1234 1234 12345678901234567890
    251         printf("%s PATH\n", banner);
    252306        if ((ioctl(STDOUT_FILENO, TIOCGWINSZ, (char *)&ws) != -1 ||
    253307             ioctl(STDERR_FILENO, TIOCGWINSZ, (char *)&ws) != -1 ||
    254308             ioctl(STDIN_FILENO,  TIOCGWINSZ, (char *)&ws) != -1) ||
    255309            ws.ws_col != 0) termwidth = ws.ws_col;
     310        char *formatButPath = "%8ld.%ld %5ld %c%c%c%c %c%c%c%c %-20.20s";
    256311        int pathlen = termwidth - strlen(banner) - 1;
    257         asprintf(&format, "%%8ld.%%ld %%5ld %%c%%c%%c%%c %%c%%c%%c%%c %%-20.20s %%-%d.%ds\n", pathlen, pathlen);
     312        // XXX don't ever free 'format', should fix if we get called repeatedly
     313        if (OPTS.longList) {
     314            printf("%s PATH (bundle identifier)\n", banner);
     315            asprintf(&format, "%s %%s", formatButPath);
     316        } else if (pathlen >= 4) {
     317            printf("%s PATH\n", banner);
     318            asprintf(&format, "%s %%-%d.%ds", formatButPath, pathlen, pathlen);
     319        } else {
     320            format = formatButPath;
     321        }
    258322    }
    259323   
     
    279343            case MATCH_BUNDLE_ID:
    280344               {
    281                    CFURLRef url = CFURLCreateFromFileSystemRepresentation(NULL, path, strlen(path), false);
    282                    if (url == NULL) errexit("can't get bundle location for process '%s' (PSN %ld.%ld, pid %ld)", name, psn.hi, psn.lo, info->UnixPID);
    283                    CFBundleRef bundle = CFBundleCreate(NULL, url);
    284                    if (bundle != NULL) {
    285                        CFStringRef bundleID = CFBundleGetIdentifier(bundle);
    286 #if DEBUG
    287                        CFShow(bundleID);
    288 #endif
    289                        if (bundleID != NULL && CFStringCompare(OPTS.bundleID, bundleID, kCFCompareCaseInsensitive) == kCFCompareEqualTo)
    290                            break;
    291                    }
    292                    CFRelease(url);
     345                   CFStringRef bundleID;
     346                   if (!bundleIdentifierForApplication(&bundleID, path))
     347                       errexit("can't get bundle location for process '%s' (PSN %ld.%ld, pid %ld)", name, psn.hi, psn.lo, info->UnixPID);
     348                   if (bundleID != NULL && CFStringCompare(OPTS.bundleID, bundleID, kCFCompareCaseInsensitive) == kCFCompareEqualTo)
     349                       break;
    293350                   continue;
    294351               }
     
    298355        if (OPTS.appAction == APP_LIST) {
    299356            char *type = (char *)&(info->ExecFileType), *crea = (char *)&(info->ExecFileCreator);
    300 #define CXX(c) ( (c) < ' ' ? '?' : (c) )
     357#define CXX(c) ( (c) < ' ' ? ' ' : (c) )
    301358#define OSTYPE_CHAR_ARGS(t) CXX(t[0]), CXX(t[1]), CXX(t[2]), CXX(t[3])
    302359            printf(format, psn.hi, psn.lo, info->UnixPID,
    303360                   OSTYPE_CHAR_ARGS(type), OSTYPE_CHAR_ARGS(crea),
    304361                   name, path);
     362            if (OPTS.longList) {
     363                CFStringRef bundleID = NULL;
     364                if (!bundleIdentifierForApplication(&bundleID, path))
     365                    errexit("can't get bundle location for process '%s' (PSN %ld.%ld, pid %ld)", name, psn.hi, psn.lo, info->UnixPID);
     366                if (bundleID != NULL) {
     367                    char *bundleIDStr = (char *)CFStringGetCStringPtr(bundleID, CFStringGetSystemEncoding());
     368                    if (bundleIDStr == NULL) {
     369                        CFIndex bundleIDLength = CFStringGetLength(bundleID) + 1;
     370                        bundleIDStr = (char *)malloc(bundleIDLength * sizeof(char));
     371                        if (!CFStringGetCString(bundleID, bundleIDStr, bundleIDLength, CFStringGetSystemEncoding())) {
     372                            CFShow(bundleIDStr);
     373                            errexit("internal error: string encoding conversion failed for bundle identifier");
     374                        }
     375                        printf(" (%s)", bundleIDStr);
     376                        free(bundleIDStr);
     377                    } else {
     378                        printf(" (%s)", bundleIDStr);
     379                    }
     380                    CFRelease(bundleID);
     381                }
     382            }
     383            putchar('\n');
    305384            continue;
    306385        }
     
    334413        case APP_SHOW: err = CPSPostShowReq(&psn); verb = "show"; break;
    335414        case APP_HIDE: err = CPSPostHideReq(&psn); verb = "hide"; break;
     415        case APP_QUIT: err = quitApplication(&psn); verb = "quit"; break;
    336416        case APP_KILL: err = CPSPostKillRequest(&psn, kNilOptions); verb = "kill"; break;
     417        case APP_KILL_HARD: err = CPSPostKillRequest(&psn, bfCPSKillHard); verb = "kill"; break;
    337418        case APP_PRINT_PID:
    338419            if (info.UnixPID <= 0) errexit("can't get process ID");
Note: See TracChangeset for help on using the changeset viewer.