diff --git a/README.md b/README.md index 767a872..5bfa217 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Scrcpy-mask -A Scrcpy (control) client in Rust & Tarui aimed at providing mouse and key mapping. +A Scrcpy client in Rust & Tarui aimed at providing mouse and key mapping to control Android device. Due to the delay and blurred image quality of the mirror screen. This project found another way, directly abandoned the mirror screen, and instead used a transparent mask to display the screen content behind the window, which fundamentally put an end to the delay in casting the screen. @@ -9,10 +9,20 @@ Due to the delay and blurred image quality of the mirror screen. This project fo - [x] Wired and wireless connections to Android devices - [x] Start scrcpy-server and connect to it - [x] Implement scrcpy client control protocol -- [x] Mouse and keyboard mapping +- [x] Mouse and keyboard key mapping - [x] Visually setting the mapping +- [x] Key mapping config import and export +- [x] Update check +- [ ] Switch between key mapping and raw input +- [ ] Better macro support - [ ] Provide external interface through websocket -## contribution. +## Screenshot + +![Device](https://pic.superbed.cc/item/6637190cf989f2fb975b6162.png) +![Key mapping](https://pic.superbed.cc/item/66371911f989f2fb975b62a3.png) +![Mask](https://pic.superbed.cc/item/66371a03f989f2fb975c07f3.png) + +## Contribution. If you are interested in this project, you are welcome to submit pull request or issue. But my time and energy is limited, so I may not be able to deal with it all. diff --git a/package.json b/package.json index 4568c8f..23bd1d3 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "scrcpy-mask", "private": true, - "version": "0.1.3", + "version": "0.1.4", "type": "module", "scripts": { "dev": "vite", @@ -13,7 +13,9 @@ "dependencies": { "@tauri-apps/api": ">=2.0.0-beta.8", "@tauri-apps/plugin-clipboard-manager": "2.1.0-beta.0", + "@tauri-apps/plugin-http": "2.0.0-beta.3", "@tauri-apps/plugin-process": "2.0.0-beta.2", + "@tauri-apps/plugin-shell": "2.0.0-beta.3", "@tauri-apps/plugin-store": "2.0.0-beta.2", "pinia": "^2.1.7", "vue": "^3.3.4", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 52521ee..cdf1d98 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "scrcpy-mask" -version = "0.1.3" +version = "0.1.4" description = "A Tauri App" authors = ["AkiChase"] edition = "2021" @@ -11,7 +11,7 @@ edition = "2021" tauri-build = { version = "2.0.0-beta", features = [] } [dependencies] -tauri = { version = "2.0.0-beta.15", features = ["macos-private-api"] } +tauri = { version = "2.0.0-beta.15", features = ["macos-private-api", "devtools"] } tauri-plugin-store = "2.0.0-beta.4" serde = { version = "1", features = ["derive"] } serde_json = "1" @@ -19,3 +19,5 @@ anyhow = "1.0" tokio = { version = "1.36.0", features = ["rt-multi-thread", "net", "macros", "io-util", "time", "sync"] } tauri-plugin-clipboard-manager = "2.1.0-beta.1" tauri-plugin-process = "2.0.0-beta.3" +tauri-plugin-shell = "2.0.0-beta.4" +tauri-plugin-http = "2.0.0-beta.7" diff --git a/src-tauri/capabilities/default.json b/src-tauri/capabilities/default.json index aa1773c..6c2fe4f 100644 --- a/src-tauri/capabilities/default.json +++ b/src-tauri/capabilities/default.json @@ -27,6 +27,18 @@ "process:default", "process:allow-restart", "webview:default", - "webview:allow-internal-toggle-devtools" + "webview:allow-internal-toggle-devtools", + "shell:default", + "shell:allow-open", + "http:default", + { + "identifier": "http:default", + "allow": [ + { "url": "https://api.github.com/repos/AkiChase/scrcpy-mask/*" } + ] + }, + "http:allow-fetch", + "app:default", + "app:allow-version" ] } diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 06e3c6c..52b7eb2 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -142,6 +142,8 @@ fn load_default_keyconfig(app: tauri::AppHandle) -> Result { #[tokio::main] async fn main() { tauri::Builder::default() + .plugin(tauri_plugin_http::init()) + .plugin(tauri_plugin_shell::init()) .plugin(tauri_plugin_process::init()) .plugin(tauri_plugin_clipboard_manager::init()) .plugin(tauri_plugin_store::Builder::new().build()) diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 4fcda3a..f3ffce5 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,6 +1,6 @@ { "productName": "scrcpy-mask", - "version": "0.1.3", + "version": "0.1.4", "identifier": "com.akichase.mask", "build": { "beforeDevCommand": "pnpm dev", diff --git a/src/App.vue b/src/App.vue index c88b1a1..fa2307b 100644 --- a/src/App.vue +++ b/src/App.vue @@ -71,6 +71,20 @@ onMounted(async () => { localStore.set("curKeyMappingIndex", curKeyMappingIndex); } store.curKeyMappingIndex = curKeyMappingIndex; + + // loading maskButton from local store + let maskButton = await localStore.get<{ + show: boolean; + transparency: number; + }>("maskButton"); + if (maskButton === null) { + maskButton = { + show: true, + transparency: 0.5, + }; + await localStore.set("maskButton", maskButton); + } + store.maskButton = maskButton; }); diff --git a/src/components/Mask.vue b/src/components/Mask.vue index d3105f0..ff12a36 100644 --- a/src/components/Mask.vue +++ b/src/components/Mask.vue @@ -65,7 +65,11 @@ function toStartServer() {