Bike 2.0 (Preview 274)

Ah, reading this again, you mean filesystem folder? I was thinking you were saying “folder”, but meaning containing row heading.

1 Like

Yes, Finder folder. For instance, I have notes.bike in different writing project folders. A workaround is to add prefix to the filename, but that will look abundant in Finder. I think VS Code had their point when they added that feature to customize window titles.

@Gorgonzola This doesn’t fix all the (focus rect sometimes not visible) problem with Keyboard navigation ON. But latest release does add quick navigation to Sidebar, Editor, Sidebar in the Go menu, with keyboard shortcuts.

The latest release adds API for window.subtitle. Here’s one way you could update the titlebar to show contained folder:

 function parentFolderName(path: string | undefined): string | undefined {                                                         
    if (!path) return undefined                                     
    const parts = path.split('/').filter((p) => p.length > 0)
    if (parts.length < 2) return undefined                                                                                          
    return parts[parts.length - 2]
  }                                                                                                                                 
                                                                  
  // inside your bike.observeWindows callback:                                                                                      
  window.observeCurrentOutlineEditor((editor) => {                
    if (!editor) {                                                                                                                  
      window.subtitle = 'Unsaved'
      return                                                                                                                        
    }                                                             
    const doc = bike.documents.find((d) => d.outline === editor.outline)
    const folder = parentFolderName(doc?.fileURL?.path)                                                                             
    window.subtitle = folder ?? 'Unsaved'                                                                                           
  })
3 Likes

To get equality between two outlines (for matching) might we not have to write something more specific, like:

(d) => d.outline.root.persistentId === editor.outline.root.persistentId

or is there perhaps some kind of built-in equality-between-objects magic at work there ?

1 Like

Oh, yeah! In fact that’s what I have in my current test code, I must have pasted from an earlier version. Good catch!

1 Like