Sub-Menu Elements
This commit is contained in:
@@ -9,24 +9,39 @@ use arboard::Clipboard;
|
||||
// Learn more about Tauri commands at https://tauri.app/v1/guides/features/command
|
||||
#[tauri::command]
|
||||
fn type_str(input: String) {
|
||||
println!("Type this: {}", input);
|
||||
#[cfg(dev)]
|
||||
println!(">: {}", input);
|
||||
|
||||
let mut enigo = Enigo::new();
|
||||
let mut clipboard = Clipboard::new().unwrap();
|
||||
|
||||
// Load input into clipboard
|
||||
clipboard.set_text(input).unwrap();
|
||||
|
||||
// TODO: Multi-platform window switch
|
||||
enigo.key_down(Key::Alt);
|
||||
enigo.key_click(Key::Tab);
|
||||
enigo.key_up(Key::Alt);
|
||||
|
||||
thread::sleep(Duration::from_millis(200));
|
||||
enigo.key_down(Key::Control);
|
||||
enigo.key_click(Key::Layout('v'));
|
||||
enigo.key_up(Key::Control);
|
||||
|
||||
// TODO: Multi-platform paste
|
||||
#[cfg(not(dev))]{
|
||||
enigo.key_down(Key::Control);
|
||||
enigo.key_click(Key::Layout('v'));
|
||||
enigo.key_up(Key::Control);
|
||||
}
|
||||
|
||||
thread::sleep(Duration::from_millis(20));
|
||||
|
||||
// Close program
|
||||
#[cfg(not(dev))]
|
||||
std::process::exit(0);
|
||||
|
||||
}
|
||||
|
||||
fn main() {
|
||||
// TODO: Set Window location on launch
|
||||
tauri::Builder::default()
|
||||
.invoke_handler(tauri::generate_handler![type_str])
|
||||
.run(tauri::generate_context!())
|
||||
|
@@ -45,7 +45,7 @@
|
||||
"windows": [
|
||||
{
|
||||
"fullscreen": false,
|
||||
"resizable": false,
|
||||
"resizable": true,
|
||||
"title": "Drone Input",
|
||||
"width": 400,
|
||||
"height": 320
|
||||
|
Reference in New Issue
Block a user