Open at cursor location
This commit is contained in:
@@ -1,11 +1,18 @@
|
||||
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||
|
||||
use enigo::{Enigo, Key, KeyboardControllable};
|
||||
use enigo::{Enigo, Key, KeyboardControllable, MouseControllable};
|
||||
use std::thread;
|
||||
use std::time::Duration;
|
||||
use arboard::Clipboard;
|
||||
|
||||
#[tauri::command]
|
||||
fn get_mouse_pos() -> String {
|
||||
let enigo = Enigo::new();
|
||||
let (x, y) = enigo.mouse_location();
|
||||
format!("{{ \"x\": {}, \"y\": {} }}", x, y).into()
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
fn type_str(input: String) {
|
||||
#[cfg(dev)]
|
||||
@@ -42,7 +49,8 @@ fn type_str(input: String) {
|
||||
fn main() {
|
||||
// TODO: Set Window location on launch
|
||||
tauri::Builder::default()
|
||||
.invoke_handler(tauri::generate_handler![type_str])
|
||||
.plugin(tauri_plugin_positioner::init())
|
||||
.invoke_handler(tauri::generate_handler![type_str, get_mouse_pos])
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
|
Reference in New Issue
Block a user