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