This commit is contained in:
amrbashir
2022-05-01 13:16:13 +02:00
commit 02a59015f7
31 changed files with 4675 additions and 0 deletions
+41
View File
@@ -0,0 +1,41 @@
{
"gitSiteUrl": "https://www.github.com/your-org/tauri-plugin-single-instance/",
"pkgManagers": {
"rust": {
"version": true,
"getPublishedVersion": "cargo search ${ pkg.pkg } --limit 1 | sed -nE 's/^[^\"]*\"//; s/\".*//1p' -",
"publish": [
{
"command": "cargo package --allow-dirty",
"dryRunCommand": true
},
{
"command": "echo \"# Cargo Publish\"",
"dryRunCommand": true,
"pipe": true
},
{
"command": "echo \"\\`\\`\\`\"",
"dryRunCommand": true,
"pipe": true
},
{
"command": "cargo publish",
"dryRunCommand": "cargo publish --dry-run --allow-dirty",
"pipe": true
},
{
"command": "echo \"\\`\\`\\`\"",
"dryRunCommand": true,
"pipe": true
}
]
}
},
"packages": {
"tauri-plugin-single-instance": {
"path": ".",
"manager": "rust"
}
}
}
+5
View File
@@ -0,0 +1,5 @@
---
"tauri-plugin-single-instance": "minor"
---
Initial release.
+16
View File
@@ -0,0 +1,16 @@
# Changes
##### via https://github.com/jbolda/covector
As you create PRs and make changes that require a version bump, please add a new markdown file in this folder. You do not note the version *number*, but rather the type of bump that you expect: major, minor, or patch. The filename is not important, as long as it is a `.md`, but we recommend it represents the overall change for our sanity.
When you select the version bump required, you do *not* need to consider depedencies. Only note the package with the actual change, and any packages that depend on that package will be bumped automatically in the process.
Use the following format:
```md
---
"tauri-plugin-single-instance": patch
---
Change summary goes here
```
+26
View File
@@ -0,0 +1,26 @@
name: Audit
on:
schedule:
- cron: '0 0 * * *'
push:
branches:
- main
paths:
- "**/Cargo.lock"
- "**/Cargo.toml"
pull_request:
branches:
- main
paths:
- "**/Cargo.lock"
- "**/Cargo.toml"
jobs:
audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/audit-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
+15
View File
@@ -0,0 +1,15 @@
name: covector status
on: [pull_request]
jobs:
covector:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: covector status
uses: jbolda/covector/packages/action@covector-v0
with:
command: 'status'
@@ -0,0 +1,37 @@
name: covector version or publish
on:
push:
branches:
- dev
jobs:
covector:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-node@v2
with:
node-version: 12
registry-url: 'https://registry.npmjs.org'
- name: git config
run: |
git config --global user.name "${{ github.event.pusher.name }}"
git config --global user.email "${{ github.event.pusher.email }}"
- name: covector version-or-publish
uses: jbolda/covector/packages/action@covector-v0
id: covector
with:
token: ${{ secrets.GITHUB_TOKEN }}
command: 'version-or-publish'
createRelease: true
- name: create pull request
id: cpr
uses: tauri-apps/create-pull-request@v2.8.0
with:
title: "Publish New Versions"
labels: "version updates"
branch: "release"
body: ${{ steps.covector.outputs.change }}
+30
View File
@@ -0,0 +1,30 @@
name: Format
on:
push:
branches:
- main
pull_request:
branches:
- main
- dev
jobs:
format:
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v2
- name: Install rustfmt with nightly toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
components: rustfmt
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --manifest-path=Cargo.toml --all -- --check
+35
View File
@@ -0,0 +1,35 @@
name: Clippy
on:
push:
branches:
- main
pull_request:
branches:
- main
- dev
jobs:
clippy:
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v2
- name: install webkit2gtk
run: |
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.0
- name: Install clippy with stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: clippy
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --manifest-path=Cargo.toml --all-targets --all-features -- -D warnings
name: clippy
+81
View File
@@ -0,0 +1,81 @@
name: Test
on:
push:
branches:
- main
pull_request:
branches:
- main
- dev
paths-ignore:
- 'webview-src/**'
- 'webview-dist/**'
- 'examples/**'
jobs:
build-and-test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v2
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Install gtk on Ubuntu
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.0
- name: Get current date
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
- name: Get current date
if: matrix.os == 'windows-latest'
run: echo "CURRENT_DATE=$(Get-Date -Format "yyyy-MM-dd")" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Cache cargo state
uses: actions/cache@v2
env:
cache-name: cargo-state
with:
path: |
~/.cargo/registry
~/.cargo/git
~/.cargo/bin
key: ${{ matrix.os }}-stable-${{ env.cache-name }}-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }}
restore-keys: |
${{ matrix.os }}-stable-${{ env.cache-name }}-${{ hashFiles('**/Cargo.toml') }}-
${{ matrix.os }}-stable-${{ env.cache-name }}-
${{ matrix.os }}-stable-
${{ matrix.os }}-
- name: Cache cargo target
uses: actions/cache@v2
env:
cache-name: cargo-build
with:
path: ${{ matrix.project}}/target
# Add date to the cache to keep it up to date
key: ${{ matrix.os }}-stable-${{ env.cache-name }}-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
${{ matrix.os }}-stable-${{ env.cache-name }}-${{ hashFiles('**/Cargo.toml') }}
${{ matrix.os }}-stable-${{ env.cache-name }}-
${{ matrix.os }}-stable-
${{ matrix.os }}-
- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
args: --manifest-path=Cargo.toml --release
+2
View File
@@ -0,0 +1,2 @@
/target
/Cargo.lock
View File
+24
View File
@@ -0,0 +1,24 @@
[package]
name = "tauri-plugin-single-instance"
description = ""
version = "0.0.0"
authors = [ "Tauri Programme within The Commons Conservancy" ]
edition = "2021"
rust-version = "1.57"
exclude = ["/examples"]
[dependencies]
tauri = { version = "1.0.0-rc.6" }
[target.'cfg(target_os = "windows")'.dependencies.windows-sys]
version = "0.35"
features = [
"Win32_System_Threading",
"Win32_System_DataExchange",
"Win32_Foundation",
"Win32_UI_WindowsAndMessaging",
"Win32_Security",
"Win32_System_LibraryLoader",
"Win32_Graphics_Gdi"
]
+1
View File
@@ -0,0 +1 @@
# Tauri Plugin single-instance
+1
View File
@@ -0,0 +1 @@
node_modules/
+14
View File
@@ -0,0 +1,14 @@
{
"name": "app",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "MIT",
"dependencies": {
"@tauri-apps/cli": "^1.0.0-rc.0"
}
}
+106
View File
@@ -0,0 +1,106 @@
lockfileVersion: 5.3
specifiers:
'@tauri-apps/cli': ^1.0.0-rc.0
dependencies:
'@tauri-apps/cli': 1.0.0-rc.8
packages:
/@tauri-apps/cli-darwin-arm64/1.0.0-rc.8:
resolution: {integrity: sha512-sbV4fkd3YBlX0gEBldEVmN/NbBdHzrn8wCRRiFaNBocDWC6Ji6DNvpp1Vy1xgY0RgtGOisGD+3+HelmKP4Mh/A==}
engines: {node: '>= 10'}
cpu: [arm64]
os: [darwin]
requiresBuild: true
dev: false
optional: true
/@tauri-apps/cli-darwin-x64/1.0.0-rc.8:
resolution: {integrity: sha512-VmuYbBZKKal/YxSTbzHTaM04C9zUlTXq7ePoXc1PRAa/Xafo16N37OGzhzBlsKHrvh6BtPp9ZWk5UhHIDiJBsw==}
engines: {node: '>= 10'}
cpu: [x64]
os: [darwin]
requiresBuild: true
dev: false
optional: true
/@tauri-apps/cli-linux-arm-gnueabihf/1.0.0-rc.8:
resolution: {integrity: sha512-2VKkS1c2pK56sgtGxtsm9nKKWefG7dgPnynTuCoEngkgQfNIlZ1ns/eAIZpBmwhvOMOw2OesKvK9ZQo0/lE/IA==}
engines: {node: '>= 10'}
cpu: [arm]
os: [linux]
requiresBuild: true
dev: false
optional: true
/@tauri-apps/cli-linux-arm64-gnu/1.0.0-rc.8:
resolution: {integrity: sha512-jykbrTJyx0uJhhL/3PPYGx5ETqEzacJ3YChnHzVClSzPkrdoGC61/xY9dMD9ZFJsLMJkV4VJj8sGRd1OPKCa/w==}
engines: {node: '>= 10'}
cpu: [arm64]
os: [linux]
requiresBuild: true
dev: false
optional: true
/@tauri-apps/cli-linux-arm64-musl/1.0.0-rc.8:
resolution: {integrity: sha512-HAIm8BKpLIWkvYgxoRzDIaqWIW3UtH2HO1qDd0aov5FTx/9dtCTtylpvd/6mWs5LGaEmsLoSokfJloI2sMZ/WQ==}
engines: {node: '>= 10'}
cpu: [arm64]
os: [linux]
requiresBuild: true
dev: false
optional: true
/@tauri-apps/cli-linux-x64-gnu/1.0.0-rc.8:
resolution: {integrity: sha512-fnPrkX6Uy9Qz2vqnT3D3sgbJzXTR4arNUIQl8HIYi2YCZZVmDWczz4x4++ilZWwk0I3a7d612/WzTeBzQjn3kg==}
engines: {node: '>= 10'}
cpu: [x64]
os: [linux]
requiresBuild: true
dev: false
optional: true
/@tauri-apps/cli-linux-x64-musl/1.0.0-rc.8:
resolution: {integrity: sha512-kHrpBsJFRAwqFL7xnsrKdNxnYjzI/J9/Dr7T3rl+IIPbi1sIojh6DydxFOYepnuoINA6zWYQJpo0FQeASJsXrw==}
engines: {node: '>= 10'}
cpu: [x64]
os: [linux]
requiresBuild: true
dev: false
optional: true
/@tauri-apps/cli-win32-ia32-msvc/1.0.0-rc.8:
resolution: {integrity: sha512-y8uT7AaIZVdLAWL4pxj/GXitwWn828er23yniOvTo1mJMCZsSFdwiOGiRSXI6OZsVCOPiJmvqq7eWaskQKYA0A==}
engines: {node: '>= 10'}
cpu: [ia32]
os: [win32]
requiresBuild: true
dev: false
optional: true
/@tauri-apps/cli-win32-x64-msvc/1.0.0-rc.8:
resolution: {integrity: sha512-PiDr/iAKoL9nQSiWHkUSjRVHbvCJaa7Xj3P9UnGkjJQ9LGTr7AYZdLk4zISegF+/fZnOmaqUdZW9yWPPyJAzPw==}
engines: {node: '>= 10'}
cpu: [x64]
os: [win32]
requiresBuild: true
dev: false
optional: true
/@tauri-apps/cli/1.0.0-rc.8:
resolution: {integrity: sha512-FWpNwbgGMPgDb41oO7wdBhBsBE6FMG9yHKbtbrkJ/8d/hWcT6e3UUTfFL9cR2VGdp1pdWlul5+BKH0PTf8rB9w==}
engines: {node: '>= 10'}
hasBin: true
optionalDependencies:
'@tauri-apps/cli-darwin-arm64': 1.0.0-rc.8
'@tauri-apps/cli-darwin-x64': 1.0.0-rc.8
'@tauri-apps/cli-linux-arm-gnueabihf': 1.0.0-rc.8
'@tauri-apps/cli-linux-arm64-gnu': 1.0.0-rc.8
'@tauri-apps/cli-linux-arm64-musl': 1.0.0-rc.8
'@tauri-apps/cli-linux-x64-gnu': 1.0.0-rc.8
'@tauri-apps/cli-linux-x64-musl': 1.0.0-rc.8
'@tauri-apps/cli-win32-ia32-msvc': 1.0.0-rc.8
'@tauri-apps/cli-win32-x64-msvc': 1.0.0-rc.8
dev: false
+5
View File
@@ -0,0 +1,5 @@
<html>
<body>
<div>Plugin example</div>
</body>
</html>
+4
View File
@@ -0,0 +1,4 @@
# Generated by Cargo
# will have compiled files and executables
/target/
WixTools
File diff suppressed because it is too large Load Diff
+21
View File
@@ -0,0 +1,21 @@
[package]
name = "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.0.0-rc.6", features = ["api-all"] }
tauri-plugin-single-instance = { path = "../../../" }
[build-dependencies]
tauri-build = { version = "1.0.0-rc.5", features = [] }
[features]
default = [ "custom-protocol" ]
custom-protocol = [ "tauri/custom-protocol" ]
+3
View File
@@ -0,0 +1,3 @@
fn main() {
tauri_build::build()
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 974 B

Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

+14
View File
@@ -0,0 +1,14 @@
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"
+13
View File
@@ -0,0 +1,13 @@
#![cfg_attr(
all(not(debug_assertions), target_os = "windows"),
windows_subsystem = "windows"
)]
fn main() {
tauri::Builder::default()
.plugin(tauri_plugin_single_instance::init(|argv, cwd| {
println!("{argv:?}, {cwd}");
}))
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
@@ -0,0 +1,62 @@
{
"package": {
"productName": "app",
"version": "0.1.0"
},
"build": {
"distDir": "../public",
"devPath": "../public"
},
"tauri": {
"bundle": {
"active": true,
"targets": "all",
"identifier": "com.tauri.single-instance",
"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": ""
}
},
"updater": {
"active": false
},
"allowlist": {
"all": true
},
"windows": [
{
"title": "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'"
}
}
}
+11
View File
@@ -0,0 +1,11 @@
use tauri::{plugin::TauriPlugin, Runtime};
#[cfg(target_os = "windows")]
#[path = "platform_impl/windows.rs"]
mod platform_impl;
pub(crate) type SingleInstanceCallback = dyn FnMut(Vec<String>, String) + Send + 'static;
pub fn init<R: Runtime, F: FnMut(Vec<String>, String) + Send + 'static>(f: F) -> TauriPlugin<R> {
platform_impl::init(Box::new(f))
}