Initial Commit

This commit is contained in:
brotoskyj
2024-12-24 13:04:39 -05:00
commit d9286ebe24
10 changed files with 4987 additions and 0 deletions
Generated
+4817
View File
File diff suppressed because it is too large Load Diff
+34
View File
@@ -0,0 +1,34 @@
[package]
name = "jiggler"
version = "1.0.0"
edition = "2021"
[dependencies]
slint = "1.6.0"
[dependencies.windows]
version = "0.56.0"
features = [
"Data_Xml_Dom",
"Win32_Foundation",
"Win32_Security",
"Win32_System_Threading",
"Win32_UI_WindowsAndMessaging",
"Win32_UI_Input_KeyboardAndMouse",
]
[build]
build = "build.rs"
[build-dependencies]
slint-build = "1.6.0"
[profile.release]
opt-level = "z"
lto = "fat"
debug = false
codegen-units = 1
panic = 'abort'
strip = true
debug-assertions = false
overflow-checks = false
Binary file not shown.

After

Width:  |  Height:  |  Size: 158 KiB

+5
View File
@@ -0,0 +1,5 @@
fn main() {
let config = slint_build::CompilerConfiguration::new()
.with_style("fluent-dark".into());
slint_build::compile_with_config("ui/template.slint", config).unwrap();
}
+26
View File
@@ -0,0 +1,26 @@
#![windows_subsystem = "windows"]
slint::slint!();
slint::include_modules!();
use mouse::windowsapi::jigglemouse;
mod mouse;
use std::thread;
static mut JIGGLING: bool = false;
fn main() {
let app: MainWindow = MainWindow::new().unwrap();
let _weak = app.as_weak();
let test = app.on_secondcounter(move |string| println!("{}", string));
app.on_startjiggle(move || {
unsafe {
JIGGLING = true
};
thread::spawn(|| jigglemouse());
println!("{:?}", test);
});
app.on_stopjiggle( move || {
unsafe {
JIGGLING = false
};
});
app.run().unwrap();
}
+1
View File
@@ -0,0 +1 @@
pub mod windowsapi;
+24
View File
@@ -0,0 +1,24 @@
use std::{thread, time::Duration};
use windows::Win32::UI::Input::KeyboardAndMouse::{mouse_event, MOUSE_EVENT_FLAGS};
use crate::JIGGLING;
#[cfg(target_family = "windows")]
pub fn jigglemouse() {
unsafe {
while JIGGLING == true {
mouse_event(MOUSE_EVENT_FLAGS(1), 0, 0, 0, 0);
thread::sleep(Duration::from_millis(5000));
}
}
}
#[cfg(target_family = "unix")]
pub fn jigglemouse () {
unsafe{
while JIGGLING == true {
println!("Hello World!");
thread::sleep(Duration::from_millis(1000));
}
}
}
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

+80
View File
@@ -0,0 +1,80 @@
import { Switch, CheckBox, ScrollView, SpinBox } from "std-widgets.slint";
export component MainWindow inherits Window {
width: 400px;
height: 200px;
title: @tr("Mouse Jiggler");
icon: @image-url("jiggler.jpeg");
callback startjiggle;
callback stopjiggle;
callback secondcounter(string);
Switch {
width: 148px;
height: 48px;
text: "Toggle Jiggle";
checked: false;
toggled => {
if (self.checked) {
startjiggle();
picture.source = @image-url("dancing.jpeg");
} else {
stopjiggle();
picture.source = @image-url("jiggler.jpeg");
}
}
x: 20px;
y: 15px;
}
CheckBox {
text: "Zen Mode";
x: 20px;
y: 55px;
checked: true;
toggled => {
if (self.checked) {
spinbox.visible = false;
seconds.visible = false;
} else {
spinbox.visible = true;
seconds.visible = true;
}
}
}
spinbox := SpinBox {
width: 93px;
height: 30px;
minimum: 5;
value: 5;
maximum: 10;
x: 23px;
y: 90px;
visible: false;
}
seconds := Text {
text: "Seconds between moves";
x: 125px;
y: 95px;
visible: false;
wrap: word-wrap;
}
picture := Image {
width: 85px;
height: 118px;
source: @image-url("jiggler.jpeg");
x: 300px;
y: 8px;
}
Text {
height: 50px;
width: 350px;
text: "Disabling Zen Mode will cause the actual cursor to move. This might make it difficult to stop the jiggler. So disabling Zen Mode will allow you to control the time between moves.";
x: 10px;
y: 130px;
wrap: word-wrap;
}
}