feat(ui): subtle rounded corners and shadow when window is floating
Detect maximized state via Tauri window API. When the window is not maximized (floating), apply 8px border-radius and a soft box-shadow. Body/html backgrounds set to transparent so corners show through the Tauri transparent window.
This commit is contained in:
3 files changed
+25
-4
No files matched your search
+1
-1
@@ -1272,7 +1272,7 @@ body {
|
||||
font-family: var(--font-sans);
|
||||
font-size: 14px;
|
||||
line-height: 1.5;
|
||||
background-color: var(--bg-primary);
|
||||
background-color: transparent;
|
||||
color: var(--text-primary);
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
<!doctype html>
|
||||
<html lang="en" style="background-color: #0f0f0f;">
|
||||
<html lang="en" style="background-color: transparent;">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
|
||||
@@ -7,7 +7,7 @@
|
||||
<title>QBZ</title>
|
||||
%sveltekit.head%
|
||||
</head>
|
||||
<body data-sveltekit-preload-data="hover" style="background-color: #0f0f0f; margin: 0;">
|
||||
<body data-sveltekit-preload-data="hover" style="background-color: transparent; margin: 0;">
|
||||
<script>
|
||||
// Apply system titlebar state before first render to prevent flash
|
||||
// of custom title bar when system decorations are enabled.
|
||||
|
||||
+22
-1
@@ -2,6 +2,7 @@
|
||||
import { onMount, onDestroy, tick } from 'svelte';
|
||||
import { ChevronUp } from 'lucide-svelte';
|
||||
import { invoke, convertFileSrc } from '@tauri-apps/api/core';
|
||||
import { getCurrentWindow } from '@tauri-apps/api/window';
|
||||
import { listen, emitTo, type UnlistenFn } from '@tauri-apps/api/event';
|
||||
import { writeText } from '@tauri-apps/plugin-clipboard-manager';
|
||||
|
||||
@@ -424,6 +425,9 @@
|
||||
// Window Controls State
|
||||
let windowControlsConfig = $state<WindowControlsConfig>(getWindowControls());
|
||||
|
||||
// Window floating state (not maximized/tiled — for rounded corners + shadow)
|
||||
let isWindowFloating = $state(false);
|
||||
|
||||
// View State (from navigationStore subscription)
|
||||
let activeView = $state<ViewType>('home');
|
||||
let selectedPlaylistId = $state<number | null>(null);
|
||||
@@ -3144,6 +3148,16 @@
|
||||
windowControlsConfig = getWindowControls();
|
||||
});
|
||||
|
||||
// Detect floating window state (not maximized) for rounded corners + shadow
|
||||
let unlistenResize: (() => void) | undefined;
|
||||
(async () => {
|
||||
const appWindow = getCurrentWindow();
|
||||
isWindowFloating = !(await appWindow.isMaximized());
|
||||
unlistenResize = await appWindow.onResized(async () => {
|
||||
isWindowFloating = !(await appWindow.isMaximized());
|
||||
});
|
||||
})();
|
||||
|
||||
// Sync titlebar search query with search state store
|
||||
const unsubscribeTitlebarSearch = subscribeSearchQuery((query) => {
|
||||
titlebarSearchQuery = query;
|
||||
@@ -3528,6 +3542,7 @@
|
||||
unsubscribeTitleBar();
|
||||
unsubscribeSearchBarLocation();
|
||||
unsubscribeWindowControls();
|
||||
unlistenResize?.();
|
||||
unsubscribeTitlebarSearch();
|
||||
unsubscribeOffline();
|
||||
unsubscribeNav();
|
||||
@@ -3625,7 +3640,7 @@
|
||||
{#if !isLoggedIn}
|
||||
<LoginView onLoginSuccess={handleLoginSuccess} onStartOffline={handleStartOffline} />
|
||||
{:else}
|
||||
<div class="app" class:no-titlebar={!showTitleBar}>
|
||||
<div class="app" class:no-titlebar={!showTitleBar} class:floating={isWindowFloating}>
|
||||
<!-- Custom Title Bar (CSD) -->
|
||||
{#if showTitleBar}
|
||||
<TitleBar
|
||||
@@ -4617,6 +4632,12 @@
|
||||
background-color: var(--bg-primary);
|
||||
}
|
||||
|
||||
.app.floating {
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4), 0 0 1px rgba(0, 0, 0, 0.3);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.app-body {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
|
||||
Reference in new issue
Block a user