Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core): Ability to disable minimize/maximize/close native window's buttons, closes #2353 #6665

Merged
merged 30 commits into from
May 24, 2023
Merged
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
963bae8
feat(core): expose maximizability/minimizability/closability to windo…
TDiblik Apr 8, 2023
6c43a48
feat(utils): ability to set button states from tauri.conf.json
TDiblik Apr 8, 2023
58f60d6
chore: summarize changes
TDiblik Apr 8, 2023
07491f8
chore: docs
TDiblik Apr 8, 2023
3028b5e
chore: add generated schemas
TDiblik Apr 8, 2023
b1371bc
chore: docs
TDiblik Apr 8, 2023
58d0394
chore(core): make comments consistent
TDiblik Apr 11, 2023
45820bc
feat(core/api): Expose new api for typescript and config features
TDiblik Apr 11, 2023
1d72277
chore: docs
TDiblik Apr 11, 2023
3ef3365
chore(core/api): add generated schemas
TDiblik Apr 11, 2023
79e2d56
chore(meta): update changes to reflect current state
TDiblik Apr 11, 2023
dcc5aa1
chore(core/api): add generated files
TDiblik Apr 11, 2023
46f0f56
fix(ci)
TDiblik Apr 14, 2023
1916c96
chore(docs): Add platform specific documentation
TDiblik Apr 14, 2023
e7e9da2
chore(tooling): Rename/Remove params inside docs that don't match fun…
TDiblik Apr 14, 2023
22a2726
chore(core/api) add generated files
TDiblik Apr 14, 2023
e02e195
chore(api): formatting
TDiblik Apr 14, 2023
a3efd51
chore(api): formatting
TDiblik Apr 14, 2023
5cf766d
chore(api): formatting
TDiblik Apr 14, 2023
8c45842
chore(api): formatting
TDiblik Apr 14, 2023
fe8f77f
chore(api): formatting
TDiblik Apr 14, 2023
2f72907
chore(api): formatting
TDiblik Apr 14, 2023
51697f0
docs(core): Insert platform specific comments instead of linking
TDiblik Apr 14, 2023
4801768
docs(core): Insert platform specific comments instead of linking
TDiblik Apr 14, 2023
e4e6bda
chore(tooling): Add more info to configuration docs
TDiblik Apr 16, 2023
1ffdf28
Merge remote-tracking branch 'origin/dev' into feature/2353-set-title…
lucasfernog May 24, 2023
0bab7b6
split change files
lucasfernog May 24, 2023
4e0acca
update docs
lucasfernog May 24, 2023
ff48bbb
fix covector
lucasfernog May 24, 2023
9e8386b
update api example
lucasfernog May 24, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: docs
TDiblik committed Apr 11, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 1d722779902180ad79193e8b46dc8ff917a7364d
6 changes: 3 additions & 3 deletions core/tauri-utils/src/config.rs
Original file line number Diff line number Diff line change
@@ -1428,13 +1428,13 @@ pub struct WindowAllowlistConfig {
/// Allows setting the resizable flag of the window.
#[serde(default, alias = "set-resizable")]
pub set_resizable: bool,
/// Allows setting the maximizable flag of the window.
/// Allows setting whether the window's native maximize button is enabled or not.
#[serde(default, alias = "set-maximizable")]
pub set_maximizable: bool,
/// Allows setting the minimizable flag of the window.
/// Allows setting whether the window's native minimize button is enabled or not.
#[serde(default, alias = "set-minimizable")]
pub set_minimizable: bool,
/// Allows setting the closable flag of the window.
/// Allows setting whether the window's native close button is enabled or not.
#[serde(default, alias = "set-closable")]
pub set_closable: bool,
/// Allows changing the window title.
64 changes: 64 additions & 0 deletions tooling/api/src/window.ts
Original file line number Diff line number Diff line change
@@ -686,6 +686,16 @@ class WindowManager extends WebviewWindowHandle {
})
}

/**
* Gets the window’s native maximize button state.
* @example
* ```typescript
* import { appWindow } from '@tauri-apps/api/window';
* const maximizable = await appWindow.isMaximizable();
* ```
*
* @returns Whether the window's native maximize button is enabled or not.
* */
async isMaximizable(): Promise<boolean> {
return invokeTauriCommand({
__tauriModule: 'Window',
@@ -701,6 +711,16 @@ class WindowManager extends WebviewWindowHandle {
})
}

/**
* Gets the window’s native minimize button state.
* @example
* ```typescript
* import { appWindow } from '@tauri-apps/api/window';
* const minimizable = await appWindow.isMinimizable();
* ```
*
* @returns Whether the window's native minimize button is enabled or not.
* */
async isMinimizable(): Promise<boolean> {
return invokeTauriCommand({
__tauriModule: 'Window',
@@ -716,6 +736,16 @@ class WindowManager extends WebviewWindowHandle {
})
}

/**
* Gets the window’s native close button state.
* @example
* ```typescript
* import { appWindow } from '@tauri-apps/api/window';
* const closable = await appWindow.isClosable();
* ```
*
* @returns Whether the window's native close button is enabled or not.
* */
async isClosable(): Promise<boolean> {
return invokeTauriCommand({
__tauriModule: 'Window',
@@ -913,6 +943,18 @@ class WindowManager extends WebviewWindowHandle {
})
}

/**
* Sets whether the window's native maximize button is enabled or not.
* If resizable is set to false, this setting is ignored.
* @example
* ```typescript
* import { appWindow } from '@tauri-apps/api/window';
* await appWindow.setMaximizable(false);
* ```
*
* @param maximizable
* @returns A promise indicating the success or failure of the operation.
*/
async setMaximizable(maximizable: boolean): Promise<void> {
return invokeTauriCommand({
__tauriModule: 'Window',
@@ -929,6 +971,17 @@ class WindowManager extends WebviewWindowHandle {
})
}

/**
* Sets whether the window's native minimize button is enabled or not.
* @example
* ```typescript
* import { appWindow } from '@tauri-apps/api/window';
* await appWindow.setMinimizable(false);
* ```
*
* @param minimizable
* @returns A promise indicating the success or failure of the operation.
*/
async setMinimizable(minimizable: boolean): Promise<void> {
return invokeTauriCommand({
__tauriModule: 'Window',
@@ -945,6 +998,17 @@ class WindowManager extends WebviewWindowHandle {
})
}

/**
* Sets whether the window's native close button is enabled or not.
* @example
* ```typescript
* import { appWindow } from '@tauri-apps/api/window';
* await appWindow.setClosable(false);
* ```
*
* @param closable
* @returns A promise indicating the success or failure of the operation.
*/
async setClosable(closable: boolean): Promise<void> {
return invokeTauriCommand({
__tauriModule: 'Window',