feat(ipc): dukung Ctrl+Y clipboard copy di mode daemon/attach
Tambah DaemonFrame::ClipboardCopy(String) supaya daemon bisa mengirim teks pending_clipboard_copy ke attach client, yang kemudian menulis sekuens OSC52 ke stdout-nya sendiri (bukan stdout daemon yang tidak dimiliki terminal user).
This commit is contained in:
@@ -91,5 +91,6 @@ pub enum DaemonFrame {
|
|||||||
StateUpdate(Box<StatePayload>),
|
StateUpdate(Box<StatePayload>),
|
||||||
StreamToken(String),
|
StreamToken(String),
|
||||||
SystemNote { kind: String, message: String },
|
SystemNote { kind: String, message: String },
|
||||||
|
ClipboardCopy(String),
|
||||||
Closed,
|
Closed,
|
||||||
}
|
}
|
||||||
|
|||||||
+12
@@ -396,6 +396,9 @@ fn handle_daemon_client(
|
|||||||
running = false;
|
running = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if let Some(text) = state.misc.pending_clipboard_copy.take() {
|
||||||
|
conn.send(&ipc::protocol::DaemonFrame::ClipboardCopy(text))?;
|
||||||
|
}
|
||||||
send_daemon_update(&mut conn, state)?;
|
send_daemon_update(&mut conn, state)?;
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
@@ -583,6 +586,15 @@ fn run_attach(session_id: &str) -> Result<()> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Some(ipc::protocol::DaemonFrame::ClipboardCopy(text)) => {
|
||||||
|
let _ = write_osc52(&mut io::stdout(), &text);
|
||||||
|
client_state.push_toast(
|
||||||
|
app::state::types::Toast::new(
|
||||||
|
app::state::types::ToastKind::Success,
|
||||||
|
"Copied to clipboard".to_string(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
Some(ipc::protocol::DaemonFrame::Closed) | None => {
|
Some(ipc::protocol::DaemonFrame::Closed) | None => {
|
||||||
client_state.quit = true;
|
client_state.quit = true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user