Skip to content

Commit c15fd2c

Browse files
authored
feat: add a border to the main window in Windows 10 (#343)
* feat: add a border to the main window in Windows 10 * refactor: remove unused code * refactor: add dark themed borders
1 parent 6c90f42 commit c15fd2c

8 files changed

Lines changed: 45 additions & 6 deletions

File tree

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
"tauri-plugin-fs-pro-api": "^2.3.1",
6161
"tauri-plugin-macos-permissions-api": "^2.2.0",
6262
"tauri-plugin-screenshots-api": "^2.1.0",
63+
"tauri-plugin-windows-version-api": "^2.0.0",
6364
"use-debounce": "^10.0.4",
6465
"uuid": "^11.1.0",
6566
"wavesurfer.js": "^7.9.3",

pnpm-lock.yaml

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src-tauri/Cargo.lock

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src-tauri/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ http = "1.1.0"
6969
tungstenite = "0.24.0"
7070
env_logger = "0.11.5"
7171
tokio-util = "0.7.14"
72+
tauri-plugin-windows-version = "2"
7273

7374
[target."cfg(target_os = \"macos\")".dependencies]
7475
tauri-nspanel = { git = "https://github.com/ahkohd/tauri-nspanel", branch = "v2" }

src-tauri/capabilities/default.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
"screenshots:default",
6969
"core:window:allow-set-theme",
7070
"process:default",
71-
"updater:default"
71+
"updater:default",
72+
"windows-version:default"
7273
]
7374
}

src-tauri/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ pub fn run() {
8282
.plugin(tauri_plugin_macos_permissions::init())
8383
.plugin(tauri_plugin_screenshots::init())
8484
.plugin(tauri_plugin_process::init())
85-
.plugin(tauri_plugin_updater::Builder::new().build());
85+
.plugin(tauri_plugin_updater::Builder::new().build())
86+
.plugin(tauri_plugin_windows_version::init());
8687

8788
// Conditional compilation for macOS
8889
#[cfg(target_os = "macos")]

src-tauri/src/setup/windows.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
use tauri::{App, WebviewWindow};
22

3-
pub fn platform(_app: &mut App, _main_window: WebviewWindow, _settings_window: WebviewWindow) {}
3+
pub fn platform(_app: &mut App, _main_window: WebviewWindow, _settings_window: WebviewWindow) {}

src/components/SearchChat/index.tsx

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ import {
55
useReducer,
66
Suspense,
77
memo,
8+
useState,
89
} from "react";
910
import clsx from "clsx";
11+
import { isWindows10 } from "tauri-plugin-windows-version-api";
1012

1113
import Search from "@/components/Search/Search";
1214
import InputBox from "@/components/Search/InputBox";
@@ -22,19 +24,20 @@ import { useStartupStore } from "@/stores/startupStore";
2224
import { DataSource } from "@/types/commands";
2325
import { useThemeStore } from "@/stores/themeStore";
2426
import { Get } from "@/api/axiosRequest";
27+
import { useMount } from "ahooks";
2528

2629
interface SearchChatProps {
2730
isTauri?: boolean;
2831
hasModules?: string[];
2932
defaultModule?: "search" | "chat";
30-
33+
3134
hasFeature?: string[];
3235
showChatHistory?: boolean;
33-
36+
3437
theme?: "auto" | "light" | "dark";
3538
searchPlaceholder?: string;
3639
chatPlaceholder?: string;
37-
40+
3841
hideCoco?: () => void;
3942
setIsPinned?: (value: boolean) => void;
4043
querySearch: (input: string) => Promise<any>;
@@ -74,6 +77,7 @@ function SearchChat({
7477
isDeepThinkActive,
7578
isTyping,
7679
} = state;
80+
const [isWin10, setIsWin10] = useState(false);
7781

7882
useWindowEvents();
7983

@@ -84,6 +88,12 @@ function SearchChat({
8488

8589
const setTheme = useThemeStore((state) => state.setTheme);
8690

91+
useMount(async () => {
92+
const isWin10 = await isWindows10();
93+
94+
setIsWin10(isWin10);
95+
});
96+
8797
useEffect(() => {
8898
let mounted = true;
8999

@@ -325,6 +335,7 @@ function SearchChat({
325335
"w-screen h-screen": isTauri,
326336
"rounded-xl": !isWin,
327337
"border border-[#E6E6E6] dark:border-[#272626]": isLinux,
338+
"border-t border-t-[#999] dark:border-t-[#333]": isWin10,
328339
}
329340
)}
330341
>

0 commit comments

Comments
 (0)