@@ -55,7 +55,7 @@ struct GUI {
5555
5656 enum Action {
5757 case start
58- case openChatPanel( forceDetach: Bool )
58+ case openChatPanel( forceDetach: Bool , activateThisApp : Bool )
5959 case createAndSwitchToChatGPTChatTabIfNeeded
6060 case createAndSwitchToChatTabIfNeededMatching(
6161 check: ( any ChatTab ) -> Bool ,
@@ -138,7 +138,7 @@ struct GUI {
138138 return . none
139139 #endif
140140
141- case let . openChatPanel( forceDetach) :
141+ case let . openChatPanel( forceDetach, activate ) :
142142 return . run { send in
143143 await send (
144144 . suggestionWidget(
@@ -147,7 +147,9 @@ struct GUI {
147147 )
148148 await send ( . suggestionWidget( . updateKeyWindow( . chatPanel) ) )
149149
150- activateThisApp ( )
150+ if activate {
151+ activateThisApp ( )
152+ }
151153 }
152154
153155 case . createAndSwitchToChatGPTChatTabIfNeeded:
@@ -199,7 +201,7 @@ struct GUI {
199201 let activeTab = chatTabPool. getTab ( of: info. id) as? ChatGPTChatTab
200202 {
201203 return . run { send in
202- await send ( . openChatPanel( forceDetach: false ) )
204+ await send ( . openChatPanel( forceDetach: false , activateThisApp : false ) )
203205 await stopAndHandleCommand ( activeTab)
204206 }
205207 }
@@ -211,7 +213,7 @@ struct GUI {
211213 {
212214 state. chatTabGroup. selectedTabId = chatTab. id
213215 return . run { send in
214- await send ( . openChatPanel( forceDetach: false ) )
216+ await send ( . openChatPanel( forceDetach: false , activateThisApp : false ) )
215217 await stopAndHandleCommand ( chatTab)
216218 }
217219 }
@@ -220,7 +222,7 @@ struct GUI {
220222 guard let ( chatTab, chatTabInfo) = await chatTabPool. createTab ( for: nil )
221223 else { return }
222224 await send ( . suggestionWidget( . chatPanel( . appendAndSelectTab( chatTabInfo) ) ) )
223- await send ( . openChatPanel( forceDetach: false ) )
225+ await send ( . openChatPanel( forceDetach: false , activateThisApp : false ) )
224226 if let chatTab = chatTab as? ChatGPTChatTab {
225227 await stopAndHandleCommand ( chatTab)
226228 }
@@ -347,7 +349,7 @@ public final class GraphicalUserInterfaceController {
347349 suggestionDependency. onOpenChatClicked = { [ weak self] in
348350 Task { [ weak self] in
349351 await self ? . store. send ( . createAndSwitchToChatGPTChatTabIfNeeded) . finish ( )
350- self ? . store. send ( . openChatPanel( forceDetach: false ) )
352+ self ? . store. send ( . openChatPanel( forceDetach: false , activateThisApp : true ) )
351353 }
352354 }
353355 suggestionDependency. onCustomCommandClicked = { command in
0 commit comments