refactor: remove window and app plugins (#671)
Co-authored-by: Lucas Nogueira <lucas@tauri.app>pull/677/head
parent
0e642e68de
commit
b7c5407cac
@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
"window-js": "minor:feat"
|
|
||||||
---
|
|
||||||
|
|
||||||
Added the `maximizable`, `minimizable` and `closable` fields on `WindowOptions`.
|
|
@ -1,6 +0,0 @@
|
|||||||
---
|
|
||||||
"window": "minor:feat"
|
|
||||||
"window-js": "minor:feat"
|
|
||||||
---
|
|
||||||
|
|
||||||
Added the `setMaximizable`, `setMinimizable`, `setClosable`, `isMaximizable`, `isMinimizable` and `isClosable` methods.
|
|
@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
"window-js": "minor"
|
|
||||||
---
|
|
||||||
|
|
||||||
Add `incognito` window configuration option
|
|
@ -1,6 +0,0 @@
|
|||||||
---
|
|
||||||
"window": "minor:feat"
|
|
||||||
"window-js": "minor:feat"
|
|
||||||
---
|
|
||||||
|
|
||||||
Add `WebviewWindow.is_focused` and `WebviewWindow.getFocusedWindow` getters.
|
|
@ -1,10 +0,0 @@
|
|||||||
---
|
|
||||||
"window": "patch"
|
|
||||||
"window-js": "patch"
|
|
||||||
---
|
|
||||||
|
|
||||||
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.
|
|
@ -1,6 +0,0 @@
|
|||||||
---
|
|
||||||
"window": "patch"
|
|
||||||
"window-js": "patch"
|
|
||||||
---
|
|
||||||
|
|
||||||
Added the `setEffects` and `clearEffects` API.
|
|
@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
"window": "patch"
|
|
||||||
---
|
|
||||||
|
|
||||||
On macOS, fixed tapping on custom title bar doesn't maximize the window.
|
|
@ -1,33 +0,0 @@
|
|||||||
<script>
|
|
||||||
import { show, hide } from "@tauri-apps/plugin-app";
|
|
||||||
|
|
||||||
export let onMessage;
|
|
||||||
|
|
||||||
function showApp() {
|
|
||||||
hideApp()
|
|
||||||
.then(() => {
|
|
||||||
setTimeout(() => {
|
|
||||||
show()
|
|
||||||
.then(() => onMessage("Shown app"))
|
|
||||||
.catch(onMessage);
|
|
||||||
}, 2000);
|
|
||||||
})
|
|
||||||
.catch(onMessage);
|
|
||||||
}
|
|
||||||
|
|
||||||
function hideApp() {
|
|
||||||
return hide()
|
|
||||||
.then(() => onMessage("Hide app"))
|
|
||||||
.catch(onMessage);
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<button
|
|
||||||
class="btn"
|
|
||||||
id="show"
|
|
||||||
title="Hides and shows the app after 2 seconds"
|
|
||||||
on:click={showApp}>Show</button
|
|
||||||
>
|
|
||||||
<button class="btn" id="hide" on:click={hideApp}>Hide</button>
|
|
||||||
</div>
|
|
@ -1,615 +0,0 @@
|
|||||||
<script>
|
|
||||||
import {
|
|
||||||
getCurrent,
|
|
||||||
LogicalSize,
|
|
||||||
UserAttentionType,
|
|
||||||
PhysicalSize,
|
|
||||||
PhysicalPosition,
|
|
||||||
Effect,
|
|
||||||
EffectState,
|
|
||||||
Window
|
|
||||||
} from "@tauri-apps/plugin-window";
|
|
||||||
import { open as openDialog } from "@tauri-apps/plugin-dialog";
|
|
||||||
import { open } from "@tauri-apps/plugin-shell";
|
|
||||||
|
|
||||||
const appWindow = getCurrent();
|
|
||||||
|
|
||||||
let selectedWindow = appWindow.label;
|
|
||||||
const windowMap = {
|
|
||||||
[appWindow.label]: appWindow,
|
|
||||||
};
|
|
||||||
|
|
||||||
const cursorIconOptions = [
|
|
||||||
"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",
|
|
||||||
];
|
|
||||||
|
|
||||||
const windowsEffects = ["mica", "blur", "acrylic"];
|
|
||||||
const isWindows = navigator.appVersion.includes("windows");
|
|
||||||
const isMacOS = navigator.appVersion.includes("macos");
|
|
||||||
let effectOptions = isWindows
|
|
||||||
? windowsEffects
|
|
||||||
: Object.keys(Effect)
|
|
||||||
.map((effect) => Effect[effect])
|
|
||||||
.filter((e) => !windowsEffects.includes(e));
|
|
||||||
const effectStateOptions = Object.keys(EffectState).map(
|
|
||||||
(state) => EffectState[state]
|
|
||||||
);
|
|
||||||
|
|
||||||
export let onMessage;
|
|
||||||
const mainEl = document.querySelector("main");
|
|
||||||
|
|
||||||
let newWindowLabel;
|
|
||||||
|
|
||||||
let urlValue = "https://tauri.app";
|
|
||||||
let resizable = true;
|
|
||||||
let maximizable = true;
|
|
||||||
let minimizable = true;
|
|
||||||
let closable = true;
|
|
||||||
let maximized = false;
|
|
||||||
let decorations = true;
|
|
||||||
let alwaysOnTop = false;
|
|
||||||
let contentProtected = true;
|
|
||||||
let fullscreen = false;
|
|
||||||
let width = null;
|
|
||||||
let height = null;
|
|
||||||
let minWidth = null;
|
|
||||||
let minHeight = null;
|
|
||||||
let maxWidth = null;
|
|
||||||
let maxHeight = null;
|
|
||||||
let x = null;
|
|
||||||
let y = null;
|
|
||||||
let scaleFactor = 1;
|
|
||||||
let innerPosition = new PhysicalPosition(x, y);
|
|
||||||
let outerPosition = new PhysicalPosition(x, y);
|
|
||||||
let innerSize = new PhysicalSize(width, height);
|
|
||||||
let outerSize = new PhysicalSize(width, height);
|
|
||||||
let resizeEventUnlisten;
|
|
||||||
let moveEventUnlisten;
|
|
||||||
let cursorGrab = false;
|
|
||||||
let cursorVisible = true;
|
|
||||||
let cursorX = null;
|
|
||||||
let cursorY = null;
|
|
||||||
let cursorIcon = "default";
|
|
||||||
let cursorIgnoreEvents = false;
|
|
||||||
let windowTitle = "Awesome Tauri Example!";
|
|
||||||
|
|
||||||
let effects = [];
|
|
||||||
let selectedEffect;
|
|
||||||
let effectState;
|
|
||||||
let effectRadius;
|
|
||||||
let effectR, effectG, effectB, effectA;
|
|
||||||
|
|
||||||
function openUrl() {
|
|
||||||
open(urlValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
function setTitle_() {
|
|
||||||
windowMap[selectedWindow].setTitle(windowTitle);
|
|
||||||
}
|
|
||||||
|
|
||||||
function hide_() {
|
|
||||||
windowMap[selectedWindow].hide();
|
|
||||||
setTimeout(windowMap[selectedWindow].show, 2000);
|
|
||||||
}
|
|
||||||
|
|
||||||
function minimize_() {
|
|
||||||
windowMap[selectedWindow].minimize();
|
|
||||||
setTimeout(windowMap[selectedWindow].unminimize, 2000);
|
|
||||||
}
|
|
||||||
|
|
||||||
function getIcon() {
|
|
||||||
openDialog({
|
|
||||||
multiple: false,
|
|
||||||
}).then((path) => {
|
|
||||||
if (typeof path === "string") {
|
|
||||||
windowMap[selectedWindow].setIcon(path);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function createWindow() {
|
|
||||||
if (!newWindowLabel) return;
|
|
||||||
|
|
||||||
const webview = new Window(newWindowLabel);
|
|
||||||
windowMap[newWindowLabel] = webview;
|
|
||||||
webview.once("tauri://error", function () {
|
|
||||||
onMessage("Error creating new webview");
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function loadWindowSize() {
|
|
||||||
windowMap[selectedWindow].innerSize().then((response) => {
|
|
||||||
innerSize = response;
|
|
||||||
width = innerSize.width;
|
|
||||||
height = innerSize.height;
|
|
||||||
});
|
|
||||||
windowMap[selectedWindow].outerSize().then((response) => {
|
|
||||||
outerSize = response;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function loadWindowPosition() {
|
|
||||||
windowMap[selectedWindow].innerPosition().then((response) => {
|
|
||||||
innerPosition = response;
|
|
||||||
});
|
|
||||||
windowMap[selectedWindow].outerPosition().then((response) => {
|
|
||||||
outerPosition = response;
|
|
||||||
x = outerPosition.x;
|
|
||||||
y = outerPosition.y;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async function addWindowEventListeners(window) {
|
|
||||||
if (!window) return;
|
|
||||||
if (resizeEventUnlisten) {
|
|
||||||
resizeEventUnlisten();
|
|
||||||
}
|
|
||||||
if (moveEventUnlisten) {
|
|
||||||
moveEventUnlisten();
|
|
||||||
}
|
|
||||||
moveEventUnlisten = await window.listen("tauri://move", loadWindowPosition);
|
|
||||||
resizeEventUnlisten = await window.listen("tauri://resize", loadWindowSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
async function requestUserAttention_() {
|
|
||||||
await windowMap[selectedWindow].minimize();
|
|
||||||
await windowMap[selectedWindow].requestUserAttention(
|
|
||||||
UserAttentionType.Critical
|
|
||||||
);
|
|
||||||
await new Promise((resolve) => setTimeout(resolve, 3000));
|
|
||||||
await windowMap[selectedWindow].requestUserAttention(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
async function addEffect() {
|
|
||||||
if (!effects.includes(selectedEffect)) {
|
|
||||||
effects = [...effects, selectedEffect];
|
|
||||||
}
|
|
||||||
|
|
||||||
const payload = {
|
|
||||||
effects,
|
|
||||||
state: effectState,
|
|
||||||
radius: effectRadius,
|
|
||||||
};
|
|
||||||
if (
|
|
||||||
Number.isInteger(effectR) &&
|
|
||||||
Number.isInteger(effectG) &&
|
|
||||||
Number.isInteger(effectB) &&
|
|
||||||
Number.isInteger(effectA)
|
|
||||||
) {
|
|
||||||
payload.color = [effectR, effectG, effectB, effectA];
|
|
||||||
}
|
|
||||||
|
|
||||||
mainEl.classList.remove("bg-primary");
|
|
||||||
mainEl.classList.remove("dark:bg-darkPrimary");
|
|
||||||
await windowMap[selectedWindow].clearEffects();
|
|
||||||
await windowMap[selectedWindow].setEffects(payload);
|
|
||||||
}
|
|
||||||
|
|
||||||
async function clearEffects() {
|
|
||||||
effects = [];
|
|
||||||
await windowMap[selectedWindow].clearEffects();
|
|
||||||
mainEl.classList.add("bg-primary");
|
|
||||||
mainEl.classList.add("dark:bg-darkPrimary");
|
|
||||||
}
|
|
||||||
|
|
||||||
$: {
|
|
||||||
windowMap[selectedWindow];
|
|
||||||
loadWindowPosition();
|
|
||||||
loadWindowSize();
|
|
||||||
}
|
|
||||||
$: windowMap[selectedWindow]?.setResizable(resizable);
|
|
||||||
$: windowMap[selectedWindow]?.setMaximizable(maximizable);
|
|
||||||
$: windowMap[selectedWindow]?.setMinimizable(minimizable);
|
|
||||||
$: windowMap[selectedWindow]?.setClosable(closable);
|
|
||||||
$: maximized
|
|
||||||
? windowMap[selectedWindow]?.maximize()
|
|
||||||
: windowMap[selectedWindow]?.unmaximize();
|
|
||||||
$: windowMap[selectedWindow]?.setDecorations(decorations);
|
|
||||||
$: windowMap[selectedWindow]?.setAlwaysOnTop(alwaysOnTop);
|
|
||||||
$: windowMap[selectedWindow]?.setContentProtected(contentProtected);
|
|
||||||
$: windowMap[selectedWindow]?.setFullscreen(fullscreen);
|
|
||||||
|
|
||||||
$: width &&
|
|
||||||
height &&
|
|
||||||
windowMap[selectedWindow]?.setSize(new PhysicalSize(width, height));
|
|
||||||
$: minWidth && minHeight
|
|
||||||
? windowMap[selectedWindow]?.setMinSize(
|
|
||||||
new LogicalSize(minWidth, minHeight)
|
|
||||||
)
|
|
||||||
: windowMap[selectedWindow]?.setMinSize(null);
|
|
||||||
$: maxWidth > 800 && maxHeight > 400
|
|
||||||
? windowMap[selectedWindow]?.setMaxSize(
|
|
||||||
new LogicalSize(maxWidth, maxHeight)
|
|
||||||
)
|
|
||||||
: windowMap[selectedWindow]?.setMaxSize(null);
|
|
||||||
$: x !== null &&
|
|
||||||
y !== null &&
|
|
||||||
windowMap[selectedWindow]?.setPosition(new PhysicalPosition(x, y));
|
|
||||||
$: windowMap[selectedWindow]
|
|
||||||
?.scaleFactor()
|
|
||||||
.then((factor) => (scaleFactor = factor));
|
|
||||||
$: addWindowEventListeners(windowMap[selectedWindow]);
|
|
||||||
|
|
||||||
$: windowMap[selectedWindow]?.setCursorGrab(cursorGrab);
|
|
||||||
$: windowMap[selectedWindow]?.setCursorVisible(cursorVisible);
|
|
||||||
$: windowMap[selectedWindow]?.setCursorIcon(cursorIcon);
|
|
||||||
$: cursorX !== null &&
|
|
||||||
cursorY !== null &&
|
|
||||||
windowMap[selectedWindow]?.setCursorPosition(
|
|
||||||
new PhysicalPosition(cursorX, cursorY)
|
|
||||||
);
|
|
||||||
$: windowMap[selectedWindow]?.setIgnoreCursorEvents(cursorIgnoreEvents);
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<div class="flex flex-col children:grow gap-2">
|
|
||||||
<div class="flex gap-1">
|
|
||||||
<input
|
|
||||||
class="input grow"
|
|
||||||
type="text"
|
|
||||||
placeholder="New Window label.."
|
|
||||||
bind:value={newWindowLabel}
|
|
||||||
/>
|
|
||||||
<button class="btn" on:click={createWindow}>New window</button>
|
|
||||||
</div>
|
|
||||||
<br />
|
|
||||||
{#if Object.keys(windowMap).length >= 1}
|
|
||||||
<span class="font-700 text-sm">Selected window:</span>
|
|
||||||
<select class="input" bind:value={selectedWindow}>
|
|
||||||
<option value="" disabled selected>Choose a window...</option>
|
|
||||||
{#each Object.keys(windowMap) as label}
|
|
||||||
<option value={label}>{label}</option>
|
|
||||||
{/each}
|
|
||||||
</select>
|
|
||||||
{/if}
|
|
||||||
{#if windowMap[selectedWindow]}
|
|
||||||
<br />
|
|
||||||
<div class="flex flex-wrap gap-2">
|
|
||||||
<button
|
|
||||||
class="btn"
|
|
||||||
title="Unminimizes after 2 seconds"
|
|
||||||
on:click={() => windowMap[selectedWindow].center()}
|
|
||||||
>
|
|
||||||
Center
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
class="btn"
|
|
||||||
title="Unminimizes after 2 seconds"
|
|
||||||
on:click={minimize_}
|
|
||||||
>
|
|
||||||
Minimize
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
class="btn"
|
|
||||||
title="Visible again after 2 seconds"
|
|
||||||
on:click={hide_}
|
|
||||||
>
|
|
||||||
Hide
|
|
||||||
</button>
|
|
||||||
<button class="btn" on:click={getIcon}> Change icon </button>
|
|
||||||
<button
|
|
||||||
class="btn"
|
|
||||||
on:click={requestUserAttention_}
|
|
||||||
title="Minimizes the window, requests attention for 3s and then resets it"
|
|
||||||
>Request attention</button
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
<br />
|
|
||||||
<div class="flex flex-wrap gap-2">
|
|
||||||
<label>
|
|
||||||
Maximized
|
|
||||||
<input type="checkbox" bind:checked={maximized} />
|
|
||||||
</label>
|
|
||||||
<label>
|
|
||||||
Resizable
|
|
||||||
<input type="checkbox" bind:checked={resizable} />
|
|
||||||
</label>
|
|
||||||
<label>
|
|
||||||
Maximizable
|
|
||||||
<input type="checkbox" bind:checked={maximizable} />
|
|
||||||
</label>
|
|
||||||
<label>
|
|
||||||
Minimizable
|
|
||||||
<input type="checkbox" bind:checked={minimizable} />
|
|
||||||
</label>
|
|
||||||
<label>
|
|
||||||
Closable
|
|
||||||
<input type="checkbox" bind:checked={closable} />
|
|
||||||
</label>
|
|
||||||
<label>
|
|
||||||
Has decorations
|
|
||||||
<input type="checkbox" bind:checked={decorations} />
|
|
||||||
</label>
|
|
||||||
<label>
|
|
||||||
Always on top
|
|
||||||
<input type="checkbox" bind:checked={alwaysOnTop} />
|
|
||||||
</label>
|
|
||||||
<label>
|
|
||||||
Content protected
|
|
||||||
<input type="checkbox" bind:checked={contentProtected} />
|
|
||||||
</label>
|
|
||||||
<label>
|
|
||||||
Fullscreen
|
|
||||||
<input type="checkbox" bind:checked={fullscreen} />
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<br />
|
|
||||||
<div class="flex flex-row gap-2 flex-wrap">
|
|
||||||
<div class="flex children:grow flex-col">
|
|
||||||
<div>
|
|
||||||
X
|
|
||||||
<input class="input" type="number" bind:value={x} min="0" />
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
Y
|
|
||||||
<input class="input" type="number" bind:value={y} min="0" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex children:grow flex-col">
|
|
||||||
<div>
|
|
||||||
Width
|
|
||||||
<input class="input" type="number" bind:value={width} min="400" />
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
Height
|
|
||||||
<input class="input" type="number" bind:value={height} min="400" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex children:grow flex-col">
|
|
||||||
<div>
|
|
||||||
Min width
|
|
||||||
<input class="input" type="number" bind:value={minWidth} />
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
Min height
|
|
||||||
<input class="input" type="number" bind:value={minHeight} />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex children:grow flex-col">
|
|
||||||
<div>
|
|
||||||
Max width
|
|
||||||
<input class="input" type="number" bind:value={maxWidth} min="800" />
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
Max height
|
|
||||||
<input class="input" type="number" bind:value={maxHeight} min="400" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<br />
|
|
||||||
<div>
|
|
||||||
<div class="flex">
|
|
||||||
<div class="grow">
|
|
||||||
<div class="text-accent dark:text-darkAccent font-700">
|
|
||||||
Inner Size
|
|
||||||
</div>
|
|
||||||
<span>Width: {innerSize.width}</span>
|
|
||||||
<span>Height: {innerSize.height}</span>
|
|
||||||
</div>
|
|
||||||
<div class="grow">
|
|
||||||
<div class="text-accent dark:text-darkAccent font-700">
|
|
||||||
Outer Size
|
|
||||||
</div>
|
|
||||||
<span>Width: {outerSize.width}</span>
|
|
||||||
<span>Height: {outerSize.height}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="flex">
|
|
||||||
<div class="grow">
|
|
||||||
<div class="text-accent dark:text-darkAccent font-700">
|
|
||||||
Inner Logical Size
|
|
||||||
</div>
|
|
||||||
<span>Width: {innerSize.toLogical(scaleFactor).width}</span>
|
|
||||||
<span>Height: {innerSize.toLogical(scaleFactor).height}</span>
|
|
||||||
</div>
|
|
||||||
<div class="grow">
|
|
||||||
<div class="text-accent dark:text-darkAccent font-700">
|
|
||||||
Outer Logical Size
|
|
||||||
</div>
|
|
||||||
<span>Width: {outerSize.toLogical(scaleFactor).width}</span>
|
|
||||||
<span>Height: {outerSize.toLogical(scaleFactor).height}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="flex">
|
|
||||||
<div class="grow">
|
|
||||||
<div class="text-accent dark:text-darkAccent font-700">
|
|
||||||
Inner Position
|
|
||||||
</div>
|
|
||||||
<span>x: {innerPosition.x}</span>
|
|
||||||
<span>y: {innerPosition.y}</span>
|
|
||||||
</div>
|
|
||||||
<div class="grow">
|
|
||||||
<div class="text-accent dark:text-darkAccent font-700">
|
|
||||||
Outer Position
|
|
||||||
</div>
|
|
||||||
<span>x: {outerPosition.x}</span>
|
|
||||||
<span>y: {outerPosition.y}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="flex">
|
|
||||||
<div class="grow">
|
|
||||||
<div class="text-accent dark:text-darkAccent font-700">
|
|
||||||
Inner Logical Position
|
|
||||||
</div>
|
|
||||||
<span>x: {innerPosition.toLogical(scaleFactor).x}</span>
|
|
||||||
<span>y: {innerPosition.toLogical(scaleFactor).y}</span>
|
|
||||||
</div>
|
|
||||||
<div class="grow">
|
|
||||||
<div class="text-accent dark:text-darkAccent font-700">
|
|
||||||
Outer Logical Position
|
|
||||||
</div>
|
|
||||||
<span>x: {outerPosition.toLogical(scaleFactor).x}</span>
|
|
||||||
<span>y: {outerPosition.toLogical(scaleFactor).y}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<br />
|
|
||||||
<h4 class="mb-2">Cursor</h4>
|
|
||||||
<div class="flex gap-2">
|
|
||||||
<label>
|
|
||||||
<input type="checkbox" bind:checked={cursorGrab} />
|
|
||||||
Grab
|
|
||||||
</label>
|
|
||||||
<label>
|
|
||||||
<input type="checkbox" bind:checked={cursorVisible} />
|
|
||||||
Visible
|
|
||||||
</label>
|
|
||||||
<label>
|
|
||||||
<input type="checkbox" bind:checked={cursorIgnoreEvents} />
|
|
||||||
Ignore events
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<div class="flex gap-2">
|
|
||||||
<label>
|
|
||||||
Icon
|
|
||||||
<select class="input" bind:value={cursorIcon}>
|
|
||||||
{#each cursorIconOptions as kind}
|
|
||||||
<option value={kind}>{kind}</option>
|
|
||||||
{/each}
|
|
||||||
</select>
|
|
||||||
</label>
|
|
||||||
<label>
|
|
||||||
X position
|
|
||||||
<input class="input" type="number" bind:value={cursorX} />
|
|
||||||
</label>
|
|
||||||
<label>
|
|
||||||
Y position
|
|
||||||
<input class="input" type="number" bind:value={cursorY} />
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<br />
|
|
||||||
<div class="flex flex-col gap-1">
|
|
||||||
<form class="flex gap-1" on:submit|preventDefault={setTitle_}>
|
|
||||||
<input class="input grow" id="title" bind:value={windowTitle} />
|
|
||||||
<button class="btn" type="submit">Set title</button>
|
|
||||||
</form>
|
|
||||||
<form class="flex gap-1" on:submit|preventDefault={openUrl}>
|
|
||||||
<input class="input grow" id="url" bind:value={urlValue} />
|
|
||||||
<button class="btn" id="open-url"> Open URL </button>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<br />
|
|
||||||
|
|
||||||
{#if isWindows || isMacOS}
|
|
||||||
<div class="flex flex-col gap-1">
|
|
||||||
<div class="flex">
|
|
||||||
<label>
|
|
||||||
Effect
|
|
||||||
<select class="input" bind:value={selectedEffect}>
|
|
||||||
{#each effectOptions as effect}
|
|
||||||
<option value={effect}>{effect}</option>
|
|
||||||
{/each}
|
|
||||||
</select>
|
|
||||||
</label>
|
|
||||||
|
|
||||||
<label>
|
|
||||||
State
|
|
||||||
<select class="input" bind:value={effectState}>
|
|
||||||
{#each effectStateOptions as state}
|
|
||||||
<option value={state}>{state}</option>
|
|
||||||
{/each}
|
|
||||||
</select>
|
|
||||||
</label>
|
|
||||||
|
|
||||||
<label>
|
|
||||||
Radius
|
|
||||||
<input class="input" type="number" bind:value={effectRadius} />
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex">
|
|
||||||
<label>
|
|
||||||
Color
|
|
||||||
<div class="flex">
|
|
||||||
<input
|
|
||||||
style="max-width: 120px;"
|
|
||||||
class="input"
|
|
||||||
type="number"
|
|
||||||
placeholder="R"
|
|
||||||
bind:value={effectR}
|
|
||||||
/>
|
|
||||||
<input
|
|
||||||
style="max-width: 120px;"
|
|
||||||
class="input"
|
|
||||||
type="number"
|
|
||||||
placeholder="G"
|
|
||||||
bind:value={effectG}
|
|
||||||
/>
|
|
||||||
<input
|
|
||||||
style="max-width: 120px;"
|
|
||||||
class="input"
|
|
||||||
type="number"
|
|
||||||
placeholder="B"
|
|
||||||
bind:value={effectB}
|
|
||||||
/>
|
|
||||||
<input
|
|
||||||
style="max-width: 120px;"
|
|
||||||
class="input"
|
|
||||||
type="number"
|
|
||||||
placeholder="A"
|
|
||||||
bind:value={effectA}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex">
|
|
||||||
<button class="btn" style="width: 80px;" on:click={addEffect}
|
|
||||||
>Add</button
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex">
|
|
||||||
<div>
|
|
||||||
Applied effects: {effects.length ? effects.join(",") : "None"}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<button class="btn" style="width: 80px;" on:click={clearEffects}
|
|
||||||
>Clear</button
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
{/if}
|
|
||||||
</div>
|
|
@ -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!
|
|
@ -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 }
|
|
@ -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: <text>Tauri is a rust project that enables developers to make secure
|
|
||||||
and small desktop applications using a web frontend.
|
|
||||||
</text>
|
|
||||||
PackageComment: <text>The package includes the following libraries; see
|
|
||||||
Relationship information.
|
|
||||||
</text>
|
|
||||||
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
|
|
@ -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
|
|
@ -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.
|
|
@ -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.
|
|
Before Width: | Height: | Size: 59 KiB |
@ -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__: <T>(cmd: string, args?: unknown) => Promise<T>;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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<string> {
|
|
||||||
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<string> {
|
|
||||||
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<string> {
|
|
||||||
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<void> {
|
|
||||||
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<void> {
|
|
||||||
return window.__TAURI_INVOKE__("plugin:app|hide");
|
|
||||||
}
|
|
||||||
|
|
||||||
export { getName, getVersion, getTauriVersion, show, hide };
|
|
@ -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"
|
|
||||||
}
|
|
||||||
}
|
|
@ -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/],
|
|
||||||
});
|
|
@ -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__})}
|
|
@ -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<R: Runtime>(app: AppHandle<R>) -> String {
|
|
||||||
app.package_info().version.to_string()
|
|
||||||
}
|
|
||||||
|
|
||||||
#[tauri::command]
|
|
||||||
pub fn name<R: Runtime>(app: AppHandle<R>) -> String {
|
|
||||||
app.package_info().name.clone()
|
|
||||||
}
|
|
||||||
|
|
||||||
#[tauri::command]
|
|
||||||
pub fn tauri_version() -> &'static str {
|
|
||||||
tauri::VERSION
|
|
||||||
}
|
|
||||||
|
|
||||||
#[tauri::command]
|
|
||||||
#[allow(unused_variables)]
|
|
||||||
pub fn show<R: Runtime>(app: AppHandle<R>) -> tauri::Result<()> {
|
|
||||||
#[cfg(target_os = "macos")]
|
|
||||||
app.show()?;
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
#[tauri::command]
|
|
||||||
#[allow(unused_variables)]
|
|
||||||
pub fn hide<R: Runtime>(app: AppHandle<R>) -> tauri::Result<()> {
|
|
||||||
#[cfg(target_os = "macos")]
|
|
||||||
app.hide()?;
|
|
||||||
Ok(())
|
|
||||||
}
|
|
@ -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<R: Runtime>() -> TauriPlugin<R> {
|
|
||||||
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()
|
|
||||||
}
|
|
@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": "../../tsconfig.base.json",
|
|
||||||
"include": ["guest-js/*.ts"]
|
|
||||||
}
|
|
@ -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!
|
|
@ -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 = [ ]
|
|
@ -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: <text>Tauri is a rust project that enables developers to make secure
|
|
||||||
and small desktop applications using a web frontend.
|
|
||||||
</text>
|
|
||||||
PackageComment: <text>The package includes the following libraries; see
|
|
||||||
Relationship information.
|
|
||||||
</text>
|
|
||||||
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
|
|
@ -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
|
|
@ -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.
|
|
@ -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.
|
|
Before Width: | Height: | Size: 57 KiB |
@ -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}");
|
|
||||||
}
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
@ -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"
|
|
||||||
}
|
|
||||||
}
|
|
@ -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/],
|
|
||||||
});
|
|
File diff suppressed because one or more lines are too long
@ -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<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
|
|
||||||
where
|
|
||||||
S: Serializer,
|
|
||||||
{
|
|
||||||
serializer.serialize_str(self.to_string().as_ref())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
type Result<T> = std::result::Result<T, Error>;
|
|
||||||
|
|
||||||
#[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<u8>),
|
|
||||||
Rgba {
|
|
||||||
rgba: Vec<u8>,
|
|
||||||
width: u32,
|
|
||||||
height: u32,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<IconDto> 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<R: Runtime>(app: AppHandle<R>, options: WindowConfig) -> Result<()> {
|
|
||||||
tauri::window::WindowBuilder::from_config(&app, options).build()?;
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn get_window<R: Runtime>(window: Window<R>, label: Option<String>) -> Result<Window<R>> {
|
|
||||||
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<R: Runtime>(window: Window<R>, label: Option<String>) -> Result<$ret> {
|
|
||||||
get_window(window, label)?.$cmd().map_err(Into::into)
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
macro_rules! setter {
|
|
||||||
($cmd: ident) => {
|
|
||||||
#[tauri::command]
|
|
||||||
pub async fn $cmd<R: Runtime>(window: Window<R>, label: Option<String>) -> Result<()> {
|
|
||||||
get_window(window, label)?.$cmd().map_err(Into::into)
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
($cmd: ident, $input: ty) => {
|
|
||||||
#[tauri::command]
|
|
||||||
pub async fn $cmd<R: Runtime>(
|
|
||||||
window: Window<R>,
|
|
||||||
label: Option<String>,
|
|
||||||
value: $input,
|
|
||||||
) -> Result<()> {
|
|
||||||
get_window(window, label)?.$cmd(value).map_err(Into::into)
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
getter!(scale_factor, f64);
|
|
||||||
getter!(inner_position, PhysicalPosition<i32>);
|
|
||||||
getter!(outer_position, PhysicalPosition<i32>);
|
|
||||||
getter!(inner_size, PhysicalSize<u32>);
|
|
||||||
getter!(outer_size, PhysicalSize<u32>);
|
|
||||||
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<Monitor>);
|
|
||||||
getter!(primary_monitor, Option<Monitor>);
|
|
||||||
getter!(available_monitors, Vec<Monitor>);
|
|
||||||
getter!(theme, Theme);
|
|
||||||
|
|
||||||
setter!(center);
|
|
||||||
setter!(request_user_attention, Option<UserAttentionType>);
|
|
||||||
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<WindowEffectsConfig>);
|
|
||||||
setter!(set_always_on_top, bool);
|
|
||||||
setter!(set_content_protected, bool);
|
|
||||||
setter!(set_size, Size);
|
|
||||||
setter!(set_min_size, Option<Size>);
|
|
||||||
setter!(set_max_size, Option<Size>);
|
|
||||||
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<R: Runtime>(
|
|
||||||
window: Window<R>,
|
|
||||||
label: Option<String>,
|
|
||||||
value: IconDto,
|
|
||||||
) -> Result<()> {
|
|
||||||
get_window(window, label)?
|
|
||||||
.set_icon(value.into())
|
|
||||||
.map_err(Into::into)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[tauri::command]
|
|
||||||
pub async fn toggle_maximize<R: Runtime>(window: Window<R>, label: Option<String>) -> 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<R: Runtime>(
|
|
||||||
window: Window<R>,
|
|
||||||
label: Option<String>,
|
|
||||||
) -> 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<R: Runtime>(
|
|
||||||
window: Window<R>,
|
|
||||||
label: Option<String>,
|
|
||||||
) -> Result<()> {
|
|
||||||
let window = get_window(window, label)?;
|
|
||||||
if window.is_devtools_open() {
|
|
||||||
window.close_devtools();
|
|
||||||
} else {
|
|
||||||
window.open_devtools();
|
|
||||||
}
|
|
||||||
Ok(())
|
|
||||||
}
|
|
@ -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<R: Runtime>() -> TauriPlugin<R> {
|
|
||||||
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<dyn Fn(tauri::ipc::Invoke<R>) -> 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()
|
|
||||||
}
|
|
@ -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);
|
|
||||||
}
|
|
||||||
});
|
|
@ -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");
|
|
||||||
};
|
|
@ -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);
|
|
||||||
}
|
|
||||||
})();
|
|
@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": "../../tsconfig.base.json",
|
|
||||||
"include": ["guest-js/*.ts"]
|
|
||||||
}
|
|
Loading…
Reference in new issue