Changeset 99 for trunk/appswitch
- Timestamp:
- 02/20/03 02:08:05 (22 years ago)
- Location:
- trunk/appswitch/appswitch
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/appswitch/appswitch/README
r97 r99 1 appswitch 1.0 b2 [11February 2003]2 ============= ==1 appswitch 1.0 [19 February 2003] 2 ============= 3 3 4 4 A command-line interface to the Mac OS X process manager. … … 73 73 --------------- 74 74 75 1.0 - 19 February 2003 76 - added description of -q delay bug (no workaround) 77 1.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 75 82 1.0b2 - 11 February 2003 76 83 - display ? characters for unprintable creator code characters -
trunk/appswitch/appswitch/VERSION
r97 r99 1 1.0b 21 1.0b3 -
trunk/appswitch/appswitch/appswitch.1
r97 r99 1 .Dd Mon Feb 11 2003\" DATE2 .Dt APPSWITCH 1 LOCAL 3 .Os appswitch 1.0 b21 .Dd Wed Feb 19 2003 \" DATE 2 .Dt APPSWITCH 1 LOCAL \" Program name and manual section number 3 .Os appswitch 1.0 4 4 .Sh NAME 5 5 .Nm appswitch … … 7 7 .Sh SYNOPSIS 8 8 .Nm appswitch 9 .Op Fl sShH kFlP \" [-sShHkFlP]9 .Op Fl sShHqkKFlLP \" [-sShHqkKFlLP] 10 10 .Op Fl c Ar creator \" [-c creator] 11 11 .Op Fl i Ar bundleID \" [-i bundleID] … … 34 34 match method is faster than a match by bundle identifier. 35 35 .It Fl p Ar pid 36 Match by process identifier, a positive number.36 Match by process identifier, a positive integer. 37 37 .It Ar path 38 38 Match by bundle path. For packaged applications, this is the package … … 50 50 .Bl -tag -width -indent 51 51 .It Fl s 52 Show the application, making the application's windows frontmost. Do52 Show the application, making the application's windows frontmost. Do 53 53 not switch to the application. 54 54 .It Fl h 55 55 Hide the application's windows. 56 .It Fl q 57 Quit the application. 56 58 .It Fl k 57 Kill (force quit) the application. 59 Kill (force quit) the application. Sends the 60 .Dv SIGINT 61 signal to the application, which the application may 62 ignore. Equivalent to selecting 63 .Dq Force Quit 64 from an application's menu in the Dock for the first time. 65 .It Fl K 66 Kill (force quit) the application. Sends the 67 .Dv SIGKILL 68 signal to the application, which the application may not ignore. 69 Equivalent to selecting 70 .Dq Force Quit 71 from an application's menu in the Dock for the second time. 58 72 .It Fl l 59 73 List applications in a format similar to that of 60 .Xr ps 1 . The columns of the listing are as follows: 74 .Xr ps 1 . 75 The columns of the listing are as follows: 61 76 .Bl -tag -width indent 62 77 .It PSN … … 65 80 applications. 66 81 .It PID 67 The process identifier, a positive number which uniquely identifies82 The process identifier, a positive integer which uniquely identifies 68 83 native Mac OS X processes, usable with the 69 84 .Fl p … … 103 118 characters if the window width cannot be determined. 104 119 .El 120 .It Fl L 121 List applications in a format similar to that of 122 .Xr ps 1 . 123 The columns of the listing are as above, but the path field is not 124 truncated to the window width, and a bundle identifier is added in 125 parentheses after the path, usable with the 126 .Fl i 127 matching option. 105 128 .It Fl P 106 Print the application's process identifier (PID), a positive number129 Print the application's process identifier (PID), a positive integer 107 130 and unique identifier for all applications except Classic 108 131 applications. … … 135 158 .Xr sleep 1 136 159 command before it. 137 .Sh AUTHORS 160 .Pp 161 The 162 .Fl q 163 option is very slow on Mac OS X 10.2.4 and earlier; this is an 164 acknowledged bug in AECreateAppleEvent with no known workaround. Chris 165 Espinosa from Apple has stated that they plan to fix it in a future 166 release. 167 .Sh AUTHOR 138 168 .An "Nicholas Riley" Aq appswitch@sabi.net 139 169 .\" .Sh HISTORY \" Document history if command behaves in a unique manner -
trunk/appswitch/appswitch/appswitch.pbproj/nicholas.pbxuser
r92 r99 14 14 ); 15 15 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; 527 17 PBXWorkspaceContents = ( 528 18 { … … 531 21 Split0 = { 532 22 NavContent0 = { 533 bookmark = E1 6C83ED03F83AD700050002;23 bookmark = E1098C8203FDAAC300050002; 534 24 history = ( 535 25 E16C83D103F83AD700050002, … … 544 34 E16C83DA03F83AD700050002, 545 35 E16C83DB03F83AD700050002, 546 E16C83DC03F83AD700050002,547 36 E16C83DD03F83AD700050002, 548 37 E16C83DE03F83AD700050002, 549 38 E16C83DF03F83AD700050002, 550 E16C83E003F83AD700050002, 39 E16C840303FB5E7100050002, 40 E16C842A03FB74A500050002, 41 E132404B03FD7BD400050002, 42 ); 43 nextStack = ( 44 E16C842C03FB74A500050002, 551 45 ); 552 46 prevStack = ( … … 761 255 Template = 64ABBB4501FA494900185B06; 762 256 ToolbarVisible = YES; 763 WindowLocation = "{ 21, 114}";257 WindowLocation = "{4, 111}"; 764 258 }, 765 259 { … … 892 386 }, 893 387 ); 894 PBXWorkspaceStateSaveDate = 6 6554412;388 PBXWorkspaceStateSaveDate = 67398120; 895 389 }; 896 390 perUserProjectItems = { 391 E1098C8203FDAAC300050002 = E1098C8203FDAAC300050002; 392 E132404B03FD7BD400050002 = E132404B03FD7BD400050002; 897 393 E16C83D103F83AD700050002 = E16C83D103F83AD700050002; 898 394 E16C83D203F83AD700050002 = E16C83D203F83AD700050002; … … 906 402 E16C83DA03F83AD700050002 = E16C83DA03F83AD700050002; 907 403 E16C83DB03F83AD700050002 = E16C83DB03F83AD700050002; 908 E16C83DC03F83AD700050002 = E16C83DC03F83AD700050002;909 404 E16C83DD03F83AD700050002 = E16C83DD03F83AD700050002; 910 405 E16C83DE03F83AD700050002 = E16C83DE03F83AD700050002; 911 406 E16C83DF03F83AD700050002 = E16C83DF03F83AD700050002; 912 E16C83E003F83AD700050002 = E16C83E003F83AD700050002;913 407 E16C83E103F83AD700050002 = E16C83E103F83AD700050002; 914 408 E16C83E203F83AD700050002 = E16C83E203F83AD700050002; … … 923 417 E16C83EB03F83AD700050002 = E16C83EB03F83AD700050002; 924 418 E16C83EC03F83AD700050002 = E16C83EC03F83AD700050002; 925 E16C83ED03F83AD700050002 = E16C83ED03F83AD700050002; 419 E16C840303FB5E7100050002 = E16C840303FB5E7100050002; 420 E16C842A03FB74A500050002 = E16C842A03FB74A500050002; 421 E16C842C03FB74A500050002 = E16C842C03FB74A500050002; 926 422 }; 927 423 projectwideBuildSettings = { … … 936 432 ); 937 433 }; 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 }; 938 454 E16C83D103F83AD700050002 = { 939 455 fRef = E16C83EF03F83AD700050002; … … 1046 562 vrLoc = 0; 1047 563 }; 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 };1058 564 E16C83DD03F83AD700050002 = { 1059 565 fRef = E16C83EE03F83AD700050002; … … 1086 592 vrLoc = 2592; 1087 593 }; 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 };1098 594 E16C83E103F83AD700050002 = { 1099 595 fRef = E1A0BD3203EFAD9E00050001; … … 1131 627 name = "main.c: main"; 1132 628 rLen = 0; 1133 rLoc = 1 2674;629 rLoc = 16052; 1134 630 rType = 0; 1135 631 vrLen = 1650; … … 1151 647 name = "main.c: matchApplication"; 1152 648 rLen = 0; 1153 rLoc = 1 0201;649 rLoc = 12708; 1154 650 rType = 0; 1155 651 vrLen = 1426; … … 1161 657 name = "main.c: 51"; 1162 658 rLen = 0; 1163 rLoc = 23 25;659 rLoc = 2379; 1164 660 rType = 0; 1165 661 vrLen = 801; … … 1191 687 name = "main.c: 117"; 1192 688 rLen = 0; 1193 rLoc = 4782;689 rLoc = 5052; 1194 690 rType = 0; 1195 691 vrLen = 1813; … … 1216 712 vrLoc = 2592; 1217 713 }; 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 };1228 714 E16C83EE03F83AD700050002 = { 1229 715 isa = PBXFileReference; … … 1296 782 name = NSFileManager.h; 1297 783 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; 1298 826 refType = 0; 1299 827 }; -
trunk/appswitch/appswitch/main.c
r97 r99 24 24 const char *APP_NAME; 25 25 26 #define VERSION "1.0 b2"26 #define VERSION "1.0" 27 27 28 28 struct { … … 36 36 } matchType; 37 37 enum { 38 APP_NONE, APP_SWITCH, APP_SHOW, APP_HIDE, APP_ KILL, APP_LIST, APP_PRINT_PID38 APP_NONE, APP_SWITCH, APP_SHOW, APP_HIDE, APP_QUIT, APP_KILL, APP_KILL_HARD, APP_LIST, APP_PRINT_PID 39 39 } appAction; 40 Boolean longList; 40 41 enum { 41 42 ACTION_NONE, ACTION_SHOW_ALL, ACTION_HIDE_OTHERS … … 46 47 } OPTS = 47 48 { 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 49 50 }; 50 51 … … 70 71 " -h hide application\n" 71 72 " -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" 73 76 " -l list applications\n" 77 " -L list applications including full paths and bundle identifiers\n" 74 78 " -P print application process ID\n" 75 79 " -F bring current application's windows to front\n" … … 132 136 if (argc == 1) usage(); 133 137 134 const char *opts = "c:i:p:a:sShH klPF";138 const char *opts = "c:i:p:a:sShHqkKlLPF"; 135 139 136 140 while ( (ch = getopt(argc, argv, opts)) != -1) { … … 159 163 break; 160 164 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"); 162 166 OPTS.appAction = APP_SHOW; 163 167 break; 164 168 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"); 166 170 OPTS.appAction = APP_HIDE; 167 171 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; 168 176 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"); 170 178 OPTS.appAction = APP_KILL; 171 179 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; 172 184 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"); 174 186 OPTS.appAction = APP_LIST; 175 187 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; 176 193 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"); 178 195 OPTS.appAction = APP_PRINT_PID; 179 196 break; … … 227 244 } 228 245 246 Boolean 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 260 OSStatus 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 229 284 CPSProcessSerNum matchApplication(CPSProcessInfoRec *info) { 230 285 long pathMaxLength = pathconf("/", _PC_PATH_MAX); … … 249 304 char *banner = " PSN PID TYPE CREA NAME "; 250 305 // 12345678.0 12345 1234 1234 12345678901234567890 251 printf("%s PATH\n", banner);252 306 if ((ioctl(STDOUT_FILENO, TIOCGWINSZ, (char *)&ws) != -1 || 253 307 ioctl(STDERR_FILENO, TIOCGWINSZ, (char *)&ws) != -1 || 254 308 ioctl(STDIN_FILENO, TIOCGWINSZ, (char *)&ws) != -1) || 255 309 ws.ws_col != 0) termwidth = ws.ws_col; 310 char *formatButPath = "%8ld.%ld %5ld %c%c%c%c %c%c%c%c %-20.20s"; 256 311 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 } 258 322 } 259 323 … … 279 343 case MATCH_BUNDLE_ID: 280 344 { 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; 293 350 continue; 294 351 } … … 298 355 if (OPTS.appAction == APP_LIST) { 299 356 char *type = (char *)&(info->ExecFileType), *crea = (char *)&(info->ExecFileCreator); 300 #define CXX(c) ( (c) < ' ' ? ' ?' : (c) )357 #define CXX(c) ( (c) < ' ' ? ' ' : (c) ) 301 358 #define OSTYPE_CHAR_ARGS(t) CXX(t[0]), CXX(t[1]), CXX(t[2]), CXX(t[3]) 302 359 printf(format, psn.hi, psn.lo, info->UnixPID, 303 360 OSTYPE_CHAR_ARGS(type), OSTYPE_CHAR_ARGS(crea), 304 361 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'); 305 384 continue; 306 385 } … … 334 413 case APP_SHOW: err = CPSPostShowReq(&psn); verb = "show"; break; 335 414 case APP_HIDE: err = CPSPostHideReq(&psn); verb = "hide"; break; 415 case APP_QUIT: err = quitApplication(&psn); verb = "quit"; break; 336 416 case APP_KILL: err = CPSPostKillRequest(&psn, kNilOptions); verb = "kill"; break; 417 case APP_KILL_HARD: err = CPSPostKillRequest(&psn, bfCPSKillHard); verb = "kill"; break; 337 418 case APP_PRINT_PID: 338 419 if (info.UnixPID <= 0) errexit("can't get process ID");
Note:
See TracChangeset
for help on using the changeset viewer.