diff --git a/plugins/app/CHANGELOG.md b/plugins/app/CHANGELOG.md
deleted file mode 100644
index 3109c03f..00000000
--- a/plugins/app/CHANGELOG.md
+++ /dev/null
@@ -1,18 +0,0 @@
-# Changelog
-
-## \[2.0.0-alpha.2]
-
-- [`4e2cef9`](https://github.com/tauri-apps/plugins-workspace/commit/4e2cef9b702bbbb9cf4ee17de50791cb21f1b2a4)([#593](https://github.com/tauri-apps/plugins-workspace/pull/593)) Update to alpha.12.
-
-## \[2.0.0-alpha.1]
-
-- [`d74fc0a`](https://github.com/tauri-apps/plugins-workspace/commit/d74fc0a097996e90a37be8f57d50b7d1f6ca616f)([#555](https://github.com/tauri-apps/plugins-workspace/pull/555)) Update to alpha.11.
-
-## \[2.0.0-alpha.0]
-
-- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
- te to alpha.11.
-
-## \[2.0.0-alpha.0]
-
-- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
diff --git a/plugins/app/Cargo.toml b/plugins/app/Cargo.toml
deleted file mode 100644
index 6e18978e..00000000
--- a/plugins/app/Cargo.toml
+++ /dev/null
@@ -1,14 +0,0 @@
-[package]
-name = "tauri-plugin-app"
-version = "2.0.0-alpha.2"
-description = "APIs to read application metadata and change app visibility on macOS."
-edition = { workspace = true }
-authors = { workspace = true }
-license = { workspace = true }
-rust-version = { workspace = true }
-
-[package.metadata.docs.rs]
-features = [ "tauri/dox" ]
-
-[dependencies]
-tauri = { workspace = true }
diff --git a/plugins/app/LICENSE.spdx b/plugins/app/LICENSE.spdx
deleted file mode 100644
index cdd0df5a..00000000
--- a/plugins/app/LICENSE.spdx
+++ /dev/null
@@ -1,20 +0,0 @@
-SPDXVersion: SPDX-2.1
-DataLicense: CC0-1.0
-PackageName: tauri
-DataFormat: SPDXRef-1
-PackageSupplier: Organization: The Tauri Programme in the Commons Conservancy
-PackageHomePage: https://tauri.app
-PackageLicenseDeclared: Apache-2.0
-PackageLicenseDeclared: MIT
-PackageCopyrightText: 2019-2022, The Tauri Programme in the Commons Conservancy
-PackageSummary: Tauri is a rust project that enables developers to make secure
-and small desktop applications using a web frontend.
-
-PackageComment: The package includes the following libraries; see
-Relationship information.
-
-Created: 2019-05-20T09:00:00Z
-PackageDownloadLocation: git://github.com/tauri-apps/tauri
-PackageDownloadLocation: git+https://github.com/tauri-apps/tauri.git
-PackageDownloadLocation: git+ssh://github.com/tauri-apps/tauri.git
-Creator: Person: Daniel Thompson-Yvetot
\ No newline at end of file
diff --git a/plugins/app/LICENSE_APACHE-2.0 b/plugins/app/LICENSE_APACHE-2.0
deleted file mode 100644
index 4947287f..00000000
--- a/plugins/app/LICENSE_APACHE-2.0
+++ /dev/null
@@ -1,177 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
\ No newline at end of file
diff --git a/plugins/app/LICENSE_MIT b/plugins/app/LICENSE_MIT
deleted file mode 100644
index 4d754725..00000000
--- a/plugins/app/LICENSE_MIT
+++ /dev/null
@@ -1,21 +0,0 @@
-MIT License
-
-Copyright (c) 2017 - Present Tauri Apps Contributors
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
\ No newline at end of file
diff --git a/plugins/app/README.md b/plugins/app/README.md
deleted file mode 100644
index d79c52e3..00000000
--- a/plugins/app/README.md
+++ /dev/null
@@ -1,76 +0,0 @@
-
-
-This plugin provides APIs to read application metadata and macOS app visibility functions.
-
-## Install
-
-_This plugin requires a Rust version of at least **1.65**_
-
-There are three general methods of installation that we can recommend.
-
-1. Use crates.io and npm (easiest, and requires you to trust that our publishing pipeline worked)
-2. Pull sources directly from Github using git tags / revision hashes (most secure)
-3. Git submodule install this repo in your tauri project and then use file protocol to ingest the source (most secure, but inconvenient to use)
-
-Install the Core plugin by adding the following to your `Cargo.toml` file:
-
-`src-tauri/Cargo.toml`
-
-```toml
-[dependencies]
-tauri-plugin-app = "2.0.0-alpha"
-# alternatively with Git:
-tauri-plugin-app = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
-```
-
-You can install the JavaScript Guest bindings using your preferred JavaScript package manager:
-
-> Note: Since most JavaScript package managers are unable to install packages from git monorepos we provide read-only mirrors of each plugin. This makes installation option 2 more ergonomic to use.
-
-```sh
-pnpm add @tauri-apps/plugin-app
-# or
-npm add @tauri-apps/plugin-app
-# or
-yarn add @tauri-apps/plugin-app
-
-# alternatively with Git:
-pnpm add https://github.com/tauri-apps/tauri-plugin-app#v2
-# or
-npm add https://github.com/tauri-apps/tauri-plugin-app#v2
-# or
-yarn add https://github.com/tauri-apps/tauri-plugin-app#v2
-```
-
-## Usage
-
-First you need to register the core plugin with Tauri:
-
-`src-tauri/src/main.rs`
-
-```rust
-fn main() {
- tauri::Builder::default()
- .plugin(tauri_plugin_app::init())
- .run(tauri::generate_context!())
- .expect("error while running tauri application");
-}
-```
-
-Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
-
-```javascript
-import { getVersion, hide } from "@tauri-apps/plugin-app";
-const appVersion = await getVersion();
-await hide();
-```
-
-## Contributing
-
-PRs accepted. Please make sure to read the Contributing Guide before making a pull request.
-
-## License
-
-Code: (c) 2015 - Present - The Tauri Programme within The Commons Conservancy.
-
-MIT or MIT/Apache 2.0 where applicable.
diff --git a/plugins/app/banner.png b/plugins/app/banner.png
deleted file mode 100644
index 752d36da..00000000
Binary files a/plugins/app/banner.png and /dev/null differ
diff --git a/plugins/app/guest-js/index.ts b/plugins/app/guest-js/index.ts
deleted file mode 100644
index b2420ad7..00000000
--- a/plugins/app/guest-js/index.ts
+++ /dev/null
@@ -1,90 +0,0 @@
-// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
-// SPDX-License-Identifier: Apache-2.0
-// SPDX-License-Identifier: MIT
-
-/**
- * Get application metadata.
- *
- * @module
- */
-
-declare global {
- interface Window {
- __TAURI_INVOKE__: (cmd: string, args?: unknown) => Promise;
- }
-}
-
-/**
- * Gets the application version.
- * @example
- * ```typescript
- * import { getVersion } from '@tauri-apps/plugin-app';
- * const appVersion = await getVersion();
- * ```
- *
- * @since 2.0.0
- */
-async function getVersion(): Promise {
- return window.__TAURI_INVOKE__("plugin:app|version");
-}
-
-/**
- * Gets the application name.
- * @example
- * ```typescript
- * import { getName } from '@tauri-apps/plugin-app';
- * const appName = await getName();
- * ```
- *
- * @since 2.0.0
- */
-async function getName(): Promise {
- return window.__TAURI_INVOKE__("plugin:app|name");
-}
-
-/**
- * Gets the Tauri version.
- *
- * @example
- * ```typescript
- * import { getTauriVersion } from '@tauri-apps/plugin-app';
- * const tauriVersion = await getTauriVersion();
- * ```
- *
- * @since 2.0.0
- */
-async function getTauriVersion(): Promise {
- return window.__TAURI_INVOKE__("plugin:app|tauri_version");
-}
-
-/**
- * Shows the application on macOS. This function does not automatically focus any specific app window.
- *
- * @example
- * ```typescript
- * import { show } from '@tauri-apps/plugin-app';
- * await show();
- * ```
- *
- * @since 2.0.0
- */
-async function show(): Promise {
- return window.__TAURI_INVOKE__("plugin:app|show");
-}
-
-/**
- * Hides the application on macOS.
- *
- * @example
- * ```typescript
- * import { hide } from '@tauri-apps/plugin-app';
- * await hide();
- * ```
- *
- * @since 2.0.0
- */
-async function hide(): Promise {
- return window.__TAURI_INVOKE__("plugin:app|hide");
-}
-
-export { getName, getVersion, getTauriVersion, show, hide };
diff --git a/plugins/app/package.json b/plugins/app/package.json
deleted file mode 100644
index 77d5bf43..00000000
--- a/plugins/app/package.json
+++ /dev/null
@@ -1,32 +0,0 @@
-{
- "name": "@tauri-apps/plugin-app",
- "version": "2.0.0-alpha.1",
- "license": "MIT or APACHE-2.0",
- "authors": [
- "Tauri Programme within The Commons Conservancy"
- ],
- "type": "module",
- "browser": "dist-js/index.min.js",
- "module": "dist-js/index.mjs",
- "types": "dist-js/index.d.ts",
- "exports": {
- "import": "./dist-js/index.mjs",
- "types": "./dist-js/index.d.ts",
- "browser": "./dist-js/index.min.js"
- },
- "scripts": {
- "build": "rollup -c"
- },
- "files": [
- "dist-js",
- "!dist-js/**/*.map",
- "README.md",
- "LICENSE"
- ],
- "devDependencies": {
- "tslib": "^2.5.0"
- },
- "dependencies": {
- "@tauri-apps/api": "2.0.0-alpha.8"
- }
-}
diff --git a/plugins/app/rollup.config.mjs b/plugins/app/rollup.config.mjs
deleted file mode 100644
index 99a3dd31..00000000
--- a/plugins/app/rollup.config.mjs
+++ /dev/null
@@ -1,11 +0,0 @@
-import { readFileSync } from "fs";
-
-import { createConfig } from "../../shared/rollup.config.mjs";
-
-export default createConfig({
- input: "guest-js/index.ts",
- pkg: JSON.parse(
- readFileSync(new URL("./package.json", import.meta.url), "utf8"),
- ),
- external: [/^@tauri-apps\/api/],
-});
diff --git a/plugins/app/src/api-iife.js b/plugins/app/src/api-iife.js
deleted file mode 100644
index a9e45a48..00000000
--- a/plugins/app/src/api-iife.js
+++ /dev/null
@@ -1 +0,0 @@
-if("__TAURI__"in window){var __TAURI_APP__=function(_){"use strict";return _.getName=async function(){return window.__TAURI_INVOKE__("plugin:app|name")},_.getTauriVersion=async function(){return window.__TAURI_INVOKE__("plugin:app|tauri_version")},_.getVersion=async function(){return window.__TAURI_INVOKE__("plugin:app|version")},_.hide=async function(){return window.__TAURI_INVOKE__("plugin:app|hide")},_.show=async function(){return window.__TAURI_INVOKE__("plugin:app|show")},_}({});Object.defineProperty(window.__TAURI__,"app",{value:__TAURI_APP__})}
diff --git a/plugins/app/src/commands.rs b/plugins/app/src/commands.rs
deleted file mode 100644
index ebe06f76..00000000
--- a/plugins/app/src/commands.rs
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
-// SPDX-License-Identifier: Apache-2.0
-// SPDX-License-Identifier: MIT
-
-use tauri::{AppHandle, Runtime};
-
-#[tauri::command]
-pub fn version(app: AppHandle) -> String {
- app.package_info().version.to_string()
-}
-
-#[tauri::command]
-pub fn name(app: AppHandle) -> String {
- app.package_info().name.clone()
-}
-
-#[tauri::command]
-pub fn tauri_version() -> &'static str {
- tauri::VERSION
-}
-
-#[tauri::command]
-#[allow(unused_variables)]
-pub fn show(app: AppHandle) -> tauri::Result<()> {
- #[cfg(target_os = "macos")]
- app.show()?;
- Ok(())
-}
-
-#[tauri::command]
-#[allow(unused_variables)]
-pub fn hide(app: AppHandle) -> tauri::Result<()> {
- #[cfg(target_os = "macos")]
- app.hide()?;
- Ok(())
-}
diff --git a/plugins/app/src/lib.rs b/plugins/app/src/lib.rs
deleted file mode 100644
index fbfd27d5..00000000
--- a/plugins/app/src/lib.rs
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
-// SPDX-License-Identifier: Apache-2.0
-// SPDX-License-Identifier: MIT
-
-//! [](https://github.com/tauri-apps/plugins-workspace/tree/v2/plugins/app)
-//!
-//! This plugin provides APIs to read application metadata and macOS app visibility functions.
-
-#![doc(
- html_logo_url = "https://github.com/tauri-apps/tauri/raw/dev/app-icon.png",
- html_favicon_url = "https://github.com/tauri-apps/tauri/raw/dev/app-icon.png"
-)]
-
-use tauri::{
- plugin::{Builder, TauriPlugin},
- Runtime,
-};
-
-mod commands;
-
-pub fn init() -> TauriPlugin {
- Builder::new("app")
- .js_init_script(include_str!("api-iife.js").to_string())
- .invoke_handler(tauri::generate_handler![
- commands::version,
- commands::name,
- commands::tauri_version,
- commands::show,
- commands::hide
- ])
- .build()
-}
diff --git a/plugins/app/tsconfig.json b/plugins/app/tsconfig.json
deleted file mode 100644
index 5098169a..00000000
--- a/plugins/app/tsconfig.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "extends": "../../tsconfig.base.json",
- "include": ["guest-js/*.ts"]
-}
diff --git a/plugins/mirrors.txt b/plugins/mirrors.txt
index dfa1a2b3..73f0816e 100644
--- a/plugins/mirrors.txt
+++ b/plugins/mirrors.txt
@@ -1,4 +1,3 @@
-app
authenticator
autostart
cli
@@ -19,5 +18,4 @@ stronghold
updater
upload
websocket
-window
window-state
diff --git a/plugins/window/CHANGELOG.md b/plugins/window/CHANGELOG.md
deleted file mode 100644
index 352c6c20..00000000
--- a/plugins/window/CHANGELOG.md
+++ /dev/null
@@ -1,27 +0,0 @@
-# Changelog
-
-## \[2.0.0-alpha.2]
-
-- [`4e2cef9`](https://github.com/tauri-apps/plugins-workspace/commit/4e2cef9b702bbbb9cf4ee17de50791cb21f1b2a4)([#593](https://github.com/tauri-apps/plugins-workspace/pull/593)) Update to alpha.12.
-- [`70e535a`](https://github.com/tauri-apps/plugins-workspace/commit/70e535abd5410873862fb035b6b66f0fea1edde2)([#590](https://github.com/tauri-apps/plugins-workspace/pull/590)) On macOS, fixed tapping on custom title bar doesn't maximize the window.
-
-## \[2.0.0-alpha.1]
-
-- [`d74fc0a`](https://github.com/tauri-apps/plugins-workspace/commit/d74fc0a097996e90a37be8f57d50b7d1f6ca616f)([#555](https://github.com/tauri-apps/plugins-workspace/pull/555)) Update to alpha.11.
-- [`2fc420b`](https://github.com/tauri-apps/plugins-workspace/commit/2fc420ba375de924f236f5b32d26667f742fcd6b)([#418](https://github.com/tauri-apps/plugins-workspace/pull/418)) Add `incognito` window configuration option
-- [`84133b5`](https://github.com/tauri-apps/plugins-workspace/commit/84133b57b8c443007c728dd8dbe32b08804009f9)([#426](https://github.com/tauri-apps/plugins-workspace/pull/426)) The window plugin is recieving a few changes to improve consistency and add new features:
-
- - Removed `appWindow` variable from JS module, use `getCurrent` or `Window.getCurrent`.
- - Removed `WindowManager`, `WebviewWindow` and `WebviewHandle` types and merged them into one `Window` type that matches the name of the rust window type.
- - Added `Window.getCurrent` and `Window.getAll` which is a convenient method for `getCurrent` and `getAll` functions.
-- [`c8c3191`](https://github.com/tauri-apps/plugins-workspace/commit/c8c3191565aef518037f9f4519886ca98329fe47)([#392](https://github.com/tauri-apps/plugins-workspace/pull/392)) Added the `setEffects` and `clearEffects` API.
-
-### feat
-
-- [`a79d6d9`](https://github.com/tauri-apps/plugins-workspace/commit/a79d6d94bdbf6d1919adff8e65f79240c31d4a14)([#406](https://github.com/tauri-apps/plugins-workspace/pull/406)) Added the `maximizable`, `minimizable` and `closable` fields on `WindowOptions`.
-- [`a79d6d9`](https://github.com/tauri-apps/plugins-workspace/commit/a79d6d94bdbf6d1919adff8e65f79240c31d4a14)([#406](https://github.com/tauri-apps/plugins-workspace/pull/406)) Added the `setMaximizable`, `setMinimizable`, `setClosable`, `isMaximizable`, `isMinimizable` and `isClosable` methods.
-- [`83abea3`](https://github.com/tauri-apps/plugins-workspace/commit/83abea3cae8408ce262f3815c1a6cc506e73c486)([#407](https://github.com/tauri-apps/plugins-workspace/pull/407)) Add `WebviewWindow.is_focused` and `WebviewWindow.getFocusedWindow` getters.
-
-## \[2.0.0-alpha.0]
-
-- [`717ae67`](https://github.com/tauri-apps/plugins-workspace/commit/717ae670978feb4492fac1f295998b93f2b9347f)([#371](https://github.com/tauri-apps/plugins-workspace/pull/371)) First v2 alpha release!
diff --git a/plugins/window/Cargo.toml b/plugins/window/Cargo.toml
deleted file mode 100644
index c11a4a81..00000000
--- a/plugins/window/Cargo.toml
+++ /dev/null
@@ -1,21 +0,0 @@
-[package]
-name = "tauri-plugin-window"
-version = "2.0.0-alpha.2"
-description = "Interact with the Tauri window."
-edition = { workspace = true }
-authors = { workspace = true }
-license = { workspace = true }
-rust-version = { workspace = true }
-
-[package.metadata.docs.rs]
-features = [ "tauri/dox" ]
-
-[dependencies]
-tauri = { workspace = true }
-serde = { workspace = true }
-thiserror = { workspace = true }
-
-[features]
-icon-png = [ "tauri/icon-png" ]
-icon-ico = [ "tauri/icon-ico" ]
-devtools = [ ]
diff --git a/plugins/window/LICENSE.spdx b/plugins/window/LICENSE.spdx
deleted file mode 100644
index cdd0df5a..00000000
--- a/plugins/window/LICENSE.spdx
+++ /dev/null
@@ -1,20 +0,0 @@
-SPDXVersion: SPDX-2.1
-DataLicense: CC0-1.0
-PackageName: tauri
-DataFormat: SPDXRef-1
-PackageSupplier: Organization: The Tauri Programme in the Commons Conservancy
-PackageHomePage: https://tauri.app
-PackageLicenseDeclared: Apache-2.0
-PackageLicenseDeclared: MIT
-PackageCopyrightText: 2019-2022, The Tauri Programme in the Commons Conservancy
-PackageSummary: Tauri is a rust project that enables developers to make secure
-and small desktop applications using a web frontend.
-
-PackageComment: The package includes the following libraries; see
-Relationship information.
-
-Created: 2019-05-20T09:00:00Z
-PackageDownloadLocation: git://github.com/tauri-apps/tauri
-PackageDownloadLocation: git+https://github.com/tauri-apps/tauri.git
-PackageDownloadLocation: git+ssh://github.com/tauri-apps/tauri.git
-Creator: Person: Daniel Thompson-Yvetot
\ No newline at end of file
diff --git a/plugins/window/LICENSE_APACHE-2.0 b/plugins/window/LICENSE_APACHE-2.0
deleted file mode 100644
index 4947287f..00000000
--- a/plugins/window/LICENSE_APACHE-2.0
+++ /dev/null
@@ -1,177 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
\ No newline at end of file
diff --git a/plugins/window/LICENSE_MIT b/plugins/window/LICENSE_MIT
deleted file mode 100644
index 4d754725..00000000
--- a/plugins/window/LICENSE_MIT
+++ /dev/null
@@ -1,21 +0,0 @@
-MIT License
-
-Copyright (c) 2017 - Present Tauri Apps Contributors
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
\ No newline at end of file
diff --git a/plugins/window/README.md b/plugins/window/README.md
deleted file mode 100644
index d29d2f3b..00000000
--- a/plugins/window/README.md
+++ /dev/null
@@ -1,89 +0,0 @@
-
-
-Interact with the Tauri window.
-
-## Install
-
-_This plugin requires a Rust version of at least **1.65**_
-
-There are three general methods of installation that we can recommend.
-
-1. Use crates.io and npm (easiest, and requires you to trust that our publishing pipeline worked)
-2. Pull sources directly from Github using git tags / revision hashes (most secure)
-3. Git submodule install this repo in your tauri project and then use file protocol to ingest the source (most secure, but inconvenient to use)
-
-Install the Core plugin by adding the following to your `Cargo.toml` file:
-
-`src-tauri/Cargo.toml`
-
-```toml
-[dependencies]
-tauri-plugin-window = "2.0.0-alpha"
-# alternatively with Git:
-tauri-plugin-window = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
-```
-
-You can install the JavaScript Guest bindings using your preferred JavaScript package manager:
-
-> Note: Since most JavaScript package managers are unable to install packages from git monorepos we provide read-only mirrors of each plugin. This makes installation option 2 more ergonomic to use.
-
-```sh
-pnpm add @tauri-apps/plugin-window
-# or
-npm add @tauri-apps/plugin-window
-# or
-yarn add @tauri-apps/plugin-window
-
-# alternatively with Git:
-pnpm add https://github.com/tauri-apps/tauri-plugin-window#v2
-# or
-npm add https://github.com/tauri-apps/tauri-plugin-window#v2
-# or
-yarn add https://github.com/tauri-apps/tauri-plugin-window#v2
-```
-
-## Usage
-
-First you need to register the core plugin with Tauri:
-
-`src-tauri/src/main.rs`
-
-```rust
-fn main() {
- tauri::Builder::default()
- .plugin(tauri_plugin_window::init())
- .run(tauri::generate_context!())
- .expect("error while running tauri application");
-}
-```
-
-Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
-
-```javascript
-import { getCurrent, Window } from "@tauri-apps/plugin-window";
-
-const appWindow = getCurrent();
-
-// manipulating this window
-await appWindow.setResizable(false);
-
-// Creating new windows:
-// loading embedded asset:
-const webview = new Window("theUniqueLabel", {
- url: "path/to/page.html",
-});
-// alternatively, load a remote URL:
-const webview = new Window("theUniqueLabel", {
- url: "https://github.com/tauri-apps/tauri",
-});
-```
-
-## Contributing
-
-PRs accepted. Please make sure to read the Contributing Guide before making a pull request.
-
-## License
-
-Code: (c) 2015 - Present - The Tauri Programme within The Commons Conservancy.
-
-MIT or MIT/Apache 2.0 where applicable.
diff --git a/plugins/window/banner.png b/plugins/window/banner.png
deleted file mode 100644
index ea52673a..00000000
Binary files a/plugins/window/banner.png and /dev/null differ
diff --git a/plugins/window/build.rs b/plugins/window/build.rs
deleted file mode 100644
index 0b339c43..00000000
--- a/plugins/window/build.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
-// SPDX-License-Identifier: Apache-2.0
-// SPDX-License-Identifier: MIT
-
-fn main() {
- let target_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap();
- let mobile = target_os == "ios" || target_os == "android";
- alias("desktop", !mobile);
- alias("mobile", mobile);
-}
-
-// creates a cfg alias if `has_feature` is true.
-// `alias` must be a snake case string.
-fn alias(alias: &str, has_feature: bool) {
- if has_feature {
- println!("cargo:rustc-cfg={alias}");
- }
-}
diff --git a/plugins/window/guest-js/index.ts b/plugins/window/guest-js/index.ts
deleted file mode 100644
index 23c02a86..00000000
--- a/plugins/window/guest-js/index.ts
+++ /dev/null
@@ -1,2347 +0,0 @@
-// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
-// SPDX-License-Identifier: Apache-2.0
-// SPDX-License-Identifier: MIT
-
-/**
- * Provides APIs to create windows, communicate with other windows and manipulate the current window.
- *
- * ## Window events
- *
- * Events can be listened to using {@link Window.listen}:
- * ```typescript
- * import { getCurrent } from "@tauri-apps/plugin-window";
- * getCurrent().listen("my-window-event", ({ event, payload }) => { });
- * ```
- *
- * @module
- */
-
-import type {
- Event,
- EventName,
- EventCallback,
- UnlistenFn,
-} from "@tauri-apps/api/event";
-import { TauriEvent, emit, listen, once } from "@tauri-apps/api/event";
-
-declare global {
- interface Window {
- __TAURI_INVOKE__: (cmd: string, args?: unknown) => Promise;
- }
-}
-
-type Theme = "light" | "dark";
-type TitleBarStyle = "visible" | "transparent" | "overlay";
-
-/**
- * Allows you to retrieve information about a given monitor.
- *
- * @since 2.0.0
- */
-interface Monitor {
- /** Human-readable name of the monitor */
- name: string | null;
- /** The monitor's resolution. */
- size: PhysicalSize;
- /** the Top-left corner position of the monitor relative to the larger full screen area. */
- position: PhysicalPosition;
- /** The scale factor that can be used to map physical pixels to logical pixels. */
- scaleFactor: number;
-}
-
-/**
- * The payload for the `scaleChange` event.
- *
- * @since 2.0.0
- */
-interface ScaleFactorChanged {
- /** The new window scale factor. */
- scaleFactor: number;
- /** The new window size */
- size: PhysicalSize;
-}
-
-/** The file drop event types. */
-type FileDropEvent =
- | { type: "hover"; paths: string[] }
- | { type: "drop"; paths: string[] }
- | { type: "cancel" };
-
-/**
- * A size represented in logical pixels.
- *
- * @since 2.0.0
- */
-class LogicalSize {
- type = "Logical";
- width: number;
- height: number;
-
- constructor(width: number, height: number) {
- this.width = width;
- this.height = height;
- }
-}
-
-/**
- * A size represented in physical pixels.
- *
- * @since 2.0.0
- */
-class PhysicalSize {
- type = "Physical";
- width: number;
- height: number;
-
- constructor(width: number, height: number) {
- this.width = width;
- this.height = height;
- }
-
- /**
- * Converts the physical size to a logical one.
- * @example
- * ```typescript
- * import { getCurrent } from '@tauri-apps/plugin-window';
- * const appWindow = getCurrent();
- * const factor = await appWindow.scaleFactor();
- * const size = await appWindow.innerSize();
- * const logical = size.toLogical(factor);
- * ```
- * */
- toLogical(scaleFactor: number): LogicalSize {
- return new LogicalSize(this.width / scaleFactor, this.height / scaleFactor);
- }
-}
-
-/**
- * A position represented in logical pixels.
- *
- * @since 2.0.0
- */
-class LogicalPosition {
- type = "Logical";
- x: number;
- y: number;
-
- constructor(x: number, y: number) {
- this.x = x;
- this.y = y;
- }
-}
-
-/**
- * A position represented in physical pixels.
- *
- * @since 2.0.0
- */
-class PhysicalPosition {
- type = "Physical";
- x: number;
- y: number;
-
- constructor(x: number, y: number) {
- this.x = x;
- this.y = y;
- }
-
- /**
- * Converts the physical position to a logical one.
- * @example
- * ```typescript
- * import { getCurrent } from '@tauri-apps/plugin-window';
- * const appWindow = getCurrent();
- * const factor = await appWindow.scaleFactor();
- * const position = await appWindow.innerPosition();
- * const logical = position.toLogical(factor);
- * ```
- * */
- toLogical(scaleFactor: number): LogicalPosition {
- return new LogicalPosition(this.x / scaleFactor, this.y / scaleFactor);
- }
-}
-
-/** @ignore */
-interface WindowDef {
- label: string;
-}
-
-/** @ignore */
-declare global {
- interface Window {
- __TAURI_METADATA__: {
- __windows: WindowDef[];
- __currentWindow: WindowDef;
- };
- }
-}
-
-/**
- * Attention type to request on a window.
- *
- * @since 2.0.0
- */
-enum UserAttentionType {
- /**
- * #### Platform-specific
- * - **macOS:** Bounces the dock icon until the application is in focus.
- * - **Windows:** Flashes both the window and the taskbar button until the application is in focus.
- */
- Critical = 1,
- /**
- * #### Platform-specific
- * - **macOS:** Bounces the dock icon once.
- * - **Windows:** Flashes the taskbar button until the application is in focus.
- */
- Informational,
-}
-
-class CloseRequestedEvent {
- /** Event name */
- event: EventName;
- /** The label of the window that emitted this event. */
- windowLabel: string;
- /** Event identifier used to unlisten */
- id: number;
- private _preventDefault = false;
-
- constructor(event: Event) {
- this.event = event.event;
- this.windowLabel = event.windowLabel;
- this.id = event.id;
- }
-
- preventDefault(): void {
- this._preventDefault = true;
- }
-
- isPreventDefault(): boolean {
- return this._preventDefault;
- }
-}
-
-export type CursorIcon =
- | "default"
- | "crosshair"
- | "hand"
- | "arrow"
- | "move"
- | "text"
- | "wait"
- | "help"
- | "progress"
- // something cannot be done
- | "notAllowed"
- | "contextMenu"
- | "cell"
- | "verticalText"
- | "alias"
- | "copy"
- | "noDrop"
- // something can be grabbed
- | "grab"
- /// something is grabbed
- | "grabbing"
- | "allScroll"
- | "zoomIn"
- | "zoomOut"
- // edge is to be moved
- | "eResize"
- | "nResize"
- | "neResize"
- | "nwResize"
- | "sResize"
- | "seResize"
- | "swResize"
- | "wResize"
- | "ewResize"
- | "nsResize"
- | "neswResize"
- | "nwseResize"
- | "colResize"
- | "rowResize";
-
-/**
- * Get an instance of `Window` for the current window.
- *
- * @since 2.0.0
- */
-function getCurrent(): Window {
- return new Window(window.__TAURI_METADATA__.__currentWindow.label, {
- // @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
- skip: true,
- });
-}
-
-/**
- * Gets a list of instances of `Window` for all available windows.
- *
- * @since 2.0.0
- */
-function getAll(): Window[] {
- return window.__TAURI_METADATA__.__windows.map(
- (w) =>
- new Window(w.label, {
- // @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
- skip: true,
- }),
- );
-}
-
-/** @ignore */
-// events that are emitted right here instead of by the created webview
-const localTauriEvents = ["tauri://created", "tauri://error"];
-/** @ignore */
-export type WindowLabel = string;
-
-/**
- * Create new webview window or get a handle to an existing one.
- *
- * Windows are identified by a *label* a unique identifier that can be used to reference it later.
- * It may only contain alphanumeric characters `a-zA-Z` plus the following special characters `-`, `/`, `:` and `_`.
- *
- * @example
- * ```typescript
- * // loading embedded asset:
- * const appWindow = new Window('theUniqueLabel', {
- * url: 'path/to/page.html'
- * });
- * // alternatively, load a remote URL:
- * const appWindow = new Window('theUniqueLabel', {
- * url: 'https://github.com/tauri-apps/tauri'
- * });
- *
- * appWindow.once('tauri://created', function () {
- * // window successfully created
- * });
- * appWindow.once('tauri://error', function (e) {
- * // an error happened creating the window
- * });
- *
- * // emit an event to the backend
- * await appWindow.emit("some event", "data");
- * // listen to an event from the backend
- * const unlisten = await appWindow.listen("event name", e => {});
- * unlisten();
- * ```
- *
- * @since 2.0.0
- */
-class Window {
- /** The window label. It is a unique identifier for the window, can be used to reference it later. */
- label: WindowLabel;
- /** Local event listeners. */
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- listeners: Record>>;
-
- /**
- * Creates a new Window.
- * @example
- * ```typescript
- * import { Window } from '@tauri-apps/plugin-window';
- * const appWindow = new Window('my-label', {
- * url: 'https://github.com/tauri-apps/tauri'
- * });
- * appWindow.once('tauri://created', function () {
- * // window successfully created
- * });
- * appWindow.once('tauri://error', function (e) {
- * // an error happened creating the window
- * });
- * ```
- *
- * @param label The unique webview window label. Must be alphanumeric: `a-zA-Z-/:_`.
- * @returns The {@link Window} instance to communicate with the webview.
- *
- * @since 2.0.0
- */
- constructor(label: WindowLabel, options: WindowOptions = {}) {
- this.label = label;
- this.listeners = Object.create(null);
-
- // @ts-expect-error `skip` is not a public API so it is not defined in WindowOptions
- if (!options?.skip) {
- window
- .__TAURI_INVOKE__("plugin:window|create", {
- options: {
- ...options,
- label,
- },
- })
- .then(async () => this.emit("tauri://created"))
- .catch(async (e: string) => this.emit("tauri://error", e));
- }
- }
-
- /**
- * Gets the Window for the webview associated with the given label.
- * @example
- * ```typescript
- * import { Window } from '@tauri-apps/plugin-window';
- * const mainWindow = Window.getByLabel('main');
- * ```
- *
- * @param label The webview window label.
- * @returns The Window instance to communicate with the webview or null if the webview doesn't exist.
- *
- * @since 2.0.0
- */
- static getByLabel(label: string): Window | null {
- if (getAll().some((w) => w.label === label)) {
- // @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
- return new Window(label, { skip: true });
- }
- return null;
- }
-
- /**
- * Get an instance of `Window` for the current window.
- *
- * @since 2.0.0
- */
- static getCurrent(): Window {
- return getCurrent();
- }
-
- /**
- * Gets a list of instances of `Window` for all available windows.
- *
- * @since 2.0.0
- */
- static getAll(): Window[] {
- return getAll();
- }
-
- /**
- * Gets the focused window.
- * @example
- * ```typescript
- * import { Window } from '@tauri-apps/plugin-window';
- * const focusedWindow = Window.getFocusedWindow();
- * ```
- *
- * @returns The Window instance to communicate with the webview or `undefined` if there is not any focused window.
- *
- * @since 1.4
- */
- static async getFocusedWindow(): Promise {
- for (const w of getAll()) {
- if (await w.isFocused()) {
- return w;
- }
- }
- return null;
- }
-
- /**
- * Listen to an event emitted by the backend that is tied to the webview window.
- *
- * @example
- * ```typescript
- * import { getCurrent } from '@tauri-apps/plugin-window';
- * const unlisten = await getCurrent().listen('state-changed', (event) => {
- * console.log(`Got error: ${payload}`);
- * });
- *
- * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted
- * unlisten();
- * ```
- *
- * @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`.
- * @param handler Event handler.
- * @returns A promise resolving to a function to unlisten to the event.
- * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
- *
- * @since 2.0.0
- */
- async listen(
- event: EventName,
- handler: EventCallback,
- ): Promise {
- if (this._handleTauriEvent(event, handler)) {
- return Promise.resolve(() => {
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, security/detect-object-injection
- const listeners = this.listeners[event];
- listeners.splice(listeners.indexOf(handler), 1);
- });
- }
- return listen(event, handler, { target: this.label });
- }
-
- /**
- * Listen to an one-off event emitted by the backend that is tied to the webview window.
- *
- * @example
- * ```typescript
- * import { getCurrent } from '@tauri-apps/plugin-window';
- * const unlisten = await getCurrent().once('initialized', (event) => {
- * console.log(`Window initialized!`);
- * });
- *
- * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted
- * unlisten();
- * ```
- *
- * @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`.
- * @param handler Event handler.
- * @returns A promise resolving to a function to unlisten to the event.
- * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
- *
- * @since 2.0.0
- */
- async once(event: string, handler: EventCallback): Promise {
- if (this._handleTauriEvent(event, handler)) {
- return Promise.resolve(() => {
- // eslint-disable-next-line security/detect-object-injection
- const listeners = this.listeners[event];
- listeners.splice(listeners.indexOf(handler), 1);
- });
- }
- return once(event, handler, { target: this.label });
- }
-
- /**
- * Emits an event to the backend, tied to the webview window.
- * @example
- * ```typescript
- * import { getCurrent } from '@tauri-apps/plugin-window';
- * await getCurrent().emit('window-loaded', { loggedIn: true, token: 'authToken' });
- * ```
- *
- * @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`.
- * @param payload Event payload.
- */
- async emit(event: string, payload?: unknown): Promise {
- if (localTauriEvents.includes(event)) {
- // eslint-disable-next-line
- for (const handler of this.listeners[event] || []) {
- handler({ event, id: -1, windowLabel: this.label, payload });
- }
- return Promise.resolve();
- }
- return emit(event, payload, { target: this.label });
- }
-
- /** @ignore */
- _handleTauriEvent(event: string, handler: EventCallback): boolean {
- if (localTauriEvents.includes(event)) {
- if (!(event in this.listeners)) {
- // eslint-disable-next-line
- this.listeners[event] = [handler];
- } else {
- // eslint-disable-next-line
- this.listeners[event].push(handler);
- }
- return true;
- }
- return false;
- }
-
- // Getters
- /**
- * The scale factor that can be used to map physical pixels to logical pixels.
- * @example
- * ```typescript
- * import { getCurrent } from '@tauri-apps/plugin-window';
- * const factor = await getCurrent().scaleFactor();
- * ```
- *
- * @returns The window's monitor scale factor.
- *
- * @since 2.0.0
- * */
- async scaleFactor(): Promise {
- return window.__TAURI_INVOKE__("plugin:window|scale_factor", {
- label: this.label,
- });
- }
-
- /**
- * The position of the top-left hand corner of the window's client area relative to the top-left hand corner of the desktop.
- * @example
- * ```typescript
- * import { getCurrent } from '@tauri-apps/plugin-window';
- * const position = await getCurrent().innerPosition();
- * ```
- *
- * @returns The window's inner position.
- *
- * @since 2.0.0
- * */
- async innerPosition(): Promise {
- return window
- .__TAURI_INVOKE__<{ x: number; y: number }>(
- "plugin:window|inner_position",
- {
- label: this.label,
- },
- )
- .then(({ x, y }) => new PhysicalPosition(x, y));
- }
-
- /**
- * The position of the top-left hand corner of the window relative to the top-left hand corner of the desktop.
- * @example
- * ```typescript
- * import { getCurrent } from '@tauri-apps/plugin-window';
- * const position = await getCurrent().outerPosition();
- * ```
- *
- * @returns The window's outer position.
- *
- * @since 2.0.0
- * */
- async outerPosition(): Promise {
- return window
- .__TAURI_INVOKE__<{ x: number; y: number }>(
- "plugin:window|outer_position",
- {
- label: this.label,
- },
- )
- .then(({ x, y }) => new PhysicalPosition(x, y));
- }
-
- /**
- * The physical size of the window's client area.
- * The client area is the content of the window, excluding the title bar and borders.
- * @example
- * ```typescript
- * import { getCurrent } from '@tauri-apps/plugin-window';
- * const size = await getCurrent().innerSize();
- * ```
- *
- * @returns The window's inner size.
- *
- * @since 2.0.0
- */
- async innerSize(): Promise {
- return window
- .__TAURI_INVOKE__<{ width: number; height: number }>(
- "plugin:window|inner_size",
- {
- label: this.label,
- },
- )
- .then(({ width, height }) => new PhysicalSize(width, height));
- }
-
- /**
- * The physical size of the entire window.
- * These dimensions include the title bar and borders. If you don't want that (and you usually don't), use inner_size instead.
- * @example
- * ```typescript
- * import { getCurrent } from '@tauri-apps/plugin-window';
- * const size = await getCurrent().outerSize();
- * ```
- *
- * @returns The window's outer size.
- *
- * @since 2.0.0
- */
- async outerSize(): Promise {
- return window
- .__TAURI_INVOKE__<{ width: number; height: number }>(
- "plugin:window|outer_size",
- {
- label: this.label,
- },
- )
- .then(({ width, height }) => new PhysicalSize(width, height));
- }
-
- /**
- * Gets the window's current fullscreen state.
- * @example
- * ```typescript
- * import { getCurrent } from '@tauri-apps/plugin-window';
- * const fullscreen = await getCurrent().isFullscreen();
- * ```
- *
- * @returns Whether the window is in fullscreen mode or not.
- *
- * @since 2.0.0
- * */
- async isFullscreen(): Promise {
- return window.__TAURI_INVOKE__("plugin:window|is_fullscreen", {
- label: this.label,
- });
- }
-
- /**
- * Gets the window's current minimized state.
- * @example
- * ```typescript
- * import { getCurrent } from '@tauri-apps/plugin-window';
- * const minimized = await getCurrent().isMinimized();
- * ```
- *
- * @since 2.0.0
- * */
- async isMinimized(): Promise {
- return window.__TAURI_INVOKE__("plugin:window|is_minimized", {
- label: this.label,
- });
- }
-
- /**
- * Gets the window's current maximized state.
- * @example
- * ```typescript
- * import { getCurrent } from '@tauri-apps/plugin-window';
- * const maximized = await getCurrent().isMaximized();
- * ```
- *
- * @returns Whether the window is maximized or not.
- *
- * @since 2.0.0
- * */
- async isMaximized(): Promise {
- return window.__TAURI_INVOKE__("plugin:window|is_maximized", {
- label: this.label,
- });
- }
-
- /**
- * Gets the window's current focus state.
- * @example
- * ```typescript
- * import { getCurrent } from '@tauri-apps/plugin-window';
- * const focused = await getCurrent().isFocused();
- * ```
- *
- * @returns Whether the window is focused or not.
- *
- * @since 2.0.0
- * */
- async isFocused(): Promise {
- return window.__TAURI_INVOKE__("plugin:window|is_focused", {
- label: this.label,
- });
- }
-
- /**
- * Gets the window's current decorated state.
- * @example
- * ```typescript
- * import { getCurrent } from '@tauri-apps/plugin-window';
- * const decorated = await getCurrent().isDecorated();
- * ```
- *
- * @returns Whether the window is decorated or not.
- *
- * @since 2.0.0
- * */
- async isDecorated(): Promise {
- return window.__TAURI_INVOKE__("plugin:window|is_decorated", {
- label: this.label,
- });
- }
-
- /**
- * Gets the window's current resizable state.
- * @example
- * ```typescript
- * import { getCurrent } from '@tauri-apps/plugin-window';
- * const resizable = await getCurrent().isResizable();
- * ```
- *
- * @returns Whether the window is resizable or not.
- *
- * @since 2.0.0
- * */
- async isResizable(): Promise {
- return window.__TAURI_INVOKE__("plugin:window|is_resizable", {
- label: this.label,
- });
- }
-
- /**
- * Gets the window’s native maximize button state.
- *
- * #### Platform-specific
- *
- * - **Linux / iOS / Android:** Unsupported.
- *
- * @example
- * ```typescript
- * import { getCurrent } from '@tauri-apps/plugin-window';
- * const maximizable = await getCurrent().isMaximizable();
- * ```
- *
- * @returns Whether the window's native maximize button is enabled or not.
- * */
- async isMaximizable(): Promise {
- return window.__TAURI_INVOKE__("plugin:window|is_maximizable", {
- label: this.label,
- });
- }
-
- /**
- * Gets the window’s native minimize button state.
- *
- * #### Platform-specific
- *
- * - **Linux / iOS / Android:** Unsupported.
- *
- * @example
- * ```typescript
- * import { getCurrent } from '@tauri-apps/plugin-window';
- * const minimizable = await getCurrent().isMinimizable();
- * ```
- *
- * @returns Whether the window's native minimize button is enabled or not.
- * */
- async isMinimizable(): Promise {
- return window.__TAURI_INVOKE__("plugin:window|is_minimizable", {
- label: this.label,
- });
- }
-
- /**
- * Gets the window’s native close button state.
- *
- * #### Platform-specific
- *
- * - **iOS / Android:** Unsupported.
- *
- * @example
- * ```typescript
- * import { getCurrent } from '@tauri-apps/plugin-window';
- * const closable = await getCurrent().isClosable();
- * ```
- *
- * @returns Whether the window's native close button is enabled or not.
- * */
- async isClosable(): Promise {
- return window.__TAURI_INVOKE__("plugin:window|is_closable", {
- label: this.label,
- });
- }
-
- /**
- * Gets the window's current visible state.
- * @example
- * ```typescript
- * import { getCurrent } from '@tauri-apps/plugin-window';
- * const visible = await getCurrent().isVisible();
- * ```
- *
- * @returns Whether the window is visible or not.
- *
- * @since 2.0.0
- * */
- async isVisible(): Promise {
- return window.__TAURI_INVOKE__("plugin:window|is_visible", {
- label: this.label,
- });
- }
-
- /**
- * Gets the window's current title.
- * @example
- * ```typescript
- * import { getCurrent } from '@tauri-apps/plugin-window';
- * const title = await getCurrent().title();
- * ```
- *
- * @since 2.0.0
- * */
- async title(): Promise {
- return window.__TAURI_INVOKE__("plugin:window|title", {
- label: this.label,
- });
- }
-
- /**
- * Gets the window's current theme.
- *
- * #### Platform-specific
- *
- * - **macOS:** Theme was introduced on macOS 10.14. Returns `light` on macOS 10.13 and below.
- *
- * @example
- * ```typescript
- * import { getCurrent } from '@tauri-apps/plugin-window';
- * const theme = await getCurrent().theme();
- * ```
- *
- * @returns The window theme.
- *
- * @since 2.0.0
- * */
- async theme(): Promise {
- return window.__TAURI_INVOKE__("plugin:window|theme", {
- label: this.label,
- });
- }
-
- // Setters
-
- /**
- * Centers the window.
- * @example
- * ```typescript
- * import { getCurrent } from '@tauri-apps/plugin-window';
- * await getCurrent().center();
- * ```
- *
- * @param resizable
- * @returns A promise indicating the success or failure of the operation.
- *
- * @since 2.0.0
- */
- async center(): Promise {
- return window.__TAURI_INVOKE__("plugin:window|center", {
- label: this.label,
- });
- }
-
- /**
- * Requests user attention to the window, this has no effect if the application
- * is already focused. How requesting for user attention manifests is platform dependent,
- * see `UserAttentionType` for details.
- *
- * Providing `null` will unset the request for user attention. Unsetting the request for
- * user attention might not be done automatically by the WM when the window receives input.
- *
- * #### Platform-specific
- *
- * - **macOS:** `null` has no effect.
- * - **Linux:** Urgency levels have the same effect.
- * @example
- * ```typescript
- * import { getCurrent } from '@tauri-apps/plugin-window';
- * await getCurrent().requestUserAttention();
- * ```
- *
- * @param requestType
- * @returns A promise indicating the success or failure of the operation.
- *
- * @since 2.0.0
- */
- async requestUserAttention(
- requestType: UserAttentionType | null,
- ): Promise {
- let requestType_ = null;
- if (requestType) {
- if (requestType === UserAttentionType.Critical) {
- requestType_ = { type: "Critical" };
- } else {
- requestType_ = { type: "Informational" };
- }
- }
-
- return window.__TAURI_INVOKE__("plugin:window|request_user_attention", {
- label: this.label,
- value: requestType_,
- });
- }
-
- /**
- * Updates the window resizable flag.
- * @example
- * ```typescript
- * import { getCurrent } from '@tauri-apps/plugin-window';
- * await getCurrent().setResizable(false);
- * ```
- *
- * @param resizable
- * @returns A promise indicating the success or failure of the operation.
- *
- * @since 2.0.0
- */
- async setResizable(resizable: boolean): Promise {
- return window.__TAURI_INVOKE__("plugin:window|set_resizable", {
- label: this.label,
- value: resizable,
- });
- }
-
- /**
- * Sets whether the window's native maximize button is enabled or not.
- * If resizable is set to false, this setting is ignored.
- *
- * #### Platform-specific
- *
- * - **macOS:** Disables the "zoom" button in the window titlebar, which is also used to enter fullscreen mode.
- * - **Linux / iOS / Android:** Unsupported.
- *
- * @example
- * ```typescript
- * import { getCurrent } from '@tauri-apps/plugin-window';
- * await getCurrent().setMaximizable(false);
- * ```
- *
- * @param maximizable
- * @returns A promise indicating the success or failure of the operation.
- */
- async setMaximizable(maximizable: boolean): Promise {
- return window.__TAURI_INVOKE__("plugin:window|set_maximizable", {
- label: this.label,
- value: maximizable,
- });
- }
-
- /**
- * Sets whether the window's native minimize button is enabled or not.
- *
- * #### Platform-specific
- *
- * - **Linux / iOS / Android:** Unsupported.
- *
- * @example
- * ```typescript
- * import { getCurrent } from '@tauri-apps/plugin-window';
- * await getCurrent().setMinimizable(false);
- * ```
- *
- * @param minimizable
- * @returns A promise indicating the success or failure of the operation.
- */
- async setMinimizable(minimizable: boolean): Promise {
- return window.__TAURI_INVOKE__("plugin:window|set_minimizable", {
- label: this.label,
- value: minimizable,
- });
- }
-
- /**
- * Sets whether the window's native close button is enabled or not.
- *
- * #### Platform-specific
- *
- * - **Linux:** GTK+ will do its best to convince the window manager not to show a close button. Depending on the system, this function may not have any effect when called on a window that is already visible
- * - **iOS / Android:** Unsupported.
- *
- * @example
- * ```typescript
- * import { getCurrent } from '@tauri-apps/plugin-window';
- * await getCurrent().setClosable(false);
- * ```
- *
- * @param closable
- * @returns A promise indicating the success or failure of the operation.
- */
- async setClosable(closable: boolean): Promise {
- return window.__TAURI_INVOKE__("plugin:window|set_closable", {
- label: this.label,
- value: closable,
- });
- }
-
- /**
- * Sets the window title.
- * @example
- * ```typescript
- * import { getCurrent } from '@tauri-apps/plugin-window';
- * await getCurrent().setTitle('Tauri');
- * ```
- *
- * @param title The new title
- * @returns A promise indicating the success or failure of the operation.
- *
- * @since 2.0.0
- */
- async setTitle(title: string): Promise {
- return window.__TAURI_INVOKE__("plugin:window|set_title", {
- label: this.label,
- value: title,
- });
- }
-
- /**
- * Maximizes the window.
- * @example
- * ```typescript
- * import { getCurrent } from '@tauri-apps/plugin-window';
- * await getCurrent().maximize();
- * ```
- *
- * @returns A promise indicating the success or failure of the operation.
- *
- * @since 2.0.0
- */
- async maximize(): Promise {
- return window.__TAURI_INVOKE__("plugin:window|maximize", {
- label: this.label,
- });
- }
-
- /**
- * Unmaximizes the window.
- * @example
- * ```typescript
- * import { getCurrent } from '@tauri-apps/plugin-window';
- * await getCurrent().unmaximize();
- * ```
- *
- * @returns A promise indicating the success or failure of the operation.
- *
- * @since 2.0.0
- */
- async unmaximize(): Promise {
- return window.__TAURI_INVOKE__("plugin:window|unmaximize", {
- label: this.label,
- });
- }
-
- /**
- * Toggles the window maximized state.
- * @example
- * ```typescript
- * import { getCurrent } from '@tauri-apps/plugin-window';
- * await getCurrent().toggleMaximize();
- * ```
- *
- * @returns A promise indicating the success or failure of the operation.
- *
- * @since 2.0.0
- */
- async toggleMaximize(): Promise {
- return window.__TAURI_INVOKE__("plugin:window|toggle_maximize", {
- label: this.label,
- });
- }
-
- /**
- * Minimizes the window.
- * @example
- * ```typescript
- * import { getCurrent } from '@tauri-apps/plugin-window';
- * await getCurrent().minimize();
- * ```
- *
- * @returns A promise indicating the success or failure of the operation.
- *
- * @since 2.0.0
- */
- async minimize(): Promise {
- return window.__TAURI_INVOKE__("plugin:window|minimize", {
- label: this.label,
- });
- }
-
- /**
- * Unminimizes the window.
- * @example
- * ```typescript
- * import { getCurrent } from '@tauri-apps/plugin-window';
- * await getCurrent().unminimize();
- * ```
- *
- * @returns A promise indicating the success or failure of the operation.
- *
- * @since 2.0.0
- */
- async unminimize(): Promise {
- return window.__TAURI_INVOKE__("plugin:window|unminimize", {
- label: this.label,
- });
- }
-
- /**
- * Sets the window visibility to true.
- * @example
- * ```typescript
- * import { getCurrent } from '@tauri-apps/plugin-window';
- * await getCurrent().show();
- * ```
- *
- * @returns A promise indicating the success or failure of the operation.
- *
- * @since 2.0.0
- */
- async show(): Promise {
- return window.__TAURI_INVOKE__("plugin:window|show", {
- label: this.label,
- });
- }
-
- /**
- * Sets the window visibility to false.
- * @example
- * ```typescript
- * import { getCurrent } from '@tauri-apps/plugin-window';
- * await getCurrent().hide();
- * ```
- *
- * @returns A promise indicating the success or failure of the operation.
- *
- * @since 2.0.0
- */
- async hide(): Promise {
- return window.__TAURI_INVOKE__("plugin:window|hide", {
- label: this.label,
- });
- }
-
- /**
- * Closes the window.
- * @example
- * ```typescript
- * import { getCurrent } from '@tauri-apps/plugin-window';
- * await getCurrent().close();
- * ```
- *
- * @returns A promise indicating the success or failure of the operation.
- *
- * @since 2.0.0
- */
- async close(): Promise {
- return window.__TAURI_INVOKE__("plugin:window|close", {
- label: this.label,
- });
- }
-
- /**
- * Whether the window should have borders and bars.
- * @example
- * ```typescript
- * import { getCurrent } from '@tauri-apps/plugin-window';
- * await getCurrent().setDecorations(false);
- * ```
- *
- * @param decorations Whether the window should have borders and bars.
- * @returns A promise indicating the success or failure of the operation.
- *
- * @since 2.0.0
- */
- async setDecorations(decorations: boolean): Promise {
- return window.__TAURI_INVOKE__("plugin:window|set_decorations", {
- label: this.label,
- value: decorations,
- });
- }
-
- /**
- * Whether or not the window should have shadow.
- *
- * #### Platform-specific
- *
- * - **Windows:**
- * - `false` has no effect on decorated window, shadows are always ON.
- * - `true` will make ndecorated window have a 1px white border,
- * and on Windows 11, it will have a rounded corners.
- * - **Linux:** Unsupported.
- *
- * @example
- * ```typescript
- * import { getCurrent } from '@tauri-apps/plugin-window';
- * await getCurrent().setShadow(false);
- * ```
- *
- * @returns A promise indicating the success or failure of the operation.
- *
- * @since 2.0.0
- */
- async setShadow(enable: boolean): Promise {
- return window.__TAURI_INVOKE__("plugin:window|set_shadow", {
- label: this.label,
- value: enable,
- });
- }
-
- /**
- * Set window effects.
- *
- * @since 2.0
- */
- async setEffects(effects: Effects): Promise {
- return window.__TAURI_INVOKE__("plugin:window|set_effects", {
- label: this.label,
- value: effects,
- });
- }
-
- /**
- * Clear any applied effects if possible.
- *
- * @since 2.0
- */
- async clearEffects(): Promise {
- return window.__TAURI_INVOKE__("plugin:window|set_effects", {
- label: this.label,
- value: null,
- });
- }
-
- /**
- * Whether the window should always be on top of other windows.
- * @example
- * ```typescript
- * import { getCurrent } from '@tauri-apps/plugin-window';
- * await getCurrent().setAlwaysOnTop(true);
- * ```
- *
- * @param alwaysOnTop Whether the window should always be on top of other windows or not.
- * @returns A promise indicating the success or failure of the operation.
- *
- * @since 2.0.0
- */
- async setAlwaysOnTop(alwaysOnTop: boolean): Promise {
- return window.__TAURI_INVOKE__("plugin:window|set_always_on_top", {
- label: this.label,
- value: alwaysOnTop,
- });
- }
-
- /**
- * Prevents the window contents from being captured by other apps.
- * @example
- * ```typescript
- * import { getCurrent } from '@tauri-apps/plugin-window';
- * await getCurrent().setContentProtected(true);
- * ```
- *
- * @returns A promise indicating the success or failure of the operation.
- *
- * @since 2.0.0
- */
- async setContentProtected(protected_: boolean): Promise {
- return window.__TAURI_INVOKE__("plugin:window|set_content_protected", {
- label: this.label,
- value: protected_,
- });
- }
-
- /**
- * Resizes the window with a new inner size.
- * @example
- * ```typescript
- * import { getCurrent, LogicalSize } from '@tauri-apps/plugin-window';
- * await getCurrent().setSize(new LogicalSize(600, 500));
- * ```
- *
- * @param size The logical or physical inner size.
- * @returns A promise indicating the success or failure of the operation.
- *
- * @since 2.0.0
- */
- async setSize(size: LogicalSize | PhysicalSize): Promise {
- if (!size || (size.type !== "Logical" && size.type !== "Physical")) {
- throw new Error(
- "the `size` argument must be either a LogicalSize or a PhysicalSize instance",
- );
- }
-
- return window.__TAURI_INVOKE__("plugin:window|set_size", {
- label: this.label,
- value: {
- type: size.type,
- data: {
- width: size.width,
- height: size.height,
- },
- },
- });
- }
-
- /**
- * Sets the window minimum inner size. If the `size` argument is not provided, the constraint is unset.
- * @example
- * ```typescript
- * import { getCurrent, PhysicalSize } from '@tauri-apps/plugin-window';
- * await getCurrent().setMinSize(new PhysicalSize(600, 500));
- * ```
- *
- * @param size The logical or physical inner size, or `null` to unset the constraint.
- * @returns A promise indicating the success or failure of the operation.
- *
- * @since 2.0.0
- */
- async setMinSize(
- size: LogicalSize | PhysicalSize | null | undefined,
- ): Promise {
- if (size && size.type !== "Logical" && size.type !== "Physical") {
- throw new Error(
- "the `size` argument must be either a LogicalSize or a PhysicalSize instance",
- );
- }
-
- return window.__TAURI_INVOKE__("plugin:window|set_min_size", {
- label: this.label,
- value: size
- ? {
- type: size.type,
- data: {
- width: size.width,
- height: size.height,
- },
- }
- : null,
- });
- }
-
- /**
- * Sets the window maximum inner size. If the `size` argument is undefined, the constraint is unset.
- * @example
- * ```typescript
- * import { getCurrent, LogicalSize } from '@tauri-apps/plugin-window';
- * await getCurrent().setMaxSize(new LogicalSize(600, 500));
- * ```
- *
- * @param size The logical or physical inner size, or `null` to unset the constraint.
- * @returns A promise indicating the success or failure of the operation.
- *
- * @since 2.0.0
- */
- async setMaxSize(
- size: LogicalSize | PhysicalSize | null | undefined,
- ): Promise {
- if (size && size.type !== "Logical" && size.type !== "Physical") {
- throw new Error(
- "the `size` argument must be either a LogicalSize or a PhysicalSize instance",
- );
- }
-
- return window.__TAURI_INVOKE__("plugin:window|set_max_size", {
- label: this.label,
- value: size
- ? {
- type: size.type,
- data: {
- width: size.width,
- height: size.height,
- },
- }
- : null,
- });
- }
-
- /**
- * Sets the window outer position.
- * @example
- * ```typescript
- * import { getCurrent, LogicalPosition } from '@tauri-apps/plugin-window';
- * await getCurrent().setPosition(new LogicalPosition(600, 500));
- * ```
- *
- * @param position The new position, in logical or physical pixels.
- * @returns A promise indicating the success or failure of the operation.
- *
- * @since 2.0.0
- */
- async setPosition(
- position: LogicalPosition | PhysicalPosition,
- ): Promise {
- if (
- !position ||
- (position.type !== "Logical" && position.type !== "Physical")
- ) {
- throw new Error(
- "the `position` argument must be either a LogicalPosition or a PhysicalPosition instance",
- );
- }
-
- return window.__TAURI_INVOKE__("plugin:window|set_position", {
- label: this.label,
- value: {
- type: position.type,
- data: {
- x: position.x,
- y: position.y,
- },
- },
- });
- }
-
- /**
- * Sets the window fullscreen state.
- * @example
- * ```typescript
- * import { getCurrent } from '@tauri-apps/plugin-window';
- * await getCurrent().setFullscreen(true);
- * ```
- *
- * @param fullscreen Whether the window should go to fullscreen or not.
- * @returns A promise indicating the success or failure of the operation.
- *
- * @since 2.0.0
- */
- async setFullscreen(fullscreen: boolean): Promise {
- return window.__TAURI_INVOKE__("plugin:window|set_fullscreen", {
- label: this.label,
- value: fullscreen,
- });
- }
-
- /**
- * Bring the window to front and focus.
- * @example
- * ```typescript
- * import { getCurrent } from '@tauri-apps/plugin-window';
- * await getCurrent().setFocus();
- * ```
- *
- * @returns A promise indicating the success or failure of the operation.
- *
- * @since 2.0.0
- */
- async setFocus(): Promise {
- return window.__TAURI_INVOKE__("plugin:window|set_focus", {
- label: this.label,
- });
- }
-
- /**
- * Sets the window icon.
- * @example
- * ```typescript
- * import { getCurrent } from '@tauri-apps/plugin-window';
- * await getCurrent().setIcon('/tauri/awesome.png');
- * ```
- *
- * Note that you need the `icon-ico` or `icon-png` Cargo features to use this API.
- * To enable it, change your Cargo.toml file:
- * ```toml
- * [dependencies]
- * tauri = { version = "...", features = ["...", "icon-png"] }
- * ```
- *
- * @param icon Icon bytes or path to the icon file.
- * @returns A promise indicating the success or failure of the operation.
- *
- * @since 2.0.0
- */
- async setIcon(icon: string | Uint8Array): Promise {
- return window.__TAURI_INVOKE__("plugin:window|set_icon", {
- label: this.label,
- value: typeof icon === "string" ? icon : Array.from(icon),
- });
- }
-
- /**
- * Whether the window icon should be hidden from the taskbar or not.
- *
- * #### Platform-specific
- *
- * - **macOS:** Unsupported.
- * @example
- * ```typescript
- * import { getCurrent } from '@tauri-apps/plugin-window';
- * await getCurrent().setSkipTaskbar(true);
- * ```
- *
- * @param skip true to hide window icon, false to show it.
- * @returns A promise indicating the success or failure of the operation.
- *
- * @since 2.0.0
- */
- async setSkipTaskbar(skip: boolean): Promise {
- return window.__TAURI_INVOKE__("plugin:window|set_skip_taskbar", {
- label: this.label,
- value: skip,
- });
- }
-
- /**
- * Grabs the cursor, preventing it from leaving the window.
- *
- * There's no guarantee that the cursor will be hidden. You should
- * hide it by yourself if you want so.
- *
- * #### Platform-specific
- *
- * - **Linux:** Unsupported.
- * - **macOS:** This locks the cursor in a fixed location, which looks visually awkward.
- * @example
- * ```typescript
- * import { getCurrent } from '@tauri-apps/plugin-window';
- * await getCurrent().setCursorGrab(true);
- * ```
- *
- * @param grab `true` to grab the cursor icon, `false` to release it.
- * @returns A promise indicating the success or failure of the operation.
- *
- * @since 2.0.0
- */
- async setCursorGrab(grab: boolean): Promise {
- return window.__TAURI_INVOKE__("plugin:window|set_cursor_grab", {
- label: this.label,
- value: grab,
- });
- }
-
- /**
- * Modifies the cursor's visibility.
- *
- * #### Platform-specific
- *
- * - **Windows:** The cursor is only hidden within the confines of the window.
- * - **macOS:** The cursor is hidden as long as the window has input focus, even if the cursor is
- * outside of the window.
- * @example
- * ```typescript
- * import { getCurrent } from '@tauri-apps/plugin-window';
- * await getCurrent().setCursorVisible(false);
- * ```
- *
- * @param visible If `false`, this will hide the cursor. If `true`, this will show the cursor.
- * @returns A promise indicating the success or failure of the operation.
- *
- * @since 2.0.0
- */
- async setCursorVisible(visible: boolean): Promise {
- return window.__TAURI_INVOKE__("plugin:window|set_cursor_visible", {
- label: this.label,
- value: visible,
- });
- }
-
- /**
- * Modifies the cursor icon of the window.
- * @example
- * ```typescript
- * import { getCurrent } from '@tauri-apps/plugin-window';
- * await getCurrent().setCursorIcon('help');
- * ```
- *
- * @param icon The new cursor icon.
- * @returns A promise indicating the success or failure of the operation.
- *
- * @since 2.0.0
- */
- async setCursorIcon(icon: CursorIcon): Promise {
- return window.__TAURI_INVOKE__("plugin:window|set_cursor_icon", {
- label: this.label,
- value: icon,
- });
- }
-
- /**
- * Changes the position of the cursor in window coordinates.
- * @example
- * ```typescript
- * import { getCurrent, LogicalPosition } from '@tauri-apps/plugin-window';
- * await getCurrent().setCursorPosition(new LogicalPosition(600, 300));
- * ```
- *
- * @param position The new cursor position.
- * @returns A promise indicating the success or failure of the operation.
- *
- * @since 2.0.0
- */
- async setCursorPosition(
- position: LogicalPosition | PhysicalPosition,
- ): Promise {
- if (
- !position ||
- (position.type !== "Logical" && position.type !== "Physical")
- ) {
- throw new Error(
- "the `position` argument must be either a LogicalPosition or a PhysicalPosition instance",
- );
- }
-
- return window.__TAURI_INVOKE__("plugin:window|set_cursor_position", {
- label: this.label,
- value: {
- type: position.type,
- data: {
- x: position.x,
- y: position.y,
- },
- },
- });
- }
-
- /**
- * Changes the cursor events behavior.
- *
- * @example
- * ```typescript
- * import { getCurrent } from '@tauri-apps/plugin-window';
- * await getCurrent().setIgnoreCursorEvents(true);
- * ```
- *
- * @param ignore `true` to ignore the cursor events; `false` to process them as usual.
- * @returns A promise indicating the success or failure of the operation.
- *
- * @since 2.0.0
- */
- async setIgnoreCursorEvents(ignore: boolean): Promise {
- return window.__TAURI_INVOKE__("plugin:window|set_ignore_cursor_events", {
- label: this.label,
- value: ignore,
- });
- }
-
- /**
- * Starts dragging the window.
- * @example
- * ```typescript
- * import { getCurrent } from '@tauri-apps/plugin-window';
- * await getCurrent().startDragging();
- * ```
- *
- * @return A promise indicating the success or failure of the operation.
- *
- * @since 2.0.0
- */
- async startDragging(): Promise {
- return window.__TAURI_INVOKE__("plugin:window|start_dragging", {
- label: this.label,
- });
- }
-
- // Listeners
-
- /**
- * Listen to window resize.
- *
- * @example
- * ```typescript
- * import { getCurrent } from "@tauri-apps/plugin-window";
- * const unlisten = await getCurrent().onResized(({ payload: size }) => {
- * console.log('Window resized', size);
- * });
- *
- * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted
- * unlisten();
- * ```
- *
- * @returns A promise resolving to a function to unlisten to the event.
- * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
- *
- * @since 2.0.0
- */
- async onResized(handler: EventCallback): Promise {
- return this.listen(TauriEvent.WINDOW_RESIZED, (e) => {
- e.payload = mapPhysicalSize(e.payload);
- handler(e);
- });
- }
-
- /**
- * Listen to window move.
- *
- * @example
- * ```typescript
- * import { getCurrent } from "@tauri-apps/plugin-window";
- * const unlisten = await getCurrent().onMoved(({ payload: position }) => {
- * console.log('Window moved', position);
- * });
- *
- * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted
- * unlisten();
- * ```
- *
- * @returns A promise resolving to a function to unlisten to the event.
- * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
- *
- * @since 2.0.0
- */
- async onMoved(handler: EventCallback): Promise {
- return this.listen(TauriEvent.WINDOW_MOVED, (e) => {
- e.payload = mapPhysicalPosition(e.payload);
- handler(e);
- });
- }
-
- /**
- * Listen to window close requested. Emitted when the user requests to closes the window.
- *
- * @example
- * ```typescript
- * import { getCurrent } from "@tauri-apps/plugin-window";
- * import { confirm } from '@tauri-apps/api/dialog';
- * const unlisten = await getCurrent().onCloseRequested(async (event) => {
- * const confirmed = await confirm('Are you sure?');
- * if (!confirmed) {
- * // user did not confirm closing the window; let's prevent it
- * event.preventDefault();
- * }
- * });
- *
- * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted
- * unlisten();
- * ```
- *
- * @returns A promise resolving to a function to unlisten to the event.
- * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
- *
- * @since 2.0.0
- */
- /* eslint-disable @typescript-eslint/promise-function-async */
- async onCloseRequested(
- handler: (event: CloseRequestedEvent) => void | Promise,
- ): Promise {
- return this.listen(TauriEvent.WINDOW_CLOSE_REQUESTED, (event) => {
- const evt = new CloseRequestedEvent(event);
- void Promise.resolve(handler(evt)).then(() => {
- if (!evt.isPreventDefault()) {
- return this.close();
- }
- });
- });
- }
- /* eslint-enable */
-
- /**
- * Listen to window focus change.
- *
- * @example
- * ```typescript
- * import { getCurrent } from "@tauri-apps/plugin-window";
- * const unlisten = await getCurrent().onFocusChanged(({ payload: focused }) => {
- * console.log('Focus changed, window is focused? ' + focused);
- * });
- *
- * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted
- * unlisten();
- * ```
- *
- * @returns A promise resolving to a function to unlisten to the event.
- * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
- *
- * @since 2.0.0
- */
- async onFocusChanged(handler: EventCallback): Promise {
- const unlistenFocus = await this.listen(
- TauriEvent.WINDOW_FOCUS,
- (event) => {
- handler({ ...event, payload: true });
- },
- );
- const unlistenBlur = await this.listen(
- TauriEvent.WINDOW_BLUR,
- (event) => {
- handler({ ...event, payload: false });
- },
- );
- return () => {
- unlistenFocus();
- unlistenBlur();
- };
- }
-
- /**
- * Listen to window scale change. Emitted when the window's scale factor has changed.
- * The following user actions can cause DPI changes:
- * - Changing the display's resolution.
- * - Changing the display's scale factor (e.g. in Control Panel on Windows).
- * - Moving the window to a display with a different scale factor.
- *
- * @example
- * ```typescript
- * import { getCurrent } from "@tauri-apps/plugin-window";
- * const unlisten = await getCurrent().onScaleChanged(({ payload }) => {
- * console.log('Scale changed', payload.scaleFactor, payload.size);
- * });
- *
- * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted
- * unlisten();
- * ```
- *
- * @returns A promise resolving to a function to unlisten to the event.
- * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
- *
- * @since 2.0.0
- */
- async onScaleChanged(
- handler: EventCallback,
- ): Promise {
- return this.listen(
- TauriEvent.WINDOW_SCALE_FACTOR_CHANGED,
- handler,
- );
- }
-
- /**
- * Listen to the window menu item click. The payload is the item id.
- *
- * @example
- * ```typescript
- * import { getCurrent } from "@tauri-apps/plugin-window";
- * const unlisten = await getCurrent().onMenuClicked(({ payload: menuId }) => {
- * console.log('Menu clicked: ' + menuId);
- * });
- *
- * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted
- * unlisten();
- * ```
- *
- * @returns A promise resolving to a function to unlisten to the event.
- * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
- *
- * @since 2.0.0
- */
- async onMenuClicked(handler: EventCallback): Promise {
- return this.listen(TauriEvent.MENU, handler);
- }
-
- /**
- * Listen to a file drop event.
- * The listener is triggered when the user hovers the selected files on the window,
- * drops the files or cancels the operation.
- *
- * @example
- * ```typescript
- * import { getCurrent } from "@tauri-apps/plugin-window";
- * const unlisten = await getCurrent().onFileDropEvent((event) => {
- * if (event.payload.type === 'hover') {
- * console.log('User hovering', event.payload.paths);
- * } else if (event.payload.type === 'drop') {
- * console.log('User dropped', event.payload.paths);
- * } else {
- * console.log('File drop cancelled');
- * }
- * });
- *
- * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted
- * unlisten();
- * ```
- *
- * @returns A promise resolving to a function to unlisten to the event.
- * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
- *
- * @since 2.0.0
- */
- async onFileDropEvent(
- handler: EventCallback,
- ): Promise {
- const unlistenFileDrop = await this.listen(
- TauriEvent.WINDOW_FILE_DROP,
- (event) => {
- handler({ ...event, payload: { type: "drop", paths: event.payload } });
- },
- );
-
- const unlistenFileHover = await this.listen(
- TauriEvent.WINDOW_FILE_DROP_HOVER,
- (event) => {
- handler({ ...event, payload: { type: "hover", paths: event.payload } });
- },
- );
-
- const unlistenCancel = await this.listen(
- TauriEvent.WINDOW_FILE_DROP_CANCELLED,
- (event) => {
- handler({ ...event, payload: { type: "cancel" } });
- },
- );
-
- return () => {
- unlistenFileDrop();
- unlistenFileHover();
- unlistenCancel();
- };
- }
-
- /**
- * Listen to the system theme change.
- *
- * @example
- * ```typescript
- * import { getCurrent } from "@tauri-apps/plugin-window";
- * const unlisten = await getCurrent().onThemeChanged(({ payload: theme }) => {
- * console.log('New theme: ' + theme);
- * });
- *
- * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted
- * unlisten();
- * ```
- *
- * @returns A promise resolving to a function to unlisten to the event.
- * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
- *
- * @since 2.0.0
- */
- async onThemeChanged(handler: EventCallback): Promise {
- return this.listen(TauriEvent.WINDOW_THEME_CHANGED, handler);
- }
-}
-
-/**
- * an array RGBA colors. Each value has minimum of 0 and maximum of 255.
- *
- * @since 2.0
- */
-type Color = [number, number, number, number];
-
-/**
- * Platform-specific window effects
- *
- * @since 2.0
- */
-enum Effect {
- /**
- * A default material appropriate for the view's effectiveAppearance. **macOS 10.14-**
- *
- * @deprecated since macOS 10.14. You should instead choose an appropriate semantic material.
- */
- AppearanceBased = "appearanceBased",
- /**
- * **macOS 10.14-**
- *
- * @deprecated since macOS 10.14. Use a semantic material instead.
- */
- Light = "light",
- /**
- * **macOS 10.14-**
- *
- * @deprecated since macOS 10.14. Use a semantic material instead.
- */
- Dark = "dark",
- /**
- * **macOS 10.14-**
- *
- * @deprecated since macOS 10.14. Use a semantic material instead.
- */
- MediumLight = "mediumLight",
- /**
- * **macOS 10.14-**
- *
- * @deprecated since macOS 10.14. Use a semantic material instead.
- */
- UltraDark = "ultraDark",
- /**
- * **macOS 10.10+**
- */
- Titlebar = "titlebar",
- /**
- * **macOS 10.10+**
- */
- Selection = "selection",
- /**
- * **macOS 10.11+**
- */
- Menu = "menu",
- /**
- * **macOS 10.11+**
- */
- Popover = "popover",
- /**
- * **macOS 10.11+**
- */
- Sidebar = "sidebar",
- /**
- * **macOS 10.14+**
- */
- HeaderView = "headerView",
- /**
- * **macOS 10.14+**
- */
- Sheet = "sheet",
- /**
- * **macOS 10.14+**
- */
- WindowBackground = "windowBackground",
- /**
- * **macOS 10.14+**
- */
- HudWindow = "hudWindow",
- /**
- * **macOS 10.14+**
- */
- FullScreenUI = "fullScreenUI",
- /**
- * **macOS 10.14+**
- */
- Tooltip = "tooltip",
- /**
- * **macOS 10.14+**
- */
- ContentBackground = "contentBackground",
- /**
- * **macOS 10.14+**
- */
- UnderWindowBackground = "underWindowBackground",
- /**
- * **macOS 10.14+**
- */
- UnderPageBackground = "underPageBackground",
- /**
- * **Windows 11 Only**
- */
- Mica = "mica",
- /**
- * **Windows 7/10/11(22H1) Only**
- *
- * ## Notes
- *
- * This effect has bad performance when resizing/dragging the window on Windows 11 build 22621.
- */
- Blur = "blur",
- /**
- * **Windows 10/11**
- *
- * ## Notes
- *
- * This effect has bad performance when resizing/dragging the window on Windows 10 v1903+ and Windows 11 build 22000.
- */
- Acrylic = "acrylic",
-}
-
-/**
- * Window effect state **macOS only**
- *
- * @see https://developer.apple.com/documentation/appkit/nsvisualeffectview/state
- *
- * @since 2.0
- */
-enum EffectState {
- /**
- * Make window effect state follow the window's active state **macOS only**
- */
- FollowsWindowActiveState = "followsWindowActiveState",
- /**
- * Make window effect state always active **macOS only**
- */
- Active = "active",
- /**
- * Make window effect state always inactive **macOS only**
- */
- Inactive = "inactive",
-}
-
-/** The window effects configuration object
- *
- * @since 2.0
- */
-interface Effects {
- /**
- * List of Window effects to apply to the Window.
- * Conflicting effects will apply the first one and ignore the rest.
- */
- effects: Effect[];
- /**
- * Window effect state **macOS Only**
- */
- state?: EffectState;
- /**
- * Window effect corner radius **macOS Only**
- */
- radius?: number;
- /**
- * Window effect color. Affects {@link Effects.Blur} and {@link Effects.Acrylic} only
- * on Windows 10 v1903+. Doesn't have any effect on Windows 7 or Windows 11.
- */
- color?: Color;
-}
-
-/**
- * Configuration for the window to create.
- *
- * @since 2.0.0
- */
-interface WindowOptions {
- /**
- * Remote URL or local file path to open.
- *
- * - URL such as `https://github.com/tauri-apps` is opened directly on a Tauri window.
- * - data: URL such as `data:text/html,...` is only supported with the `window-data-url` Cargo feature for the `tauri` dependency.
- * - local file path or route such as `/path/to/page.html` or `/users` is appended to the application URL (the devServer URL on development, or `tauri://localhost/` and `https://tauri.localhost/` on production).
- */
- url?: string;
- /** Show window in the center of the screen.. */
- center?: boolean;
- /** The initial vertical position. Only applies if `y` is also set. */
- x?: number;
- /** The initial horizontal position. Only applies if `x` is also set. */
- y?: number;
- /** The initial width. */
- width?: number;
- /** The initial height. */
- height?: number;
- /** The minimum width. Only applies if `minHeight` is also set. */
- minWidth?: number;
- /** The minimum height. Only applies if `minWidth` is also set. */
- minHeight?: number;
- /** The maximum width. Only applies if `maxHeight` is also set. */
- maxWidth?: number;
- /** The maximum height. Only applies if `maxWidth` is also set. */
- maxHeight?: number;
- /** Whether the window is resizable or not. */
- resizable?: boolean;
- /** Window title. */
- title?: string;
- /** Whether the window is in fullscreen mode or not. */
- fullscreen?: boolean;
- /** Whether the window will be initially focused or not. */
- focus?: boolean;
- /**
- * Whether the window is transparent or not.
- * Note that on `macOS` this requires the `macos-private-api` feature flag, enabled under `tauri.conf.json > tauri > macOSPrivateApi`.
- * WARNING: Using private APIs on `macOS` prevents your application from being accepted to the `App Store`.
- */
- transparent?: boolean;
- /** Whether the window should be maximized upon creation or not. */
- maximized?: boolean;
- /** Whether the window should be immediately visible upon creation or not. */
- visible?: boolean;
- /** Whether the window should have borders and bars or not. */
- decorations?: boolean;
- /** Whether the window should always be on top of other windows or not. */
- alwaysOnTop?: boolean;
- /** Prevents the window contents from being captured by other apps. */
- contentProtected?: boolean;
- /** Whether or not the window icon should be added to the taskbar. */
- skipTaskbar?: boolean;
- /**
- * Whether or not the window has shadow.
- *
- * #### Platform-specific
- *
- * - **Windows:**
- * - `false` has no effect on decorated window, shadows are always ON.
- * - `true` will make ndecorated window have a 1px white border,
- * and on Windows 11, it will have a rounded corners.
- * - **Linux:** Unsupported.
- *
- * @since 2.0.0
- */
- shadow?: boolean;
- /**
- * Whether the file drop is enabled or not on the webview. By default it is enabled.
- *
- * Disabling it is required to use drag and drop on the frontend on Windows.
- */
- fileDropEnabled?: boolean;
- /**
- * The initial window theme. Defaults to the system theme.
- *
- * Only implemented on Windows and macOS 10.14+.
- */
- theme?: Theme;
- /**
- * The style of the macOS title bar.
- */
- titleBarStyle?: TitleBarStyle;
- /**
- * If `true`, sets the window title to be hidden on macOS.
- */
- hiddenTitle?: boolean;
- /**
- * Whether clicking an inactive window also clicks through to the webview on macOS.
- */
- acceptFirstMouse?: boolean;
- /**
- * Defines the window [tabbing identifier](https://developer.apple.com/documentation/appkit/nswindow/1644704-tabbingidentifier) on macOS.
- *
- * Windows with the same tabbing identifier will be grouped together.
- * If the tabbing identifier is not set, automatic tabbing will be disabled.
- */
- tabbingIdentifier?: string;
- /**
- * The user agent for the webview.
- */
- userAgent?: string;
- /**
- * Whether or not the webview should be launched in incognito mode.
- *
- * #### Platform-specific
- *
- * - **Android:** Unsupported.
- */
- incognito?: boolean;
- /**
- * Whether the window's native maximize button is enabled or not. Defaults to `true`.
- */
- maximizable?: boolean;
- /**
- * Whether the window's native minimize button is enabled or not. Defaults to `true`.
- */
- minimizable?: boolean;
- /**
- * Whether the window's native close button is enabled or not. Defaults to `true`.
- */
- closable?: boolean;
-}
-
-function mapMonitor(m: Monitor | null): Monitor | null {
- return m === null
- ? null
- : {
- name: m.name,
- scaleFactor: m.scaleFactor,
- position: mapPhysicalPosition(m.position),
- size: mapPhysicalSize(m.size),
- };
-}
-
-function mapPhysicalPosition(m: PhysicalPosition): PhysicalPosition {
- return new PhysicalPosition(m.x, m.y);
-}
-
-function mapPhysicalSize(m: PhysicalSize): PhysicalSize {
- return new PhysicalSize(m.width, m.height);
-}
-
-/**
- * Returns the monitor on which the window currently resides.
- * Returns `null` if current monitor can't be detected.
- * @example
- * ```typescript
- * import { currentMonitor } from '@tauri-apps/plugin-window';
- * const monitor = currentMonitor();
- * ```
- *
- * @since 2.0.0
- */
-async function currentMonitor(): Promise {
- return window
- .__TAURI_INVOKE__("plugin:window|current_monitor")
- .then(mapMonitor);
-}
-
-/**
- * Returns the primary monitor of the system.
- * Returns `null` if it can't identify any monitor as a primary one.
- * @example
- * ```typescript
- * import { primaryMonitor } from '@tauri-apps/plugin-window';
- * const monitor = primaryMonitor();
- * ```
- *
- * @since 2.0.0
- */
-async function primaryMonitor(): Promise {
- return window
- .__TAURI_INVOKE__("plugin:window|primary_monitor")
- .then(mapMonitor);
-}
-
-/**
- * Returns the list of all the monitors available on the system.
- * @example
- * ```typescript
- * import { availableMonitors } from '@tauri-apps/plugin-window';
- * const monitors = availableMonitors();
- * ```
- *
- * @since 2.0.0
- */
-async function availableMonitors(): Promise {
- return window
- .__TAURI_INVOKE__("plugin:window|available_monitors")
- .then((ms) => ms.map(mapMonitor) as Monitor[]);
-}
-
-export {
- Window,
- CloseRequestedEvent,
- getCurrent,
- getAll,
- LogicalSize,
- PhysicalSize,
- LogicalPosition,
- PhysicalPosition,
- UserAttentionType,
- Effect,
- EffectState,
- currentMonitor,
- primaryMonitor,
- availableMonitors,
-};
-
-export type {
- Theme,
- TitleBarStyle,
- Monitor,
- ScaleFactorChanged,
- FileDropEvent,
- WindowOptions,
- Color,
-};
diff --git a/plugins/window/package.json b/plugins/window/package.json
deleted file mode 100644
index 576cc49f..00000000
--- a/plugins/window/package.json
+++ /dev/null
@@ -1,32 +0,0 @@
-{
- "name": "@tauri-apps/plugin-window",
- "version": "2.0.0-alpha.1",
- "license": "MIT or APACHE-2.0",
- "authors": [
- "Tauri Programme within The Commons Conservancy"
- ],
- "type": "module",
- "browser": "dist-js/index.min.js",
- "module": "dist-js/index.mjs",
- "types": "dist-js/index.d.ts",
- "exports": {
- "import": "./dist-js/index.mjs",
- "types": "./dist-js/index.d.ts",
- "browser": "./dist-js/index.min.js"
- },
- "scripts": {
- "build": "rollup -c"
- },
- "files": [
- "dist-js",
- "!dist-js/**/*.map",
- "README.md",
- "LICENSE"
- ],
- "devDependencies": {
- "tslib": "^2.5.0"
- },
- "dependencies": {
- "@tauri-apps/api": "2.0.0-alpha.8"
- }
-}
diff --git a/plugins/window/rollup.config.mjs b/plugins/window/rollup.config.mjs
deleted file mode 100644
index 99a3dd31..00000000
--- a/plugins/window/rollup.config.mjs
+++ /dev/null
@@ -1,11 +0,0 @@
-import { readFileSync } from "fs";
-
-import { createConfig } from "../../shared/rollup.config.mjs";
-
-export default createConfig({
- input: "guest-js/index.ts",
- pkg: JSON.parse(
- readFileSync(new URL("./package.json", import.meta.url), "utf8"),
- ),
- external: [/^@tauri-apps\/api/],
-});
diff --git a/plugins/window/src/api-iife.js b/plugins/window/src/api-iife.js
deleted file mode 100644
index eaa20f40..00000000
--- a/plugins/window/src/api-iife.js
+++ /dev/null
@@ -1 +0,0 @@
-if("__TAURI__"in window){var __TAURI_WINDOW__=function(e){"use strict";var i=Object.defineProperty,n=(e,n)=>{for(var t in n)i(e,t,{get:n[t],enumerable:!0})},t=(e,i,n)=>{if(!i.has(e))throw TypeError("Cannot "+n)},l=(e,i,n)=>(t(e,i,"read from private field"),n?n.call(e):i.get(e)),a=(e,i,n,l)=>(t(e,i,"write to private field"),l?l.call(e,n):i.set(e,n),n);function s(e,i=!1){let n=window.crypto.getRandomValues(new Uint32Array(1))[0],t=`_${n}`;return Object.defineProperty(window,t,{value:n=>(i&&Reflect.deleteProperty(window,t),e?.(n)),writable:!1,configurable:!0}),n}n({},{Channel:()=>o,PluginListener:()=>_,addPluginListener:()=>w,convertFileSrc:()=>c,invoke:()=>u,transformCallback:()=>s});var r,o=class{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,((e,i,n)=>{if(i.has(e))throw TypeError("Cannot add the same private member more than once");i instanceof WeakSet?i.add(e):i.set(e,n)})(this,r,(()=>{})),this.id=s((e=>{l(this,r).call(this,e)}))}set onmessage(e){a(this,r,e)}get onmessage(){return l(this,r)}toJSON(){return`__CHANNEL__:${this.id}`}};r=new WeakMap;var _=class{constructor(e,i,n){this.plugin=e,this.event=i,this.channelId=n}async unregister(){return u(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}};async function w(e,i,n){let t=new o;return t.onmessage=n,u(`plugin:${e}|register_listener`,{event:i,handler:t}).then((()=>new _(e,i,t.id)))}async function u(e,i={},n){return new Promise(((t,l)=>{let a=s((e=>{t(e),Reflect.deleteProperty(window,`_${r}`)}),!0),r=s((e=>{l(e),Reflect.deleteProperty(window,`_${a}`)}),!0);window.__TAURI_IPC__({cmd:e,callback:a,error:r,payload:i,options:n})}))}function c(e,i="asset"){return window.__TAURI__.convertFileSrc(e,i)}n({},{TauriEvent:()=>h,emit:()=>b,listen:()=>y,once:()=>I});var d,h=(e=>(e.WINDOW_RESIZED="tauri://resize",e.WINDOW_MOVED="tauri://move",e.WINDOW_CLOSE_REQUESTED="tauri://close-requested",e.WINDOW_CREATED="tauri://window-created",e.WINDOW_DESTROYED="tauri://destroyed",e.WINDOW_FOCUS="tauri://focus",e.WINDOW_BLUR="tauri://blur",e.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",e.WINDOW_THEME_CHANGED="tauri://theme-changed",e.WINDOW_FILE_DROP="tauri://file-drop",e.WINDOW_FILE_DROP_HOVER="tauri://file-drop-hover",e.WINDOW_FILE_DROP_CANCELLED="tauri://file-drop-cancelled",e.MENU="tauri://menu",e))(h||{});async function p(e,i){await u("plugin:event|unlisten",{event:e,eventId:i})}async function y(e,i,n){return u("plugin:event|listen",{event:e,windowLabel:n?.target,handler:s(i)}).then((i=>async()=>p(e,i)))}async function I(e,i,n){return y(e,(n=>{i(n),p(e,n.id).catch((()=>{}))}),n)}async function b(e,i,n){await u("plugin:event|emit",{event:e,windowLabel:n?.target,payload:i})}class g{constructor(e,i){this.type="Logical",this.width=e,this.height=i}}class E{constructor(e,i){this.type="Physical",this.width=e,this.height=i}toLogical(e){return new g(this.width/e,this.height/e)}}class O{constructor(e,i){this.type="Logical",this.x=e,this.y=i}}class A{constructor(e,i){this.type="Physical",this.x=e,this.y=i}toLogical(e){return new O(this.x/e,this.y/e)}}e.UserAttentionType=void 0,(d=e.UserAttentionType||(e.UserAttentionType={}))[d.Critical=1]="Critical",d[d.Informational=2]="Informational";class m{constructor(e){this._preventDefault=!1,this.event=e.event,this.windowLabel=e.windowLabel,this.id=e.id}preventDefault(){this._preventDefault=!0}isPreventDefault(){return this._preventDefault}}function R(){return new v(window.__TAURI_METADATA__.__currentWindow.label,{skip:!0})}function N(){return window.__TAURI_METADATA__.__windows.map((e=>new v(e.label,{skip:!0})))}const T=["tauri://created","tauri://error"];class v{constructor(e,i={}){this.label=e,this.listeners=Object.create(null),(null==i?void 0:i.skip)||window.__TAURI_INVOKE__("plugin:window|create",{options:{...i,label:e}}).then((async()=>this.emit("tauri://created"))).catch((async e=>this.emit("tauri://error",e)))}static getByLabel(e){return N().some((i=>i.label===e))?new v(e,{skip:!0}):null}static getCurrent(){return R()}static getAll(){return N()}static async getFocusedWindow(){for(const e of N())if(await e.isFocused())return e;return null}async listen(e,i){return this._handleTauriEvent(e,i)?Promise.resolve((()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)})):y(e,i,{target:this.label})}async once(e,i){return this._handleTauriEvent(e,i)?Promise.resolve((()=>{const n=this.listeners[e];n.splice(n.indexOf(i),1)})):I(e,i,{target:this.label})}async emit(e,i){if(T.includes(e)){for(const n of this.listeners[e]||[])n({event:e,id:-1,windowLabel:this.label,payload:i});return Promise.resolve()}return b(e,i,{target:this.label})}_handleTauriEvent(e,i){return!!T.includes(e)&&(e in this.listeners?this.listeners[e].push(i):this.listeners[e]=[i],!0)}async scaleFactor(){return window.__TAURI_INVOKE__("plugin:window|scale_factor",{label:this.label})}async innerPosition(){return window.__TAURI_INVOKE__("plugin:window|inner_position",{label:this.label}).then((({x:e,y:i})=>new A(e,i)))}async outerPosition(){return window.__TAURI_INVOKE__("plugin:window|outer_position",{label:this.label}).then((({x:e,y:i})=>new A(e,i)))}async innerSize(){return window.__TAURI_INVOKE__("plugin:window|inner_size",{label:this.label}).then((({width:e,height:i})=>new E(e,i)))}async outerSize(){return window.__TAURI_INVOKE__("plugin:window|outer_size",{label:this.label}).then((({width:e,height:i})=>new E(e,i)))}async isFullscreen(){return window.__TAURI_INVOKE__("plugin:window|is_fullscreen",{label:this.label})}async isMinimized(){return window.__TAURI_INVOKE__("plugin:window|is_minimized",{label:this.label})}async isMaximized(){return window.__TAURI_INVOKE__("plugin:window|is_maximized",{label:this.label})}async isFocused(){return window.__TAURI_INVOKE__("plugin:window|is_focused",{label:this.label})}async isDecorated(){return window.__TAURI_INVOKE__("plugin:window|is_decorated",{label:this.label})}async isResizable(){return window.__TAURI_INVOKE__("plugin:window|is_resizable",{label:this.label})}async isMaximizable(){return window.__TAURI_INVOKE__("plugin:window|is_maximizable",{label:this.label})}async isMinimizable(){return window.__TAURI_INVOKE__("plugin:window|is_minimizable",{label:this.label})}async isClosable(){return window.__TAURI_INVOKE__("plugin:window|is_closable",{label:this.label})}async isVisible(){return window.__TAURI_INVOKE__("plugin:window|is_visible",{label:this.label})}async title(){return window.__TAURI_INVOKE__("plugin:window|title",{label:this.label})}async theme(){return window.__TAURI_INVOKE__("plugin:window|theme",{label:this.label})}async center(){return window.__TAURI_INVOKE__("plugin:window|center",{label:this.label})}async requestUserAttention(i){let n=null;return i&&(n=i===e.UserAttentionType.Critical?{type:"Critical"}:{type:"Informational"}),window.__TAURI_INVOKE__("plugin:window|request_user_attention",{label:this.label,value:n})}async setResizable(e){return window.__TAURI_INVOKE__("plugin:window|set_resizable",{label:this.label,value:e})}async setMaximizable(e){return window.__TAURI_INVOKE__("plugin:window|set_maximizable",{label:this.label,value:e})}async setMinimizable(e){return window.__TAURI_INVOKE__("plugin:window|set_minimizable",{label:this.label,value:e})}async setClosable(e){return window.__TAURI_INVOKE__("plugin:window|set_closable",{label:this.label,value:e})}async setTitle(e){return window.__TAURI_INVOKE__("plugin:window|set_title",{label:this.label,value:e})}async maximize(){return window.__TAURI_INVOKE__("plugin:window|maximize",{label:this.label})}async unmaximize(){return window.__TAURI_INVOKE__("plugin:window|unmaximize",{label:this.label})}async toggleMaximize(){return window.__TAURI_INVOKE__("plugin:window|toggle_maximize",{label:this.label})}async minimize(){return window.__TAURI_INVOKE__("plugin:window|minimize",{label:this.label})}async unminimize(){return window.__TAURI_INVOKE__("plugin:window|unminimize",{label:this.label})}async show(){return window.__TAURI_INVOKE__("plugin:window|show",{label:this.label})}async hide(){return window.__TAURI_INVOKE__("plugin:window|hide",{label:this.label})}async close(){return window.__TAURI_INVOKE__("plugin:window|close",{label:this.label})}async setDecorations(e){return window.__TAURI_INVOKE__("plugin:window|set_decorations",{label:this.label,value:e})}async setShadow(e){return window.__TAURI_INVOKE__("plugin:window|set_shadow",{label:this.label,value:e})}async setEffects(e){return window.__TAURI_INVOKE__("plugin:window|set_effects",{label:this.label,value:e})}async clearEffects(){return window.__TAURI_INVOKE__("plugin:window|set_effects",{label:this.label,value:null})}async setAlwaysOnTop(e){return window.__TAURI_INVOKE__("plugin:window|set_always_on_top",{label:this.label,value:e})}async setContentProtected(e){return window.__TAURI_INVOKE__("plugin:window|set_content_protected",{label:this.label,value:e})}async setSize(e){if(!e||"Logical"!==e.type&&"Physical"!==e.type)throw new Error("the `size` argument must be either a LogicalSize or a PhysicalSize instance");return window.__TAURI_INVOKE__("plugin:window|set_size",{label:this.label,value:{type:e.type,data:{width:e.width,height:e.height}}})}async setMinSize(e){if(e&&"Logical"!==e.type&&"Physical"!==e.type)throw new Error("the `size` argument must be either a LogicalSize or a PhysicalSize instance");return window.__TAURI_INVOKE__("plugin:window|set_min_size",{label:this.label,value:e?{type:e.type,data:{width:e.width,height:e.height}}:null})}async setMaxSize(e){if(e&&"Logical"!==e.type&&"Physical"!==e.type)throw new Error("the `size` argument must be either a LogicalSize or a PhysicalSize instance");return window.__TAURI_INVOKE__("plugin:window|set_max_size",{label:this.label,value:e?{type:e.type,data:{width:e.width,height:e.height}}:null})}async setPosition(e){if(!e||"Logical"!==e.type&&"Physical"!==e.type)throw new Error("the `position` argument must be either a LogicalPosition or a PhysicalPosition instance");return window.__TAURI_INVOKE__("plugin:window|set_position",{label:this.label,value:{type:e.type,data:{x:e.x,y:e.y}}})}async setFullscreen(e){return window.__TAURI_INVOKE__("plugin:window|set_fullscreen",{label:this.label,value:e})}async setFocus(){return window.__TAURI_INVOKE__("plugin:window|set_focus",{label:this.label})}async setIcon(e){return window.__TAURI_INVOKE__("plugin:window|set_icon",{label:this.label,value:"string"==typeof e?e:Array.from(e)})}async setSkipTaskbar(e){return window.__TAURI_INVOKE__("plugin:window|set_skip_taskbar",{label:this.label,value:e})}async setCursorGrab(e){return window.__TAURI_INVOKE__("plugin:window|set_cursor_grab",{label:this.label,value:e})}async setCursorVisible(e){return window.__TAURI_INVOKE__("plugin:window|set_cursor_visible",{label:this.label,value:e})}async setCursorIcon(e){return window.__TAURI_INVOKE__("plugin:window|set_cursor_icon",{label:this.label,value:e})}async setCursorPosition(e){if(!e||"Logical"!==e.type&&"Physical"!==e.type)throw new Error("the `position` argument must be either a LogicalPosition or a PhysicalPosition instance");return window.__TAURI_INVOKE__("plugin:window|set_cursor_position",{label:this.label,value:{type:e.type,data:{x:e.x,y:e.y}}})}async setIgnoreCursorEvents(e){return window.__TAURI_INVOKE__("plugin:window|set_ignore_cursor_events",{label:this.label,value:e})}async startDragging(){return window.__TAURI_INVOKE__("plugin:window|start_dragging",{label:this.label})}async onResized(e){return this.listen(h.WINDOW_RESIZED,(i=>{i.payload=W(i.payload),e(i)}))}async onMoved(e){return this.listen(h.WINDOW_MOVED,(i=>{i.payload=D(i.payload),e(i)}))}async onCloseRequested(e){return this.listen(h.WINDOW_CLOSE_REQUESTED,(i=>{const n=new m(i);Promise.resolve(e(n)).then((()=>{if(!n.isPreventDefault())return this.close()}))}))}async onFocusChanged(e){const i=await this.listen(h.WINDOW_FOCUS,(i=>{e({...i,payload:!0})})),n=await this.listen(h.WINDOW_BLUR,(i=>{e({...i,payload:!1})}));return()=>{i(),n()}}async onScaleChanged(e){return this.listen(h.WINDOW_SCALE_FACTOR_CHANGED,e)}async onMenuClicked(e){return this.listen(h.MENU,e)}async onFileDropEvent(e){const i=await this.listen(h.WINDOW_FILE_DROP,(i=>{e({...i,payload:{type:"drop",paths:i.payload}})})),n=await this.listen(h.WINDOW_FILE_DROP_HOVER,(i=>{e({...i,payload:{type:"hover",paths:i.payload}})})),t=await this.listen(h.WINDOW_FILE_DROP_CANCELLED,(i=>{e({...i,payload:{type:"cancel"}})}));return()=>{i(),n(),t()}}async onThemeChanged(e){return this.listen(h.WINDOW_THEME_CHANGED,e)}}var f,U;function V(e){return null===e?null:{name:e.name,scaleFactor:e.scaleFactor,position:D(e.position),size:W(e.size)}}function D(e){return new A(e.x,e.y)}function W(e){return new E(e.width,e.height)}return e.Effect=void 0,(f=e.Effect||(e.Effect={})).AppearanceBased="appearanceBased",f.Light="light",f.Dark="dark",f.MediumLight="mediumLight",f.UltraDark="ultraDark",f.Titlebar="titlebar",f.Selection="selection",f.Menu="menu",f.Popover="popover",f.Sidebar="sidebar",f.HeaderView="headerView",f.Sheet="sheet",f.WindowBackground="windowBackground",f.HudWindow="hudWindow",f.FullScreenUI="fullScreenUI",f.Tooltip="tooltip",f.ContentBackground="contentBackground",f.UnderWindowBackground="underWindowBackground",f.UnderPageBackground="underPageBackground",f.Mica="mica",f.Blur="blur",f.Acrylic="acrylic",e.EffectState=void 0,(U=e.EffectState||(e.EffectState={})).FollowsWindowActiveState="followsWindowActiveState",U.Active="active",U.Inactive="inactive",e.CloseRequestedEvent=m,e.LogicalPosition=O,e.LogicalSize=g,e.PhysicalPosition=A,e.PhysicalSize=E,e.Window=v,e.availableMonitors=async function(){return window.__TAURI_INVOKE__("plugin:window|available_monitors").then((e=>e.map(V)))},e.currentMonitor=async function(){return window.__TAURI_INVOKE__("plugin:window|current_monitor").then(V)},e.getAll=N,e.getCurrent=R,e.primaryMonitor=async function(){return window.__TAURI_INVOKE__("plugin:window|primary_monitor").then(V)},e}({});Object.defineProperty(window.__TAURI__,"window",{value:__TAURI_WINDOW__})}
diff --git a/plugins/window/src/desktop_commands.rs b/plugins/window/src/desktop_commands.rs
deleted file mode 100644
index a6051c80..00000000
--- a/plugins/window/src/desktop_commands.rs
+++ /dev/null
@@ -1,211 +0,0 @@
-// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
-// SPDX-License-Identifier: Apache-2.0
-// SPDX-License-Identifier: MIT
-
-use serde::{Deserialize, Serialize, Serializer};
-use tauri::{
- utils::config::{WindowConfig, WindowEffectsConfig},
- AppHandle, CursorIcon, Icon, Manager, Monitor, PhysicalPosition, PhysicalSize, Position,
- Runtime, Size, Theme, UserAttentionType, Window,
-};
-
-#[derive(Debug, thiserror::Error)]
-pub enum Error {
- #[error("window not found")]
- WindowNotFound,
- #[error(transparent)]
- Tauri(#[from] tauri::Error),
-}
-
-impl Serialize for Error {
- fn serialize(&self, serializer: S) -> std::result::Result
- where
- S: Serializer,
- {
- serializer.serialize_str(self.to_string().as_ref())
- }
-}
-
-type Result = std::result::Result;
-
-#[derive(Deserialize)]
-#[serde(untagged)]
-pub enum IconDto {
- #[cfg(any(feature = "icon-png", feature = "icon-ico"))]
- File(std::path::PathBuf),
- #[cfg(any(feature = "icon-png", feature = "icon-ico"))]
- Raw(Vec),
- Rgba {
- rgba: Vec,
- width: u32,
- height: u32,
- },
-}
-
-impl From for Icon {
- fn from(icon: IconDto) -> Self {
- match icon {
- #[cfg(any(feature = "icon-png", feature = "icon-ico"))]
- IconDto::File(path) => Self::File(path),
- #[cfg(any(feature = "icon-png", feature = "icon-ico"))]
- IconDto::Raw(raw) => Self::Raw(raw),
- IconDto::Rgba {
- rgba,
- width,
- height,
- } => Self::Rgba {
- rgba,
- width,
- height,
- },
- }
- }
-}
-
-#[tauri::command]
-pub async fn create(app: AppHandle, options: WindowConfig) -> Result<()> {
- tauri::window::WindowBuilder::from_config(&app, options).build()?;
- Ok(())
-}
-
-fn get_window(window: Window, label: Option) -> Result> {
- match label {
- Some(l) if !l.is_empty() => window.get_window(&l).ok_or(Error::WindowNotFound),
- _ => Ok(window),
- }
-}
-
-macro_rules! getter {
- ($cmd: ident, $ret: ty) => {
- #[tauri::command]
- pub async fn $cmd(window: Window, label: Option) -> Result<$ret> {
- get_window(window, label)?.$cmd().map_err(Into::into)
- }
- };
-}
-
-macro_rules! setter {
- ($cmd: ident) => {
- #[tauri::command]
- pub async fn $cmd(window: Window, label: Option) -> Result<()> {
- get_window(window, label)?.$cmd().map_err(Into::into)
- }
- };
-
- ($cmd: ident, $input: ty) => {
- #[tauri::command]
- pub async fn $cmd(
- window: Window,
- label: Option,
- value: $input,
- ) -> Result<()> {
- get_window(window, label)?.$cmd(value).map_err(Into::into)
- }
- };
-}
-
-getter!(scale_factor, f64);
-getter!(inner_position, PhysicalPosition);
-getter!(outer_position, PhysicalPosition);
-getter!(inner_size, PhysicalSize);
-getter!(outer_size, PhysicalSize);
-getter!(is_fullscreen, bool);
-getter!(is_minimized, bool);
-getter!(is_maximized, bool);
-getter!(is_focused, bool);
-getter!(is_decorated, bool);
-getter!(is_resizable, bool);
-getter!(is_maximizable, bool);
-getter!(is_minimizable, bool);
-getter!(is_closable, bool);
-getter!(is_visible, bool);
-getter!(title, String);
-getter!(current_monitor, Option);
-getter!(primary_monitor, Option);
-getter!(available_monitors, Vec);
-getter!(theme, Theme);
-
-setter!(center);
-setter!(request_user_attention, Option);
-setter!(set_resizable, bool);
-setter!(set_maximizable, bool);
-setter!(set_minimizable, bool);
-setter!(set_closable, bool);
-setter!(set_title, &str);
-setter!(maximize);
-setter!(unmaximize);
-setter!(minimize);
-setter!(unminimize);
-setter!(show);
-setter!(hide);
-setter!(close);
-setter!(set_decorations, bool);
-setter!(set_shadow, bool);
-setter!(set_effects, Option);
-setter!(set_always_on_top, bool);
-setter!(set_content_protected, bool);
-setter!(set_size, Size);
-setter!(set_min_size, Option);
-setter!(set_max_size, Option);
-setter!(set_position, Position);
-setter!(set_fullscreen, bool);
-setter!(set_focus);
-setter!(set_skip_taskbar, bool);
-setter!(set_cursor_grab, bool);
-setter!(set_cursor_visible, bool);
-setter!(set_cursor_icon, CursorIcon);
-setter!(set_cursor_position, Position);
-setter!(set_ignore_cursor_events, bool);
-setter!(start_dragging);
-setter!(print);
-
-#[tauri::command]
-pub async fn set_icon(
- window: Window,
- label: Option,
- value: IconDto,
-) -> Result<()> {
- get_window(window, label)?
- .set_icon(value.into())
- .map_err(Into::into)
-}
-
-#[tauri::command]
-pub async fn toggle_maximize(window: Window, label: Option) -> Result<()> {
- let window = get_window(window, label)?;
- match window.is_maximized()? {
- true => window.unmaximize()?,
- false => window.maximize()?,
- };
- Ok(())
-}
-
-#[tauri::command]
-pub async fn internal_toggle_maximize(
- window: Window,
- label: Option,
-) -> Result<()> {
- let window = get_window(window, label)?;
- if window.is_resizable()? {
- match window.is_maximized()? {
- true => window.unmaximize()?,
- false => window.maximize()?,
- };
- }
- Ok(())
-}
-
-#[cfg(any(debug_assertions, feature = "devtools"))]
-#[tauri::command]
-pub async fn internal_toggle_devtools(
- window: Window,
- label: Option,
-) -> Result<()> {
- let window = get_window(window, label)?;
- if window.is_devtools_open() {
- window.close_devtools();
- } else {
- window.open_devtools();
- }
- Ok(())
-}
diff --git a/plugins/window/src/lib.rs b/plugins/window/src/lib.rs
deleted file mode 100644
index 90dbd710..00000000
--- a/plugins/window/src/lib.rs
+++ /dev/null
@@ -1,114 +0,0 @@
-// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
-// SPDX-License-Identifier: Apache-2.0
-// SPDX-License-Identifier: MIT
-
-//! [](https://github.com/tauri-apps/plugins-workspace/tree/v2/plugins/window)
-//!
-//! Interact with the Tauri window.
-
-#![doc(
- html_logo_url = "https://github.com/tauri-apps/tauri/raw/dev/app-icon.png",
- html_favicon_url = "https://github.com/tauri-apps/tauri/raw/dev/app-icon.png"
-)]
-
-use tauri::{
- plugin::{Builder, TauriPlugin},
- Runtime,
-};
-
-#[cfg(desktop)]
-mod desktop_commands;
-
-pub fn init() -> TauriPlugin {
- let mut init_script = String::new();
- // window.print works on Linux/Windows; need to use the API on macOS
- #[cfg(any(target_os = "macos", target_os = "ios"))]
- {
- init_script.push_str(include_str!("./scripts/print.js"));
- }
- init_script.push_str(include_str!("./scripts/drag.js"));
- #[cfg(any(debug_assertions, feature = "devtools"))]
- init_script.push_str(include_str!("./scripts/toggle-devtools.js"));
-
- init_script.push_str(include_str!("api-iife.js"));
-
- Builder::new("window")
- .js_init_script(init_script)
- .invoke_handler(|invoke| {
- #[cfg(desktop)]
- {
- let handler: Box) -> bool> =
- Box::new(tauri::generate_handler![
- desktop_commands::create,
- // getters
- desktop_commands::scale_factor,
- desktop_commands::inner_position,
- desktop_commands::outer_position,
- desktop_commands::inner_size,
- desktop_commands::outer_size,
- desktop_commands::is_fullscreen,
- desktop_commands::is_minimized,
- desktop_commands::is_maximized,
- desktop_commands::is_focused,
- desktop_commands::is_decorated,
- desktop_commands::is_resizable,
- desktop_commands::is_maximizable,
- desktop_commands::is_minimizable,
- desktop_commands::is_closable,
- desktop_commands::is_visible,
- desktop_commands::title,
- desktop_commands::current_monitor,
- desktop_commands::primary_monitor,
- desktop_commands::available_monitors,
- desktop_commands::theme,
- // setters
- desktop_commands::center,
- desktop_commands::request_user_attention,
- desktop_commands::set_resizable,
- desktop_commands::set_maximizable,
- desktop_commands::set_minimizable,
- desktop_commands::set_closable,
- desktop_commands::set_title,
- desktop_commands::maximize,
- desktop_commands::unmaximize,
- desktop_commands::minimize,
- desktop_commands::unminimize,
- desktop_commands::show,
- desktop_commands::hide,
- desktop_commands::close,
- desktop_commands::set_decorations,
- desktop_commands::set_shadow,
- desktop_commands::set_effects,
- desktop_commands::set_always_on_top,
- desktop_commands::set_content_protected,
- desktop_commands::set_size,
- desktop_commands::set_min_size,
- desktop_commands::set_max_size,
- desktop_commands::set_position,
- desktop_commands::set_fullscreen,
- desktop_commands::set_focus,
- desktop_commands::set_skip_taskbar,
- desktop_commands::set_cursor_grab,
- desktop_commands::set_cursor_visible,
- desktop_commands::set_cursor_icon,
- desktop_commands::set_cursor_position,
- desktop_commands::set_ignore_cursor_events,
- desktop_commands::start_dragging,
- desktop_commands::print,
- desktop_commands::set_icon,
- desktop_commands::toggle_maximize,
- desktop_commands::internal_toggle_maximize,
- #[cfg(any(debug_assertions, feature = "devtools"))]
- desktop_commands::internal_toggle_devtools,
- ]);
- #[allow(clippy::needless_return)]
- return handler(invoke);
- }
- #[cfg(mobile)]
- {
- invoke.resolver.reject("Window API not available on mobile");
- return true;
- }
- })
- .build()
-}
diff --git a/plugins/window/src/scripts/drag.js b/plugins/window/src/scripts/drag.js
deleted file mode 100644
index 2bcc3ee6..00000000
--- a/plugins/window/src/scripts/drag.js
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
-// SPDX-License-Identifier: Apache-2.0
-// SPDX-License-Identifier: MIT
-
-document.addEventListener("mousedown", (e) => {
- if (e.target.hasAttribute("data-tauri-drag-region") && e.button === 0) {
- // prevents text cursor
- e.preventDefault();
- // fix #2549: double click on drag region edge causes content to maximize without window sizing change
- // https://github.com/tauri-apps/tauri/issues/2549#issuecomment-1250036908
- e.stopImmediatePropagation();
-
- // start dragging if the element has a `tauri-drag-region` data attribute and maximize on double-clicking it
- const cmd = e.detail === 2 ? "internal_toggle_maximize" : "start_dragging";
- window.__TAURI_INVOKE__("plugin:window|" + cmd);
- }
-});
diff --git a/plugins/window/src/scripts/print.js b/plugins/window/src/scripts/print.js
deleted file mode 100644
index 1e833766..00000000
--- a/plugins/window/src/scripts/print.js
+++ /dev/null
@@ -1,7 +0,0 @@
-// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
-// SPDX-License-Identifier: Apache-2.0
-// SPDX-License-Identifier: MIT
-
-window.print = function () {
- return window.__TAURI_INVOKE__("plugin:window|print");
-};
diff --git a/plugins/window/src/scripts/toggle-devtools.js b/plugins/window/src/scripts/toggle-devtools.js
deleted file mode 100644
index 42c4bdba..00000000
--- a/plugins/window/src/scripts/toggle-devtools.js
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
-// SPDX-License-Identifier: Apache-2.0
-// SPDX-License-Identifier: MIT
-
-(function () {
- function toggleDevtoolsHotkey() {
- const isHotkey = navigator.appVersion.includes("Mac")
- ? (event) => event.metaKey && event.altKey && event.key === "I"
- : (event) => event.ctrlKey && event.shiftKey && event.key === "I";
-
- document.addEventListener("keydown", (event) => {
- if (isHotkey(event)) {
- window.__TAURI_INVOKE__("plugin:window|internal_toggle_devtools");
- }
- });
- }
-
- if (
- document.readyState === "complete" ||
- document.readyState === "interactive"
- ) {
- toggleDevtoolsHotkey();
- } else {
- window.addEventListener("DOMContentLoaded", toggleDevtoolsHotkey, true);
- }
-})();
diff --git a/plugins/window/tsconfig.json b/plugins/window/tsconfig.json
deleted file mode 100644
index 5098169a..00000000
--- a/plugins/window/tsconfig.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "extends": "../../tsconfig.base.json",
- "include": ["guest-js/*.ts"]
-}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index b164242d..22b63fd5 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -66,9 +66,6 @@ importers:
'@tauri-apps/api':
specifier: 2.0.0-alpha.8
version: 2.0.0-alpha.8
- '@tauri-apps/plugin-app':
- specifier: 2.0.0-alpha.1
- version: link:../../plugins/app
'@tauri-apps/plugin-barcode-scanner':
specifier: 2.0.0-alpha.0
version: link:../../plugins/barcode-scanner
@@ -105,9 +102,6 @@ importers:
'@tauri-apps/plugin-updater':
specifier: 2.0.0-alpha.1
version: link:../../plugins/updater
- '@tauri-apps/plugin-window':
- specifier: 2.0.0-alpha.1
- version: link:../../plugins/window
'@zerodevx/svelte-json-view':
specifier: 1.0.5
version: 1.0.5(svelte@3.59.1)
@@ -140,16 +134,6 @@ importers:
specifier: ^4.3.9
version: 4.4.4
- plugins/app:
- dependencies:
- '@tauri-apps/api':
- specifier: 2.0.0-alpha.8
- version: 2.0.0-alpha.8
- devDependencies:
- tslib:
- specifier: ^2.5.0
- version: 2.6.0
-
plugins/authenticator:
dependencies:
'@tauri-apps/api':
@@ -429,16 +413,6 @@ importers:
specifier: 4.4.4
version: 4.4.4
- plugins/window:
- dependencies:
- '@tauri-apps/api':
- specifier: 2.0.0-alpha.8
- version: 2.0.0-alpha.8
- devDependencies:
- tslib:
- specifier: ^2.5.0
- version: 2.6.0
-
plugins/window-state:
dependencies:
'@tauri-apps/api':