Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
amrbashir committed May 23, 2023
1 parent d87a775 commit b68afe5
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 19 deletions.
10 changes: 5 additions & 5 deletions core/tauri-config-schema/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@
"type": "boolean"
},
"windowEffects": {
"description": "Window effects",
"description": "Window effects\n\nRequires the window to be transparent\n\n## Platform-specific:\n\n- **Windows**: If using decorations or shadows, you may want to try this workaround https://github.com/tauri-apps/tao/issues/72#issuecomment-975607891 - **Linux**: Unsupported",
"anyOf": [
{
"$ref": "#/definitions/WindowEffectsConfig"
Expand Down Expand Up @@ -765,7 +765,7 @@
]
},
{
"description": "**Windows 10/11**\n\n## Notes\n\nThis effect has bad performance when resizing/dragging the window on Windows 10 v1903+ and Windows 11 build 22000.",
"description": "**Windows 10/11 Only**\n\n## Notes\n\nThis effect has bad performance when resizing/dragging the window on Windows 10 v1903+ and Windows 11 build 22000.",
"type": "string",
"enum": [
"acrylic"
Expand All @@ -777,21 +777,21 @@
"description": "Window effect state **macOS only**\n\n<https://developer.apple.com/documentation/appkit/nsvisualeffectview/state>",
"oneOf": [
{
"description": "Make window effect state follow the window's active state **macOS only**",
"description": "Make window effect state follow the window's active state",
"type": "string",
"enum": [
"followsWindowActiveState"
]
},
{
"description": "Make window effect state always active **macOS only**",
"description": "Make window effect state always active",
"type": "string",
"enum": [
"active"
]
},
{
"description": "Make window effect state always inactive **macOS only**",
"description": "Make window effect state always inactive",
"type": "string",
"enum": [
"inactive"
Expand Down
7 changes: 7 additions & 0 deletions core/tauri-utils/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -889,6 +889,13 @@ pub struct WindowConfig {
#[serde(default = "default_true")]
pub shadow: bool,
/// Window effects
///
/// Requires the window to be transparent
///
/// ## Platform-specific:
///
/// - **Windows**: If using decorations or shadows, you may want to try this workaround https://github.com/tauri-apps/tao/issues/72#issuecomment-975607891
/// - **Linux**: Unsupported
#[serde(default, alias = "window-effects")]
pub window_effects: Option<WindowEffectsConfig>,
}
Expand Down
8 changes: 4 additions & 4 deletions core/tauri-utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ mod window_effects {
///
/// This effect has bad performance when resizing/dragging the window on Windows 11 build 22621.
Blur,
/// **Windows 10/11**
/// **Windows 10/11 Only**
///
/// ## Notes
///
Expand All @@ -134,11 +134,11 @@ mod window_effects {
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
#[serde(rename_all = "camelCase")]
pub enum WindowEffectState {
/// Make window effect state follow the window's active state **macOS only**
/// Make window effect state follow the window's active state
FollowsWindowActiveState,
/// Make window effect state always active **macOS only**
/// Make window effect state always active
Active,
/// Make window effect state always inactive **macOS only**
/// Make window effect state always inactive
Inactive,
}
}
Expand Down
19 changes: 14 additions & 5 deletions core/tauri/src/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,14 @@ impl<'a, R: Runtime> WindowBuilder<'a, R> {
}

/// Sets window effects
pub fn window_effects(mut self, effects: WindowEffectsConfig) -> Self {
///
/// Requires the window to be transparent
///
/// ## Platform-specific:
///
/// - **Windows**: If using decorations or shadows, you may want to try this workaround https://github.com/tauri-apps/tao/issues/72#issuecomment-975607891
/// - **Linux**: Unsupported
pub fn effects(mut self, effects: WindowEffectsConfig) -> Self {
self.webview_attributes = self.webview_attributes.window_effects(effects);
self
}
Expand Down Expand Up @@ -1316,11 +1323,8 @@ impl<R: Runtime> Window<R> {
}

/// Sets window effects, pass `None` to clear any effects applied if possible.
/// Note that the window must be transparent.
///
/// ## Platform-specific
///
/// - **Linux**: Not supported.
/// Requires the window to be transparent
///
/// ```rust,no_run
/// use tauri::{Manager, window::{Color, Effect, EffectState, EffectsBuilder}};
Expand All @@ -1338,6 +1342,11 @@ impl<R: Runtime> Window<R> {
/// Ok(())
/// });
/// ```
///
/// ## Platform-specific:
///
/// - **Windows**: If using decorations or shadows, you may want to try this workaround https://github.com/tauri-apps/tao/issues/72#issuecomment-975607891
/// - **Linux**: Unsupported
pub fn set_effects<E: Into<Option<WindowEffectsConfig>>>(&self, effects: E) -> crate::Result<()> {
let effects = effects.into();
let window = self.clone();
Expand Down
10 changes: 5 additions & 5 deletions tooling/cli/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@
"type": "boolean"
},
"windowEffects": {
"description": "Window effects",
"description": "Window effects\n\nRequires the window to be transparent\n\n## Platform-specific:\n\n- **Windows**: If using decorations or shadows, you may want to try this workaround https://github.com/tauri-apps/tao/issues/72#issuecomment-975607891 - **Linux**: Unsupported",
"anyOf": [
{
"$ref": "#/definitions/WindowEffectsConfig"
Expand Down Expand Up @@ -765,7 +765,7 @@
]
},
{
"description": "**Windows 10/11**\n\n## Notes\n\nThis effect has bad performance when resizing/dragging the window on Windows 10 v1903+ and Windows 11 build 22000.",
"description": "**Windows 10/11 Only**\n\n## Notes\n\nThis effect has bad performance when resizing/dragging the window on Windows 10 v1903+ and Windows 11 build 22000.",
"type": "string",
"enum": [
"acrylic"
Expand All @@ -777,21 +777,21 @@
"description": "Window effect state **macOS only**\n\n<https://developer.apple.com/documentation/appkit/nsvisualeffectview/state>",
"oneOf": [
{
"description": "Make window effect state follow the window's active state **macOS only**",
"description": "Make window effect state follow the window's active state",
"type": "string",
"enum": [
"followsWindowActiveState"
]
},
{
"description": "Make window effect state always active **macOS only**",
"description": "Make window effect state always active",
"type": "string",
"enum": [
"active"
]
},
{
"description": "Make window effect state always inactive **macOS only**",
"description": "Make window effect state always inactive",
"type": "string",
"enum": [
"inactive"
Expand Down

0 comments on commit b68afe5

Please sign in to comment.