@@ -363,6 +363,7 @@ function SwitcherApp() {
363363 const [ currentAppMode , setCurrentAppMode ] = useState ( 'menubar' ) ;
364364 const [ modeBanner , setModeBanner ] = useState < string | null > ( null ) ;
365365 const [ quickSwitcherShortcut , setQuickSwitcherShortcut ] = useState ( '' ) ;
366+ const bannerTimeoutRef = useRef < ReturnType < typeof setTimeout > | null > ( null ) ;
366367
367368 const updateWorkingPathUIAndList = async ( path : string ) => {
368369 setWorkingFolderPath ( path ) ;
@@ -674,40 +675,44 @@ function SwitcherApp() {
674675 // Load shortcut for display
675676 window . electronAPI . getShortcuts ( ) . then ( ( s : any ) => {
676677 if ( s ?. quickSwitcher ) {
677- // Convert Electron accelerator to display format
678678 const display = s . quickSwitcher
679679 . replace ( 'Command' , 'Cmd' )
680680 . replace ( 'Control' , 'Ctrl' )
681681 . replace ( / \+ / g, '+' ) ;
682682 setQuickSwitcherShortcut ( display ) ;
683+ shortcutDisplay = display ;
683684 }
684685 } ) ;
685686
687+ const showBanner = ( msg : string , durationMs = 5000 ) => {
688+ if ( bannerTimeoutRef . current ) clearTimeout ( bannerTimeoutRef . current ) ;
689+ setModeBanner ( msg ) ;
690+ bannerTimeoutRef . current = setTimeout ( ( ) => setModeBanner ( null ) , durationMs ) ;
691+ } ;
692+
686693 // Listen for app mode changes to enable/disable drag
694+ let shortcutDisplay = '' ; // will be set by getShortcuts
687695 window . electronAPI . getAppMode ( ) . then ( ( mode : string ) => {
688696 const m = mode || 'normal' ;
689697 setCurrentAppMode ( m ) ;
690- // Show banner on first launch for new users
691698 if ( m === 'normal' ) {
692- setModeBanner ( 'Normal App mode — drag to reposition. Switch to Menu Bar mode in Settings.' ) ;
693- setTimeout ( ( ) => setModeBanner ( null ) , 6000 ) ;
699+ showBanner ( 'Normal App mode — drag to reposition. Switch to Menu Bar mode in Settings.' , 6000 ) ;
694700 }
695701 } ) ;
696702 window . electronAPI . onShortcutsUpdated ( ( _event : any , s : any ) => {
697703 if ( s ?. quickSwitcher ) {
698- const display = s . quickSwitcher . replace ( 'Command' , 'Cmd' ) . replace ( 'Control' , 'Ctrl' ) . replace ( / \+ / g, '+' ) ;
699- setQuickSwitcherShortcut ( display ) ;
704+ shortcutDisplay = s . quickSwitcher . replace ( 'Command' , 'Cmd' ) . replace ( 'Control' , 'Ctrl' ) . replace ( / \+ / g, '+' ) ;
705+ setQuickSwitcherShortcut ( shortcutDisplay ) ;
700706 }
701707 } ) ;
702708 window . electronAPI . onAppModeChanged ( ( _event : any , mode : string ) => {
703709 setCurrentAppMode ( mode ) ;
704- // Show banner on mode change
710+ const key = shortcutDisplay || 'Cmd+Ctrl+R' ;
705711 if ( mode === 'normal' ) {
706- setModeBanner ( 'Switched to Normal App mode — window stays visible and is draggable.' ) ;
712+ showBanner ( 'Switched to Normal App mode — window stays visible and is draggable.' ) ;
707713 } else {
708- setModeBanner ( ' Switched to Menu Bar mode — window auto-hides. Use Cmd+Ctrl+R to toggle.' ) ;
714+ showBanner ( ` Switched to Menu Bar mode — window auto-hides. Use ${ key } to toggle.` ) ;
709715 }
710- setTimeout ( ( ) => setModeBanner ( null ) , 5000 ) ;
711716 } ) ;
712717
713718 window . electronAPI . onCheckTerminalAndHide ( ( ) => {
0 commit comments