ホームページ >ウェブフロントエンド >jsチュートリアル >Tauri (パート - 最初にウィンドウ構成を正しく取得する)
デスクトップ アプリケーションを開発する場合、ウィンドウ パラメーターを理解し、正しく構成することが重要です。機能を合理化し、ユーザー エクスペリエンスを最適化するのに役立ちます。
次のコンテンツは Tauri 2 公式ドキュメントに基づいており、機能、デフォルト値、適用性など、WindowConfig 構成パラメーターの詳細な説明を提供します。
パラメータ | タイプ | 説明 | デフォルト値 |
---|---|---|---|
acceptFirstMouse | ブール値 | 最初のマウス イベントがウィンドウによって受け入れられるかどうか (macOS のみ)。 | 偽 |
常に下側 | ブール値 | ウィンドウを常に他のウィンドウの下に配置するかどうか。 | 偽 |
常にトップ | ブール値 | ウィンドウを常に他のウィンドウの上に配置するかどうか。 | 偽 |
背景色 | 文字列 | ウィンドウの背景色 (16 進形式)。 | デフォルト値なし |
センター | ブール値 | ウィンドウが画面の中央に配置されているかどうか。 | 偽 |
開閉可能 | ブール値 | ウィンドウを閉められるかどうか。 | 本当 |
コンテンツ保護 | ブール値 | ウィンドウのコンテンツがキャプチャまたは記録されないように保護します (部分的なサポート)。 | 偽 |
装飾 | ブール値 | ウィンドウの装飾 (タイトルバーや境界線など) を表示するかどうか。 | 本当 |
dragDropEnabled | ブール値 | ドラッグ アンド ドロップ機能が有効かどうか。 | 本当 |
フォーカス | ブール値 | 起動時にウィンドウにフォーカスを取得するかどうか。 | 本当 |
全画面 | ブール値 | ウィンドウを全画面モードで開始するかどうか。 | 偽 |
隠しタイトル | ブール値 | タイトル バーを非表示にします (macOS のみ)。 | 偽 |
シークレット | ブール値 | シークレット モードを有効にしてデータ追跡を防ぎます。 | 偽 |
ラベル | 文字列 | ウィンドウの一意の識別子 (必須)。 | デフォルト値なし |
最大化可能 | ブール値 | ウィンドウを最大化できるかどうか。 | 本当 |
最大化 | ブール値 | ウィンドウを最大化して開始するかどうか。 | 偽 |
最小化可能 | ブール値 | ウィンドウを最小化できるかどうか。 | 本当 |
サイズ変更可能 | ブール値 | ウィンドウのサイズを調整できるかどうか。 | 本当 |
タスクバーをスキップ | ブール値 | タスクバーからウィンドウを非表示にします (プラットフォームに依存します)。 | 偽 |
タブ識別子 | 文字列 | ウィンドウをグループ化するための識別子 (macOS のみ)。 | デフォルト値なし |
テーマ | 「明るい」か「暗い」か | ウィンドウのデフォルトのテーマ。部分的にサポートされています。 | システムのデフォルト |
タイトル | 文字列 | ウィンドウのタイトル | 「タウリアプリ」 |
タイトルバースタイル | 文字列 | タイトル バーのスタイル (macOS などのプラットフォームに依存します)。 | デフォルトのスタイル |
透明 | ブール値 | ウィンドウの透明度を有効にします (部分的なサポート)。 | 偽 |
ユーザーエージェント | 文字列 | ウィンドウのカスタム ユーザー エージェント。 | デフォルト値なし |
表示 | ブール値 | ウィンドウが表示されるかどうか。 | 本当 |
すべてのワークスペースに表示 | ブール値 | すべてのワークスペースでウィンドウを表示します (macOS のみ)。 | 偽 |
ウィンドウクラス名 | 文字列 | カスタム ウィンドウ クラス名 (Windows のみ)。 | デフォルト値なし |
ズームホットキー有効 | ブール値 | ウィンドウのズーム ホットキーを有効にします。 | 本当 |
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 |
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 |
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 |
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 } } }
ウィンドウ パラメーターの構成は、Tauri 開発における重要なステップです。
各パラメータの目的とデフォルト値を理解することは、効率的な実装に役立つだけでなく、潜在的なクロスプラットフォーム互換性の問題を防ぐことにも役立ちます。
正確な構成と詳細については、Tauri 公式ドキュメントを参照してください。
私の最近の Tauri プロジェクト github.com/infinilabs/coco-app を自由に探索してください。これは オープンソース です。 スターを付けることを検討してください?.
これは私にとって初めての Tauri プロジェクトであり、学びながら進めています。同じような考えを持つ人々とつながり、一緒に探究し、成長していきたいと思っています。
https://v2.tauri.app/reference/config/#windowconfig
以上がTauri (パート - 最初にウィンドウ構成を正しく取得する)の詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。