Registering .bib for import with Bookends

A place for users to ask each other questions, make suggestions, and discuss Bookends.
Post Reply
iandol
Posts: 465
Joined: Fri Jan 25, 2008 2:31 pm

Registering .bib for import with Bookends

Post by iandol »

This is a fairly minor request. By default, it seems that when I want to "open" a .bib file in macOS finder, there is no option to use Bookends:
Screenshot 2024-02-18 at 11.22.42.png
Screenshot 2024-02-18 at 11.22.42.png (44.62 KiB) Viewed 372 times
And when I want to add Bookends, is is also not a "Recommended Application":
Screenshot 2024-02-18 at 11.25.01.png
Screenshot 2024-02-18 at 11.25.01.png (44.55 KiB) Viewed 372 times
I can turn off recommended apps, then select Bookends, then use it and opening a .bib imports fine. But it would be nice if Bookends could register a relationship with .bib files with macOS so that it is available as an option in "Open with" at the start. Reading the Info.plist in the Bookends.app bundle and bibtex is there:

Code: Select all

<dict>
         <key>CFBundleTypeName</key>
         <string>bibtex</string>
         <key>CFBundleTypeIconFile</key>
         <string>Bibtex.icns</string>
         <key>CFBundleTypeExtensions</key>
         <array>
            <string>bib</string>
         </array>
         <key>LSItemContentTypes</key>
         <array>
            <string>public.text</string>
         </array>
         <key>CFBundleTypeRole</key>
         <string>Viewer</string>
         <key>LSHandlerRank</key>
         <string>Default</string>
      </dict>
 
So this could be some macOS bug (given the complexities of UTIs in macOS...)?
Jon
Site Admin
Posts: 10072
Joined: Tue Jul 13, 2004 6:27 pm
Location: Bethesda, MD
Contact:

Re: Registering .bib for import with Bookends

Post by Jon »

Yes, Bookends registers .bib as a file type it can open. Actually, if I right-click on a .bib file in the Finder and select Open With, Bookends is listed in the hierarchical menu. I'm guessing the problem is with Launch Services, which is the API that associates apps with files. Here's a recent article that discusses this a bit and has information about how to rebuild the LaunchService's database.

https://mjtsai.com/blog/2023/07/20/fixi ... -problems/

Jon
Sonny Software
iandol
Posts: 465
Joined: Fri Jan 25, 2008 2:31 pm

Re: Registering .bib for import with Bookends

Post by iandol »

Rebuilding the LaunchServices database didn't make any difference.

From your link which links to https://eclecticlight.co/2023/07/06/how ... -problems/ — I then used his precize.app and UTIutility.app

https://eclecticlight.co/taccy-signet-p ... ty-alisma/

and checked my UTI for that .bib file:
Screenshot 2024-02-19 at 12.11.23.png
Screenshot 2024-02-19 at 12.11.23.png (89.6 KiB) Viewed 350 times
So the UTI is taken from JabRef. Now JabRef uses .bib as its database format and indeed registers itself as such and then sets up .bib as public.data and MIME type as text/x-bibtex — here is the Info.plist specification for JabRef:

JabRef:

Code: Select all

<key>CFBundleDocumentTypes</key>
<dict>
  <key>LSItemContentTypes</key>
   <array>
    <string>JabRef.bib</string>
   </array>
  <key>CFBundleTypeName</key>
  <string>BibTeX File</string>

  <key>LSHandlerRank</key>
  <string>Owner</string>

  <key>CFBundleTypeRole</key>
  <string>Editor</string>

  <key>LSIsAppleDefaultForType</key>
  <true/>

  </dict>

<key>UTExportedTypeDeclarations</key>
  <array>
  <dict>
  <key>UTTypeIdentifier</key>
  <string>JabRef.bib</string>

  <key>UTTypeDescription</key>
  <string>BibTeX File</string>

  <key>UTTypeConformsTo</key>
   <array>
    <string>public.data</string>
   </array>

  <key>UTTypeTagSpecification</key>
  <dict>

  <key>public.filename-extension</key>
   <array>
    <string>bib</string>
   </array>
  <key>public.mime-type</key>
   <array>
    <string>text/x-bibtex</string>
   </array>
  </dict>
 </dict>
  </array>
Zotero does handle this case, its Info.plist looks like:

Code: Select all

		<dict>
			<key>CFBundleTypeExtensions</key>
			<array>
				<string>bib</string>
				<string>bibtex</string>
			</array>
			<!--<key>CFBundleTypeIconFile</key>
			<string>document.icns</string>-->
			<key>CFBundleTypeMIMETypes</key>
			<array>
				<string>application/x-bibtex</string>
				<string>text/x-bibtex</string>
			</array>
			<key>CFBundleTypeName</key>
			<string>BibTeX Document</string>
			<key>CFBundleTypeRole</key>
			<string>Viewer</string>
		</dict>
Checking using lsappinfo command and Bookends has this: { "UTTypeConformsTo"=( "public.content", "public.data"), , "UTTypeIdentifier"="public.text", , "UTTypeTagSpecification"={ "public.filename-extension"=( "bib") } } — and Zotero has: { "CFBundleTypeExtensions"=( "bib", "bibtex"), , "CFBundleTypeMIMETypes"=( "application/x-bibtex", "text/x-bibtex"), , "CFBundleTypeName"="BibTeX Document", , "CFBundleTypeRole"="Viewer" }

Zotero specifies CFBundleTypeMIMETypes text/x-bibtex explicitly and seems to get picked up in the "Open with" menu. Perhaps that could work for Bookends too?

Note: I also deleted JabRef and rebuilt LaunchServices, then the .bib file becomes a dynamic UTI, but Bookends is still not listed in the Open with menu for me.
Jon
Site Admin
Posts: 10072
Joined: Tue Jul 13, 2004 6:27 pm
Location: Bethesda, MD
Contact:

Re: Registering .bib for import with Bookends

Post by Jon »

What's odd is that Bookends is picked in the Finder's Open With menu for me. I've modified the UTI a bit now, we can follow up off-forum to see if this does the trick for you.

Jon
Sonny Software
iandol
Posts: 465
Joined: Fri Jan 25, 2008 2:31 pm

Re: Registering .bib for import with Bookends

Post by iandol »

Thanks as always for you quick support!!!
Post Reply