Open at cursor location
This commit is contained in:
1032
src-tauri/Cargo.lock
generated
1032
src-tauri/Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -18,6 +18,7 @@ serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
enigo = "0.1.2"
|
||||
arboard = "3.2.0"
|
||||
tauri-plugin-positioner = "1.0.4"
|
||||
|
||||
[features]
|
||||
# this feature is used for production builds or when `devPath` points to the filesystem
|
||||
|
@@ -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");
|
||||
}
|
||||
|
@@ -52,7 +52,11 @@
|
||||
"windows": [
|
||||
{
|
||||
"fullscreen": false,
|
||||
"resizable": true,
|
||||
"resizable": false,
|
||||
"maximizable": false,
|
||||
"minimizable": false,
|
||||
"alwaysOnTop": true,
|
||||
"decorations": true,
|
||||
"title": "Drone Input",
|
||||
"width": 400,
|
||||
"height": 320
|
||||
|
Reference in New Issue
Block a user