Auto-Send Feature
This commit is contained in:
parent
ee392d5213
commit
7d3dba469d
@ -8,7 +8,7 @@ Allen Wrench is a desktop tool to aid [Hexcorp](https://hexcorp.net) Drones in t
|
||||
|
||||
* [ ] Ensure window appears within bounds of screen(s) when moved to cursor location
|
||||
* [ ] Keyboard control of the program
|
||||
* [ ] Auto-send `return` on paste completion for pre-determined phrases
|
||||
* [X] Auto-send `return` on paste completion for pre-determined phrases
|
||||
* [ ] Prevent showing window until on correct location
|
||||
|
||||
### Nice to Haves
|
||||
@ -22,6 +22,7 @@ Allen Wrench is a desktop tool to aid [Hexcorp](https://hexcorp.net) Drones in t
|
||||
* [ ] [Unicode "font" options](https://lingojam.com/DiscordFonts)
|
||||
* [ ] Drone Speech Optimizations
|
||||
* [ ] Improve Launch Times
|
||||
* [ ] Add Version Display in Config
|
||||
|
||||
### Misc notes
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "allenwrench-app",
|
||||
"private": true,
|
||||
"version": "0.1.1",
|
||||
"version": "0.2.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
@ -15,7 +15,7 @@ fn get_mouse_pos() -> String {
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
fn type_str(input: String) {
|
||||
fn type_str(input: String, autoSend: bool) {
|
||||
#[cfg(dev)]
|
||||
println!(">: {}", input);
|
||||
|
||||
@ -64,6 +64,12 @@ fn type_str(input: String) {
|
||||
enigo.key_up(Key::Control);
|
||||
}
|
||||
|
||||
thread::sleep(Duration::from_millis(200));
|
||||
|
||||
if (autoSend) {
|
||||
enigo.key_click(Key::Return);
|
||||
}
|
||||
|
||||
thread::sleep(Duration::from_millis(20));
|
||||
|
||||
// Close program
|
||||
|
23
src/App.tsx
23
src/App.tsx
@ -44,6 +44,10 @@ function App() {
|
||||
let storedId = localStorage.getItem("droneId");
|
||||
return (storedId ? storedId : "0000");
|
||||
});
|
||||
const [autoSend, setAutoSend] = useState<boolean>(() => {
|
||||
let storedAutoSend = localStorage.getItem("autoSend");
|
||||
return (storedAutoSend ? storedAutoSend == "true" : false);
|
||||
});
|
||||
|
||||
if (!codes){
|
||||
resolveResource("resources/codes.json").then((path: string) => {
|
||||
@ -102,7 +106,7 @@ function App() {
|
||||
if (filtered.length == 1) {
|
||||
let payload: string = generatePayload(filtered[0]);
|
||||
setSubTopic("");
|
||||
invoke('type_str', {input: payload});
|
||||
invoke('type_str', {input: payload, autoSend});
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -142,7 +146,7 @@ function App() {
|
||||
if (filtered.length == 1) {
|
||||
let assembledStr: string = generatePayload(filtered[0]);
|
||||
setSubTopic("");
|
||||
invoke('type_str', {input: assembledStr});
|
||||
invoke('type_str', {input: assembledStr, autoSend});
|
||||
}else{
|
||||
// Open Submenu for type
|
||||
setSubTopic(type);
|
||||
@ -213,6 +217,21 @@ function App() {
|
||||
</div>
|
||||
{/* TODO: Optional auto-send on pre-made messages */}
|
||||
</div>
|
||||
<div className="row">
|
||||
<div className="col-6 text-end">
|
||||
Auto-Send
|
||||
</div>
|
||||
<div className="col-6">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={autoSend}
|
||||
onChange={(e) => {
|
||||
setAutoSend(e.target.checked);
|
||||
localStorage.setItem("autoSend", e.target.checked.toString());
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div className="row modal-footer">
|
||||
<div className="col-4" onClick={() => {
|
||||
let url = "https://git.corrupt.link/liz/AllenWrench";
|
||||
|
Loading…
Reference in New Issue
Block a user