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