diff --git a/README.md b/README.md index 914faa0..4e98ad3 100644 --- a/README.md +++ b/README.md @@ -37,10 +37,11 @@ one is up, dots alone when there are more (hover for the names). Open the menu and: -- **Click a profile** to switch to it. Every other running profile is quit - first, so you end up with just that one. +- **Click a profile that isn't running** to switch to it. Every other running + profile is quit first, so you end up with just that one. +- **Click a profile that is already running** to bring its window forward, + leaving everything else where it is. - **Shift-click a profile** to open it *alongside* whatever is already running. -- **Click a running profile** to bring its window to the front. A `⇆` marks the profile you last switched to. **Close Profile** quits one profile; **Quit Claude** quits all of them and leaves shannoncoat running. diff --git a/Sources/AppDelegate.swift b/Sources/AppDelegate.swift index dee617e..b58ad49 100644 --- a/Sources/AppDelegate.swift +++ b/Sources/AppDelegate.swift @@ -360,7 +360,19 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuDelegate, LiveSt } } + // Switching means "make this the one that's running" — so it only has to + // quit anything when the profile isn't up yet. Clicking one that's + // already open is a request to look at it, not to tear down the window + // beside it: the menu shows every running profile at once, so the click + // that reaches for the second one is almost always someone moving + // between two open windows rather than asking for one of them to go. + // Quitting the neighbour there costs a relaunch and whatever was on + // screen, to carry out an instruction nobody gave. private func switchTo(_ profile: ResolvedProfile) { + guard !currentInfos.contains(where: { $0.profile.name == profile.name && $0.running }) else { + openProfile(profile) + return + } let others = currentInfos.filter { $0.running && $0.profile.name != profile.name } guard !others.isEmpty else { openProfile(profile); return } var remaining = others.count