@@ -51,8 +51,6 @@ import { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider } from "./comp
5151import { ContextFileItem , ConfigFileItem } from "./components/ContextFileItem" ;
5252import { DocumentReader } from "./components/DocumentReader" ;
5353import { invoke } from "@tauri-apps/api/core" ;
54- import { WebviewWindow } from "@tauri-apps/api/webviewWindow" ;
55- import { LogicalPosition } from "@tauri-apps/api/window" ;
5654import { listen } from "@tauri-apps/api/event" ;
5755import { save } from "@tauri-apps/plugin-dialog" ;
5856import {
@@ -447,56 +445,12 @@ function App() {
447445 const [ profile , setProfile ] = usePersistedState < UserProfile > ( "lovcode:profile" , { nickname : "" , avatarUrl : "" } ) ;
448446 const [ showProfileDialog , setShowProfileDialog ] = useState ( false ) ;
449447 const [ distillWatchEnabled , setDistillWatchEnabled ] = useState ( true ) ;
450- const [ floatWindowVisible , setFloatWindowVisible ] = usePersistedState ( "lovcode:floatWindowVisible" , false ) ;
451-
452448 // Load home directory and distill watch status
453449 useEffect ( ( ) => {
454450 invoke < string > ( "get_home_dir" ) . then ( setHomeDir ) . catch ( ( ) => { } ) ;
455451 invoke < boolean > ( "get_distill_watch_enabled" ) . then ( setDistillWatchEnabled ) . catch ( ( ) => { } ) ;
456452 } , [ ] ) ;
457453
458- // Toggle float window visibility
459- const toggleFloatWindow = useCallback ( async ( ) => {
460- const floatWin = await WebviewWindow . getByLabel ( "float" ) ;
461- if ( floatWin ) {
462- const visible = await floatWin . isVisible ( ) ;
463- if ( visible ) {
464- await floatWin . hide ( ) ;
465- setFloatWindowVisible ( false ) ;
466- } else {
467- // 重置到屏幕右下角
468- const screenWidth = window . screen . availWidth ;
469- const screenHeight = window . screen . availHeight ;
470- const screenLeft = ( window . screen as { availLeft ?: number } ) . availLeft ?? 0 ;
471- const screenTop = ( window . screen as { availTop ?: number } ) . availTop ?? 0 ;
472- const size = await floatWin . outerSize ( ) ;
473- const scale = window . devicePixelRatio ;
474- const winWidth = size . width / scale ;
475- const winHeight = size . height / scale ;
476- await floatWin . setPosition ( new LogicalPosition (
477- screenLeft + screenWidth - winWidth - 20 ,
478- screenTop + screenHeight - winHeight - 20
479- ) ) ;
480- await floatWin . show ( ) ;
481- setFloatWindowVisible ( true ) ;
482- }
483- }
484- } , [ setFloatWindowVisible ] ) ;
485-
486- // Restore float window visibility on mount
487- useEffect ( ( ) => {
488- if ( floatWindowVisible ) {
489- WebviewWindow . getByLabel ( "float" ) . then ( async ( win ) => {
490- if ( win ) {
491- await win . show ( ) ;
492- // Refocus main window after showing float window
493- const mainWin = await WebviewWindow . getByLabel ( "main" ) ;
494- if ( mainWin ) await mainWin . setFocus ( ) ;
495- }
496- } ) ;
497- }
498- } , [ ] ) ;
499-
500454 // Persist view to localStorage
501455 useEffect ( ( ) => {
502456 localStorage . setItem ( "lovcode-view" , JSON . stringify ( view ) ) ;
@@ -845,13 +799,6 @@ function App() {
845799 >
846800 Settings
847801 </ button >
848- < button
849- onClick = { toggleFloatWindow }
850- className = "w-full flex items-center justify-between gap-3 px-2.5 py-1.5 text-sm text-muted-foreground hover:text-ink hover:bg-card-alt rounded-md transition-colors"
851- >
852- < span className = "whitespace-nowrap" > Lovnotifier Messages</ span >
853- < span className = { `w-2 h-2 shrink-0 rounded-full ${ floatWindowVisible ? "bg-green-500" : "bg-muted-foreground/30" } ` } />
854- </ button >
855802 </ div >
856803 </ PopoverContent >
857804 </ Popover >
0 commit comments