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