DevelopmentNodeEnvironment_MicrosoftVSCodeDependency_22NodeVersion_Bundle_Clean_Debug_ElectronProfile_EsbuildCompiler_Mountain/RPC/CocoonService/Terminal/
AcceptTerminalOpened.rs1use serde_json::json;
7use tauri::Emitter;
8use tonic::{Response, Status};
9
10use crate::{
11 RPC::CocoonService::CocoonServiceImpl,
12 Vine::Generated::{Empty, TerminalOpenedNotification},
13 dev_log,
14};
15
16pub async fn Fn(Service:&CocoonServiceImpl, Request:TerminalOpenedNotification) -> Result<Response<Empty>, Status> {
17 dev_log!(
18 "cocoon",
19 "[CocoonService] Terminal opened notification: {} (ID: {})",
20 Request.name,
21 Request.terminal_id
22 );
23
24 let _ = Service.environment.ApplicationHandle.emit(
25 "sky://terminal/create",
26 json!({ "id": Request.terminal_id, "name": Request.name, "pid": 0 }),
27 );
28
29 Ok(Response::new(Empty {}))
30}