parent
adf33745f6
commit
af5336895c
@ -1 +0,0 @@
|
|||||||
node_modules/
|
|
@ -1,26 +0,0 @@
|
|||||||
# Tauri Plugin single-instance
|
|
||||||
|
|
||||||
## Emit Event Example
|
|
||||||
|
|
||||||
To build and test in development mode run the following:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
# change to this example directory
|
|
||||||
npm install
|
|
||||||
npm run tauri dev
|
|
||||||
|
|
||||||
# or if tauri is installed globally
|
|
||||||
|
|
||||||
cargo tauri dev
|
|
||||||
```
|
|
||||||
|
|
||||||
While the above is running, in a separate terminal window execute the debug target app
|
|
||||||
|
|
||||||
```sh
|
|
||||||
# on linux
|
|
||||||
./src-tauri/target/debug/emit-event-app cyan # any css background color should work
|
|
||||||
./src-tauri/target/debug/emit-event-app "#888" # including hex
|
|
||||||
|
|
||||||
# on windows
|
|
||||||
.\src-tauri\target\debug\emit-event-app.exe cyan
|
|
||||||
```
|
|
@ -1,14 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "emit-event",
|
|
||||||
"version": "0.0.1",
|
|
||||||
"description": "",
|
|
||||||
"main": "index.js",
|
|
||||||
"scripts": {
|
|
||||||
"tauri": "tauri"
|
|
||||||
},
|
|
||||||
"author": "",
|
|
||||||
"license": "MIT",
|
|
||||||
"devDependencies": {
|
|
||||||
"@tauri-apps/cli": "^1.0.0"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,106 +0,0 @@
|
|||||||
lockfileVersion: 5.4
|
|
||||||
|
|
||||||
specifiers:
|
|
||||||
'@tauri-apps/cli': ^1.0.0
|
|
||||||
|
|
||||||
devDependencies:
|
|
||||||
'@tauri-apps/cli': 1.0.0
|
|
||||||
|
|
||||||
packages:
|
|
||||||
|
|
||||||
/@tauri-apps/cli-darwin-arm64/1.0.0:
|
|
||||||
resolution: {integrity: sha512-0ryomgLjdpylXypMPVXLU3PZCde3Sw5nwN4coUhBcHPBLFRb8QPet+nweVK/HiZ3mxg8WeIazvpx2s8hS0l2GQ==}
|
|
||||||
engines: {node: '>= 10'}
|
|
||||||
cpu: [arm64]
|
|
||||||
os: [darwin]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@tauri-apps/cli-darwin-x64/1.0.0:
|
|
||||||
resolution: {integrity: sha512-oejvYUT4dEfzBi+FWMj+CMz4cZ6C2gEFHrUtKVLdTXr8Flj5UTwdB1YPGQjiOqk73LOI7cB/vXxb9DZT+Lrxgg==}
|
|
||||||
engines: {node: '>= 10'}
|
|
||||||
cpu: [x64]
|
|
||||||
os: [darwin]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@tauri-apps/cli-linux-arm-gnueabihf/1.0.0:
|
|
||||||
resolution: {integrity: sha512-yAu78v8TeXNx/ETS5F2G2Uw/HX+LQvZkX94zNiqFsAj7snfWI/IqSUM52OBrdh/D0EC9NCdjUJ7Vuo32uxf7tg==}
|
|
||||||
engines: {node: '>= 10'}
|
|
||||||
cpu: [arm]
|
|
||||||
os: [linux]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@tauri-apps/cli-linux-arm64-gnu/1.0.0:
|
|
||||||
resolution: {integrity: sha512-YFUN/S58AN317njAynzcQ+EHhRsCDXqmp5g9Oiqmcdg1vU7fPWZivVLc1WHz+0037C7JnsX5PtKpNYewP/+Oqw==}
|
|
||||||
engines: {node: '>= 10'}
|
|
||||||
cpu: [arm64]
|
|
||||||
os: [linux]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@tauri-apps/cli-linux-arm64-musl/1.0.0:
|
|
||||||
resolution: {integrity: sha512-al+TxMGoNVikEvRQfMyYE/mdjUcUNMo5brkCIAb+fL4rWQlAhAnYVzmg/rM8N4nhdXm1MOaYAagQmxr8898dNA==}
|
|
||||||
engines: {node: '>= 10'}
|
|
||||||
cpu: [arm64]
|
|
||||||
os: [linux]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@tauri-apps/cli-linux-x64-gnu/1.0.0:
|
|
||||||
resolution: {integrity: sha512-KQmYlYyGpn6/2kSl9QivWG6EIepm6PJd57e6IKmYwAyNhLr2XfGl1CLuocUQQgO+jprjT70HXp+MXD0tcB0+Sw==}
|
|
||||||
engines: {node: '>= 10'}
|
|
||||||
cpu: [x64]
|
|
||||||
os: [linux]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@tauri-apps/cli-linux-x64-musl/1.0.0:
|
|
||||||
resolution: {integrity: sha512-Qpaq5lZz569Aea6jfrRchgfEJaOrfLpCRBATcF8CJFFwVKmfCUcoV+MxbCIW30Zqw5Y06njC/ffa3261AV/ZIQ==}
|
|
||||||
engines: {node: '>= 10'}
|
|
||||||
cpu: [x64]
|
|
||||||
os: [linux]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@tauri-apps/cli-win32-ia32-msvc/1.0.0:
|
|
||||||
resolution: {integrity: sha512-e2DzFqEMI+s+gv14UupdI91gPxTbUJTbbfQlTHdQlOsTk4HEZTsh+ibAYBcCLAaMRW38NEsFlAUe1lQA0iRu/w==}
|
|
||||||
engines: {node: '>= 10'}
|
|
||||||
cpu: [ia32]
|
|
||||||
os: [win32]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@tauri-apps/cli-win32-x64-msvc/1.0.0:
|
|
||||||
resolution: {integrity: sha512-lWSs90pJeQX+L31IqIzmRhwLayEeyTh7mga0AxX8G868hvdLtcXCQA/rKoFtGdVLuHAx4+M+CBF5SMYb76xGYA==}
|
|
||||||
engines: {node: '>= 10'}
|
|
||||||
cpu: [x64]
|
|
||||||
os: [win32]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@tauri-apps/cli/1.0.0:
|
|
||||||
resolution: {integrity: sha512-4eHnk3p0xnCXd9Zel3kLvdiiSURnN98GMFvWUAdirm5AjyOjcx8TIET/jqRYmYKE5yd+LMQqYMUfHRwA6JJUkg==}
|
|
||||||
engines: {node: '>= 10'}
|
|
||||||
hasBin: true
|
|
||||||
optionalDependencies:
|
|
||||||
'@tauri-apps/cli-darwin-arm64': 1.0.0
|
|
||||||
'@tauri-apps/cli-darwin-x64': 1.0.0
|
|
||||||
'@tauri-apps/cli-linux-arm-gnueabihf': 1.0.0
|
|
||||||
'@tauri-apps/cli-linux-arm64-gnu': 1.0.0
|
|
||||||
'@tauri-apps/cli-linux-arm64-musl': 1.0.0
|
|
||||||
'@tauri-apps/cli-linux-x64-gnu': 1.0.0
|
|
||||||
'@tauri-apps/cli-linux-x64-musl': 1.0.0
|
|
||||||
'@tauri-apps/cli-win32-ia32-msvc': 1.0.0
|
|
||||||
'@tauri-apps/cli-win32-x64-msvc': 1.0.0
|
|
||||||
dev: true
|
|
@ -1,40 +0,0 @@
|
|||||||
<html>
|
|
||||||
<body>
|
|
||||||
<div>Plugin example</div>
|
|
||||||
<pre id="args"></pre>
|
|
||||||
<script type="module">
|
|
||||||
var argsEl = document.getElementById("args");
|
|
||||||
|
|
||||||
function cliProtocolVal({
|
|
||||||
args: {
|
|
||||||
color: { value },
|
|
||||||
},
|
|
||||||
}) {
|
|
||||||
argsEl.innerHTML = value;
|
|
||||||
document.body.style.backgroundColor = value;
|
|
||||||
}
|
|
||||||
function cliProtocolErr(err) {
|
|
||||||
argsEl.innerHTML = JSON.stringify(err);
|
|
||||||
}
|
|
||||||
|
|
||||||
window.__TAURI__.cli
|
|
||||||
.getMatches()
|
|
||||||
.then(cliProtocolVal)
|
|
||||||
.catch(cliProtocolErr);
|
|
||||||
|
|
||||||
await window.__TAURI__.event.listen(
|
|
||||||
"single-instance",
|
|
||||||
({ event, ...eventObj }) => {
|
|
||||||
console.log(event, eventObj);
|
|
||||||
let args = eventObj.payload?.args;
|
|
||||||
|
|
||||||
if (args?.length > 1) {
|
|
||||||
let color = args[1];
|
|
||||||
argsEl.innerHTML = color;
|
|
||||||
document.body.style.backgroundColor = color;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,4 +0,0 @@
|
|||||||
# Generated by Cargo
|
|
||||||
# will have compiled files and executables
|
|
||||||
/target/
|
|
||||||
WixTools
|
|
File diff suppressed because it is too large
Load Diff
@ -1,21 +0,0 @@
|
|||||||
[package]
|
|
||||||
name = "emit-event-app"
|
|
||||||
version = "0.1.0"
|
|
||||||
description = "A Tauri App"
|
|
||||||
authors = ["You"]
|
|
||||||
repository = ""
|
|
||||||
edition = "2021"
|
|
||||||
rust-version = "1.57"
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
serde_json = "1.0"
|
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
|
||||||
tauri = { version = "1", features = ["api-all", "cli"] }
|
|
||||||
tauri-plugin-single-instance = { path = "../../../" }
|
|
||||||
|
|
||||||
[build-dependencies]
|
|
||||||
tauri-build = { version = "1", features = [] }
|
|
||||||
|
|
||||||
[features]
|
|
||||||
default = ["custom-protocol"]
|
|
||||||
custom-protocol = ["tauri/custom-protocol"]
|
|
@ -1,3 +0,0 @@
|
|||||||
fn main() {
|
|
||||||
tauri_build::build()
|
|
||||||
}
|
|
Before Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 6.8 KiB |
Before Width: | Height: | Size: 974 B |
Binary file not shown.
Before Width: | Height: | Size: 85 KiB |
Before Width: | Height: | Size: 14 KiB |
@ -1,14 +0,0 @@
|
|||||||
max_width = 100
|
|
||||||
hard_tabs = false
|
|
||||||
tab_spaces = 2
|
|
||||||
newline_style = "Auto"
|
|
||||||
use_small_heuristics = "Default"
|
|
||||||
reorder_imports = true
|
|
||||||
reorder_modules = true
|
|
||||||
remove_nested_parens = true
|
|
||||||
edition = "2021"
|
|
||||||
merge_derives = true
|
|
||||||
use_try_shorthand = false
|
|
||||||
use_field_init_shorthand = false
|
|
||||||
force_explicit_abi = true
|
|
||||||
imports_granularity = "Crate"
|
|
@ -1,22 +0,0 @@
|
|||||||
#![cfg_attr(
|
|
||||||
all(not(debug_assertions), target_os = "windows"),
|
|
||||||
windows_subsystem = "windows"
|
|
||||||
)]
|
|
||||||
|
|
||||||
use tauri::{Manager};
|
|
||||||
|
|
||||||
#[derive(Clone, serde::Serialize)]
|
|
||||||
struct Payload {
|
|
||||||
args: Vec<String>,
|
|
||||||
cwd: String,
|
|
||||||
}
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
tauri::Builder::default()
|
|
||||||
.plugin(tauri_plugin_single_instance::init(|app, argv, cwd| {
|
|
||||||
println!("{}, {argv:?}, {cwd}", app.package_info().name);
|
|
||||||
app.emit_all("single-instance", Payload { args: argv, cwd }).unwrap();
|
|
||||||
}))
|
|
||||||
.run(tauri::generate_context!())
|
|
||||||
.expect("error while running tauri application");
|
|
||||||
}
|
|
@ -1,75 +0,0 @@
|
|||||||
{
|
|
||||||
"package": {
|
|
||||||
"productName": "z123456789012345",
|
|
||||||
"version": "0.1.0"
|
|
||||||
},
|
|
||||||
"build": {
|
|
||||||
"distDir": "../public",
|
|
||||||
"devPath": "../public",
|
|
||||||
"withGlobalTauri": true
|
|
||||||
},
|
|
||||||
"tauri": {
|
|
||||||
"bundle": {
|
|
||||||
"active": true,
|
|
||||||
"targets": "all",
|
|
||||||
"identifier": "com.tauri.single-instance-emissssssssssssssssssssssssssssssssssssssssssssssssssssssst",
|
|
||||||
"icon": [
|
|
||||||
"icons/32x32.png",
|
|
||||||
"icons/128x128.png",
|
|
||||||
"icons/128x128@2x.png",
|
|
||||||
"icons/icon.icns",
|
|
||||||
"icons/icon.ico"
|
|
||||||
],
|
|
||||||
"resources": [],
|
|
||||||
"externalBin": [],
|
|
||||||
"copyright": "",
|
|
||||||
"category": "DeveloperTool",
|
|
||||||
"shortDescription": "",
|
|
||||||
"longDescription": "",
|
|
||||||
"deb": {
|
|
||||||
"depends": []
|
|
||||||
},
|
|
||||||
"macOS": {
|
|
||||||
"frameworks": [],
|
|
||||||
"exceptionDomain": "",
|
|
||||||
"signingIdentity": null,
|
|
||||||
"entitlements": null
|
|
||||||
},
|
|
||||||
"windows": {
|
|
||||||
"certificateThumbprint": null,
|
|
||||||
"digestAlgorithm": "sha256",
|
|
||||||
"timestampUrl": ""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"cli": {
|
|
||||||
"description": "Tauri API example",
|
|
||||||
"args": [
|
|
||||||
{
|
|
||||||
"name": "color",
|
|
||||||
"description": "Background Color",
|
|
||||||
"index": 1,
|
|
||||||
"takesValue": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"subcommands": {}
|
|
||||||
},
|
|
||||||
"updater": {
|
|
||||||
"active": false
|
|
||||||
},
|
|
||||||
"allowlist": {
|
|
||||||
"all": true
|
|
||||||
},
|
|
||||||
"windows": [
|
|
||||||
{
|
|
||||||
"title": "Emit Event App",
|
|
||||||
"width": 800,
|
|
||||||
"height": 600,
|
|
||||||
"resizable": true,
|
|
||||||
"fullscreen": false
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"security": {
|
|
||||||
"csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self'"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in new issue