Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions baml_src/delivery.baml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,23 @@ function wtype_chunks(transcript: string) -> string[] {
}

function type_text(transcript: string) -> bool {
// Keep a virtual keyboard registered so Chromium preserves editor focus as chunk keyboards exit.
let anchor_options = process_options(null);
anchor_options.keep_stdin_open = true;
let anchor = baml.sys.start_process("wtype", ["-"], anchor_options) catch_all (error) {
_ => {
return false;
},
};
defer {
anchor.close()
}
// Give the anchor time to register before starting the first chunk.
baml.sys.sleep(baml.time.Duration.from_milliseconds(20)) catch_all (error) {
_ => {
return false;
},
};
for (let chunk in wtype_chunks(transcript)) {
if (!run_delivery_command("wtype", ["-"], chunk)) {
return false;
Expand Down