Snow Leopard: the lsregister program makes copies of an app look the same.

Hippo Man

Hippo Man
I'm running Snow Leopard and I'm using Spaces, and I want to have different types of Terminal windows always show up in different Spaces.

The way I was doing this in Leopard (and it worked great) was as follows:

* Make an exact copy of Terminal.app that's called Terminal-copy.app

* Go into its Info.plist file and change its CFBundleIdentifier to something other than com.apple.Terminal (I call it com.apple.Terminal-copy).

* Go into Spaces and specify that all instances of Terminal.app go into Space 2, and all instances of Terminal-copy.app go into Space 3.

Then, when I start up Terminal.app instances, they indeed go into Space 2, and when I start up Terminal-copy.app instances, they indeed go into Space 3.

This much also works in Snow Leopard. But the problem occurs in Snow Leopard when I run the "lsregister" program to clean up the Launch Services database. I run it like this in a Terminal session (this all appears on one line):

Code:
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain system -domain user

After "lsregister" runs in Snow Leopard, both Terminal.app and Terminal-copy.app look like "Terminal.app" in the Finder and in all panes and dialog boxes that display applications. And now, Spaces doesn't recognize anything as Terminal-copy.app ... all instances just look like Terminal.app. And even if I go to the Terminal.app which was originally Terminal-copy.app in the Finder and explicitly rename it back to Terminal-copy.app, the name changes right back to Terminal.app again. This is the case even though that app is still called Terminal-copy.app on disk.

This didn't use to happen under Leopard. In that OS version, I could run "lsregister" as described above, and the two apps, Terminal.app and Terminal-copy.app, would continue to appear with these distinct names, and they'd continue to run in different Spaces.

But now that I'm running Snow Leopard, it looks like I've lost the ability to create distinct app instances simply by copying an app and changing the CFBundleIdentifier in the copy ... at least after running "lsregister".

Does anyone know how to remedy this situation in Snow Leopard so that I can actually have distinct application instances with separate names that remain in effect, even after "lsregister" is run?

Actually, the main thing I want is to force different types of Terminal instances to always run in certain, distinct Spaces, no matter which Space they might happen to be invoked in. Is there some other way to accomplish this in Snow Leopard besides the way I was doing it in Leopard?

And yes, I know how to do this by removing the default Spaces locations for Terminal.app and just switching to a given Space and starting the Terminal instance that I want. But I don't want to do it this way. I'd like all instances of certain Terminal invocations to always automatically switch to a certain Space and start up there, and all instances of certain other Terminal invocations to always switch to a different Space and start up there. Since I used to be able to easily do this under Leopard, I'd hate to lose that capability just because I'm now running under Snow Leopard.

Thanks in advance for any tips or suggestions you might be able to offer.
.​
 
Last edited:
After much trial and error and some suggestions from others that got my investigation on the right track, I finally figured this out and fixed it.

I had forgotten to mention in my original message that I also had changed CFBundleName and CFBundleDisplayName both to "Terminal-copy" in /Applications/Terminal-copy.app/Contents/Info.plist. Now I have figured out that somehow, this confused Launch Services (or some other piece of system software), and the application was then treated simply like another instance of Terminal (see below for an explanation for how I figured this out).

It turns out that the info used to determine that some of this Info.plist info is out of sync isn't in code signing files, which is where I was steered to at first. However, this info is obviously embedded somewhere else in the app, and if there is a conflict between this Info.plist data and that other info, whatever it is, Launch Services just uses the other info to come up with its idea of what name should be associated with the application.

So here's how I finally diagnosed and fixed this: I just copied a fresh Info.plist from Terminal.app/Contents to Terminal-copy.app/Contents, and then I edited this file and changed the three values, one at a time (CFBundleName, CFBundleDisplayName, and CFBundleIdentifier). After trying all possibilities of these three settings, I found that it's OK to change CFBundleName and CFBundleIdentifier, but not CFBundleDisplayName. With only those first two properties changed, the app maintained its Terminal-copy identity even after a run of lsregister.

I'm not sure, but I believe that changing CFBundleDisplayName didn't mess things up this way under Leopard. But I don't have a Leopard system anywhere to test this, and in any case, what I have done now works in Snow Leopard, so I'm happy.

Excelsior!
.​
 
Back
Top