Tauri (Part - Get the window configuration right first
Preface
When developing desktop applications, understanding and correctly configuring window parameters is crucial. It helps streamline functionality and optimize the user experience.
The following content is based on the Tauri 2 official documentation and provides a detailed description of WindowConfig configuration parameters, including their functionality, default values, and applicability.
Basic Window Behaviors
Parameter | Type | Description | Default Value |
---|---|---|---|
acceptFirstMouse | boolean | Whether the first mouse event is accepted by the window (macOS only). | false |
alwaysOnBottom | boolean | Whether the window is always placed below other windows. | false |
alwaysOnTop | boolean | Whether the window is always placed above other windows. | false |
backgroundColor | string | Background color of the window (in hexadecimal format). | No default value |
center | boolean | Whether the window is centered on the screen. | false |
closable | boolean | Whether the window can be closed. | true |
contentProtected | boolean | Protects window content from being captured or recorded (partial support). | false |
decorations | boolean | Whether to display window decorations (such as the title bar and borders). | true |
dragDropEnabled | boolean | Whether drag-and-drop functionality is enabled. | true |
focus | boolean | Whether the window gets focus when launched. | true |
fullscreen | boolean | Whether the window starts in fullscreen mode. | false |
hiddenTitle | boolean | Hides the title bar (macOS only). | false |
incognito | boolean | Enables incognito mode to prevent data tracking. | false |
label | string | Unique identifier for the window (required). | No default value |
maximizable | boolean | Whether the window can be maximized. | true |
maximized | boolean | Whether the window starts maximized. | false |
minimizable | boolean | Whether the window can be minimized. | true |
resizable | boolean | Whether the window size can be adjusted. | true |
skipTaskbar | boolean | Hides the window from the taskbar (platform-dependent). | false |
tabbingIdentifier | string | Identifier for grouping windows (macOS only). | No default value |
theme | "light" or "dark" | Default theme of the window, partially supported. | System default |
title | string | Title of the window. | "Tauri App" |
titleBarStyle | string | Style of the title bar (platform-dependent, such as macOS). | Default style |
transparent | boolean | Enables transparency for the window (partial support). | false |
userAgent | string | Custom User-Agent for the window. | No default value |
visible | boolean | Whether the window is visible. | true |
visibleOnAllWorkspaces | boolean | Makes the window visible on all workspaces (macOS only). | false |
windowClassname | string | Custom window class name (Windows only). | No default value |
zoomHotkeysEnabled | boolean | Enables zoom hotkeys for the window. | true |
Dimensions and Positioning
Parameter | Type | Description | Default Value |
---|---|---|---|
width | number | Initial width of the window (in pixels). | 800 |
height | number | Initial height of the window (in pixels). | 600 |
minWidth | number | Minimum width of the window (in pixels). | No default value |
minHeight | number | Minimum height of the window (in pixels). | No default value |
maxWidth | number | Maximum width of the window (in pixels). | No default value |
maxHeight | number | Maximum height of the window (in pixels). | No default value |
x | number | Initial X-axis position of the window (from screen top-left). | Centered |
y | number | Initial Y-axis position of the window (from screen top-left). | Centered |
Browser Features
Parameter | Type | Description | Default Value |
---|---|---|---|
additionalBrowserArgs | string | Additional command-line arguments for the browser. | No default value |
browserExtensionsEnabled | boolean | Enables support for browser extensions. | false |
proxyUrl | string | Custom proxy URL. | No default value |
useHttpsScheme | boolean | Forces the use of HTTPS. | false |
Window Effects
Parameter | Type | Description | Default Value |
---|---|---|---|
shadow | boolean | Whether the window shows a shadow (platform-dependent). | true |
windowEffects | string | Custom window effects (e.g., blur, transparency). | No default value |
JSON Configuration Example
src-tauri/tauri.conf.json
{ "$schema": "https://schema.tauri.app/config/2.0.0", "productName": "Coco AI", "version": "0.1.0", "identifier": "rs.coco.app", "build": { "beforeDevCommand": "pnpm dev", "devUrl": "http://localhost:1420", "beforeBuildCommand": "pnpm build", "frontendDist": "../dist" }, "app": { "macOSPrivateApi": true, "windows": [ { "acceptFirstMouse": false, // Whether the first mouse event is accepted "additionalBrowserArgs": "", // Additional arguments passed to the browser "alwaysOnBottom": false, // Whether the window always stays at the bottom "alwaysOnTop": false, // Whether the window always stays on top "backgroundColor": "#ffffff", // Background color of the window (default is white) "browserExtensionsEnabled": false, // Whether browser extensions are enabled "center": true, // Whether the window is centered "closable": true, // Whether the window can be closed "contentProtected": false, // Whether content protection is enabled (prevents screenshots) "create": true, // Whether to display the window when created "decorations": true, // Whether to display window decorations "devtools": false, // Whether developer tools are enabled (disabled by default in production) "dragDropEnabled": true, // Whether drag-and-drop functionality is enabled "focus": true, // Whether the window is focused "fullscreen": false, // Whether the window is in fullscreen mode "height": 600, // Window height (default 600px) "hiddenTitle": false, // Whether the window title bar is hidden "incognito": false, // Whether incognito mode is enabled "label": "main", // Unique label (identifier) of the window "maxHeight": null, // Maximum height of the window (default is unlimited) "maximizable": true, // Whether the window can be maximized "maximized": false, // Whether the window is maximized by default "maxWidth": null, // Maximum width of the window (default is unlimited) "minHeight": 300, // Minimum height of the window (default 300px) "minimizable": true, // Whether the window can be minimized "minWidth": 300, // Minimum width of the window (default 300px) "parent": null, // Parent window (default is none) "proxyUrl": "", // Proxy URL "resizable": true, // Whether the window is resizable "shadow": true, // Whether the window shadow is displayed "skipTaskbar": false, // Whether to skip showing the window in the taskbar "tabbingIdentifier": null, // Identifier for grouping windows "theme": "light", // Window theme (default is light) "title": "Tauri App", // Window title "titleBarStyle": "default", // Title bar style "transparent": false, // Whether the window is transparent "url": "/", // Default URL of the window "useHttpsScheme": false, // Whether to enforce HTTPS "userAgent": null, // Custom user agent (default is null) "visible": true, // Whether the window is visible "visibleOnAllWorkspaces": false, // Whether the window is visible on all workspaces "width": 800, // Window width (default 800px) "windowClassname": "", // Window class name (customizable) "windowEffects": null, // Window effects (default is none) "x": null, // Initial X-coordinate of the window position "y": null, // Initial Y-coordinate of the window position "zoomHotkeysEnabled": true // Whether zoom hotkeys are enabled } ], "security": { "csp": null } } }
Conclusion
Configuring window parameters is a crucial step in Tauri development.
Understanding the purpose and default values of each parameter not only helps in efficient implementation but also prevents potential cross-platform compatibility issues.
Refer to the Tauri Official Documentation for accurate configurations and further details.
Feel free to explore my recent Tauri project github.com/infinilabs/coco-app, which is open-source. Please consider giving it a star ?.
This is my first Tauri project, and I am learning as I go. I hope to connect with like-minded individuals to explore and grow together.
References
https://v2.tauri.app/reference/config/#windowconfig
The above is the detailed content of Tauri (Part - Get the window configuration right first. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











The latest trends in JavaScript include the rise of TypeScript, the popularity of modern frameworks and libraries, and the application of WebAssembly. Future prospects cover more powerful type systems, the development of server-side JavaScript, the expansion of artificial intelligence and machine learning, and the potential of IoT and edge computing.

Different JavaScript engines have different effects when parsing and executing JavaScript code, because the implementation principles and optimization strategies of each engine differ. 1. Lexical analysis: convert source code into lexical unit. 2. Grammar analysis: Generate an abstract syntax tree. 3. Optimization and compilation: Generate machine code through the JIT compiler. 4. Execute: Run the machine code. V8 engine optimizes through instant compilation and hidden class, SpiderMonkey uses a type inference system, resulting in different performance performance on the same code.

Python is more suitable for beginners, with a smooth learning curve and concise syntax; JavaScript is suitable for front-end development, with a steep learning curve and flexible syntax. 1. Python syntax is intuitive and suitable for data science and back-end development. 2. JavaScript is flexible and widely used in front-end and server-side programming.

JavaScript is the core language of modern web development and is widely used for its diversity and flexibility. 1) Front-end development: build dynamic web pages and single-page applications through DOM operations and modern frameworks (such as React, Vue.js, Angular). 2) Server-side development: Node.js uses a non-blocking I/O model to handle high concurrency and real-time applications. 3) Mobile and desktop application development: cross-platform development is realized through ReactNative and Electron to improve development efficiency.

This article demonstrates frontend integration with a backend secured by Permit, building a functional EdTech SaaS application using Next.js. The frontend fetches user permissions to control UI visibility and ensures API requests adhere to role-base

I built a functional multi-tenant SaaS application (an EdTech app) with your everyday tech tool and you can do the same. First, what’s a multi-tenant SaaS application? Multi-tenant SaaS applications let you serve multiple customers from a sing

The shift from C/C to JavaScript requires adapting to dynamic typing, garbage collection and asynchronous programming. 1) C/C is a statically typed language that requires manual memory management, while JavaScript is dynamically typed and garbage collection is automatically processed. 2) C/C needs to be compiled into machine code, while JavaScript is an interpreted language. 3) JavaScript introduces concepts such as closures, prototype chains and Promise, which enhances flexibility and asynchronous programming capabilities.

The main uses of JavaScript in web development include client interaction, form verification and asynchronous communication. 1) Dynamic content update and user interaction through DOM operations; 2) Client verification is carried out before the user submits data to improve the user experience; 3) Refreshless communication with the server is achieved through AJAX technology.
