[Update/Prepare] Prepare for window transparency feature.

This commit is contained in:
Sakamoto Shiina
2024-07-30 05:31:00 +09:00
parent 4c82f72c8f
commit 4e7667e277
4 changed files with 22 additions and 14 deletions

View File

@@ -11,7 +11,7 @@ edition = "2021"
tauri-build = { version = "1", features = [] } tauri-build = { version = "1", features = [] }
[dependencies] [dependencies]
tauri = { version = "1", features = [ "window-set-always-on-top", "window-create", "window-close", "shell-sidecar", "shell-open", "devtools"] } tauri = { version = "1", features = [ "window-set-decorations", "window-set-always-on-top", "window-create", "window-close", "shell-sidecar", "shell-open", "devtools"] }
serde = { version = "1", features = ["derive"] } serde = { version = "1", features = ["derive"] }
serde_json = "1" serde_json = "1"

View File

@@ -15,25 +15,28 @@
"window": { "window": {
"create": true, "create": true,
"close": true, "close": true,
"setAlwaysOnTop": true "setAlwaysOnTop": true,
}, "setDecorations": true
"shell": { },
"shell": {
"all": false, "all": false,
"open": true, "open": true,
"sidecar": true, "sidecar": true,
"scope": [ "scope": [
{ {
"name": "bin/test", "sidecar": true,"args": true "name": "bin/test", "sidecar": true,"args": true
} }
] ]
} }
}, },
"windows": [ "windows": [
{ {
"title": "VRCT", "title": "VRCT",
"width": 870, "width": 870,
"height": 654 "height": 654,
} "transparent": true,
"decorations": false
}
], ],
"security": { "security": {
"csp": null "csp": null

View File

@@ -32,6 +32,9 @@ html, body {
#root { #root {
height: 100%; height: 100%;
/* For controlling a whole window transparency */
opacity: 1;
} }
/* SVG内のすべての要素にfillを適用 (colorの調整をcssでするため) */ /* SVG内のすべての要素にfillを適用 (colorの調整をcssでするため) */

View File

@@ -1,6 +1,6 @@
import { getCurrent } from "@tauri-apps/api/window";
import { useEffect, useRef } from "react"; import { useEffect, useRef } from "react";
import styles from "./MainWindow.module.scss"; import styles from "./MainWindow.module.scss";
import { SidebarSection } from "./sidebar_section/SidebarSection"; import { SidebarSection } from "./sidebar_section/SidebarSection";
import { MainSection } from "./main_section/MainSection"; import { MainSection } from "./main_section/MainSection";
import { useStartPython } from "@logics/useStartPython"; import { useStartPython } from "@logics/useStartPython";
@@ -8,8 +8,10 @@ import { useStartPython } from "@logics/useStartPython";
export const MainWindow = () => { export const MainWindow = () => {
const { asyncStartPython } = useStartPython(); const { asyncStartPython } = useStartPython();
const hasRunRef = useRef(false); const hasRunRef = useRef(false);
const main_window = getCurrent();
useEffect(() => { useEffect(() => {
main_window.setDecorations(true);
if (!hasRunRef.current) { if (!hasRunRef.current) {
asyncStartPython(); asyncStartPython();
} }