- Web UI: Ctrl+C, Ctrl+X, Ctrl+Shift+C (Cmd+C on Mac) also put what they copied, text or PNG, on this device's clipboard; Copy, Copy Selection and Copy Clipboard buttons - chandra-remote: GET /api/clipboard/data, with the same authorization as the upload - Compositor: clipboard-get-fd has the clipboard's owner write into a pipe, refused while locked; input-copy presses Ctrl+Shift+C in terminals, Ctrl+C elsewhere - Pending clipboard transfers keep the main loop awake Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c5dbe028e6
commit
589d167f79
11 files changed
+552
-19
No files matched your search
@@ -191,6 +191,9 @@ fn ChandraCompositor::control_tick(self : ChandraCompositor) -> Unit {
|
||||
let line = @utf8.decode_lossy(Bytes::from_array(cl.pending))
|
||||
cl.pending.clear()
|
||||
let (out, _) = self.control_command(line, file=cl.file)
|
||||
if cl.file >= 0 && self.server.is_transfer(cl.file) {
|
||||
cl.file = -1 // the clipboard is still being written into it
|
||||
}
|
||||
cl.drop_file()
|
||||
let reply = StringBuilder::new()
|
||||
for l in out {
|
||||
@@ -908,6 +911,30 @@ pub fn ChandraCompositor::control_command(
|
||||
}
|
||||
"clipboard-status" =>
|
||||
(["ok serial=" + self.server.selection_serial.to_string()], true)
|
||||
// chandra-remote: write the clipboard into `file`, a pipe, and say what it is.
|
||||
"clipboard-get-fd" => {
|
||||
if words.length() != 1 || file < 0 {
|
||||
return (["error usage: clipboard-get-fd, with a pipe sent along"], false)
|
||||
}
|
||||
if self.locked {
|
||||
return (["error locked"], false)
|
||||
}
|
||||
match self.server.send_clipboard_to(file) {
|
||||
Some(mime) =>
|
||||
(["ok serial=" + self.server.selection_serial.to_string() + " type=" + mime], true)
|
||||
None => (["error empty"], false)
|
||||
}
|
||||
}
|
||||
"input-copy" => {
|
||||
if words.length() != 1 {
|
||||
return (["error usage: input-copy"], false)
|
||||
}
|
||||
if self.remote_copy() {
|
||||
(["ok keys"], true)
|
||||
} else {
|
||||
(["ok nothing"], true)
|
||||
}
|
||||
}
|
||||
"input-paste" => {
|
||||
let chord = if words.length() == 3 {
|
||||
match (parse_uint_opt(words[1]), parse_uint_opt(words[2])) {
|
||||
|
||||
Reference in new issue
Block a user