@@ -456,7 +456,7 @@ private UIElement CreateNoteCard(NoteEntry note)
456456 VerticalAlignment = VerticalAlignment . Center
457457 } ;
458458 ToolTipService . SetToolTip ( attachIcon ,
459- $ "{ Lang . T ( "attached_to" ) } { ( note . AttachMode == "process" ? note . AttachTarget : Path . GetFileName ( note . AttachTarget ) ) } ") ;
459+ $ "{ Lang . T ( "attached_to" ) } { GetAttachTargetLabel ( note ) } ") ;
460460 metaPanel . Children . Add ( attachIcon ) ;
461461 }
462462 if ( ! string . IsNullOrEmpty ( note . TaskProgress ) )
@@ -552,6 +552,20 @@ private static async Task LoadThumbnailAsync(Image img, byte[] data)
552552 catch { }
553553 }
554554
555+ private static string GetAttachTargetLabel ( NoteEntry note )
556+ {
557+ if ( string . IsNullOrWhiteSpace ( note . AttachTarget ) )
558+ return "" ;
559+
560+ return note . AttachMode switch
561+ {
562+ "process" => note . AttachTarget ! ,
563+ "folder" => Path . GetFileName ( note . AttachTarget ! ) ,
564+ "title" => note . AttachTarget ! ,
565+ _ => note . AttachTarget !
566+ } ;
567+ }
568+
555569 private void ShowNoteContextMenu ( string noteId , FrameworkElement target )
556570 {
557571 var note = _notes . Notes . FirstOrDefault ( n => n . Id == noteId ) ;
@@ -585,8 +599,8 @@ private void ShowNoteContextMenu(string noteId, FrameworkElement target)
585599 HandleLockToggle ( noteId , target ) ;
586600 } ) ,
587601 new ( "\uE723 " ,
588- ! string . IsNullOrEmpty ( note ? . AttachMode )
589- ? $ "{ Lang . T ( "attached_to" ) } { ( note . AttachMode == "process" ? note . AttachTarget : Path . GetFileName ( note . AttachTarget ) ) } "
602+ note != null && ! string . IsNullOrEmpty ( note . AttachMode )
603+ ? $ "{ Lang . T ( "attached_to" ) } { GetAttachTargetLabel ( note ) } "
590604 : Lang . T ( "attach_to_window" ) , [ ] , ( ) =>
591605 {
592606 if ( note != null )
@@ -635,6 +649,10 @@ private void ShowAttachMenuFromList(NoteEntry note, FrameworkElement target)
635649 {
636650 ShowRunningProgramsPicker ( note , target ) ;
637651 } ) ,
652+ new ( "\uE774 " , Lang . T ( "attach_to_website" ) , [ ] , ( ) =>
653+ {
654+ ShowWebTabsPicker ( note , target ) ;
655+ } ) ,
638656 new ( "\uE8B7 " , Lang . T ( "attach_to_folder" ) , [ ] , async ( ) =>
639657 {
640658 await PickAttachFolder ( note ) ;
@@ -687,6 +705,34 @@ private void ShowRunningProgramsPicker(NoteEntry note, FrameworkElement target)
687705 flyout . ShowAt ( target ) ;
688706 }
689707
708+ private void ShowWebTabsPicker ( NoteEntry note , FrameworkElement target )
709+ {
710+ var tabs = WindowAttachmentHelper . GetVisibleWebTabs ( ) ;
711+ if ( tabs . Count == 0 )
712+ {
713+ var empty = ActionPanel . Create ( Lang . T ( "select_website" ) ,
714+ [ new ( null , Lang . T ( "no_web_tabs_found" ) , [ ] , ( ) => { } ) ] ) ;
715+ empty . ShowAt ( target ) ;
716+ return ;
717+ }
718+
719+ var actions = tabs . Select ( tab =>
720+ new ActionPanel . ActionItem ( null , $ "{ tab . ProcessName } — { tab . Title } ", [ ] , ( ) =>
721+ {
722+ note . AttachTarget = tab . Title ;
723+ note . AttachMode = "title" ;
724+ note . AttachOffsetX = 0 ;
725+ note . AttachOffsetY = 0 ;
726+ _notes . Save ( ) ;
727+ _attachmentService ? . Refresh ( ) ;
728+ RefreshCurrentView ( ) ;
729+ } )
730+ ) . ToList ( ) ;
731+
732+ var flyout = ActionPanel . Create ( Lang . T ( "select_website" ) , actions ) ;
733+ flyout . ShowAt ( target ) ;
734+ }
735+
690736 private async Task PickAttachFolder ( NoteEntry note )
691737 {
692738 var picker = new Windows . Storage . Pickers . FolderPicker ( ) ;
@@ -884,6 +930,12 @@ private void HandleNoteAttachmentChanged(NoteWindow window)
884930 window . SetPinnedOnTop ( true ) ;
885931 _attachmentService ? . Refresh ( ) ;
886932 }
933+ else if ( note . AttachMode == "title" )
934+ {
935+ // Check if the foreground window title matches
936+ window . SetPinnedOnTop ( true ) ;
937+ _attachmentService ? . Refresh ( ) ;
938+ }
887939 }
888940
889941 // ── Window attachment ───────────────────────────────────────
0 commit comments