foxtrot icon indicating copy to clipboard operation
foxtrot copied to clipboard

Support Quicklook for MacOS?

Open NeighNeighNeigh opened this issue 1 year ago • 50 comments

Hello, this being so fast, I was wondering if you might consider making it work with Quicklook for MacOS… STEP viewing just a spacebar away would be extremely handy. Thanks for taking a moment to read this :)

NeighNeighNeigh avatar May 30 '24 01:05 NeighNeighNeigh

This would be amazing.

mkormendy avatar May 03 '25 01:05 mkormendy

I hooked this up today. It has full pan+orbit support (It's SceneKit under the hood). I'll need to polish a bit and get an Apple Developer membership to be able to distribute it though. Maybe I'll open source it but also put it on the app store to cover the Apple Developer membership cost.

Image

johnboiles avatar Jul 14 '25 20:07 johnboiles

@johnboiles To be somewhat future forward, might want to use RealityKit instead since SceneKit is deprecated now https://developer.apple.com/videos/play/wwdc2025/288/

mkormendy avatar Jul 14 '25 20:07 mkormendy

Oh cool, thanks for pointing that out!

Edit: I tried out RealityKit/RealityView but I didn't like it for a few reasons:

  • RealityView is SwiftUI but Quick Look Extensions have NSView/AppKit APIs so I had to use NSHostingView to bridge them and it was clunky
  • I'm pretty sure the built-in .STL preview uses SceneKit and I want to match that rendering aesthetic (RealityKit has fancier lighting by default)
  • I couldn't figure out how to enable pan+orbit, only one or the other via realityViewCameraControls
  • In the video you linked they said they have no plans to hard-deprecate SceneKit

johnboiles avatar Jul 14 '25 21:07 johnboiles

Anyone want to try it out? I've got it codesigned+notarized as a release build but I have not tried it on any machine other than my own. If you wouldn't mind screen recording the whole process of copying QuickLookStep.app to /Applications then running QuickLookStep.app so I can see when/how it prompts to add the Quick Look extensions that would be helpful. You should get two extensions added to Login Items & Extensions:

Image

I'm not sure if you need to reboot or not to get Finder/QuickLook to start using the new extensions, so if it doesn't work, any Console.app logs for StepThumbnail and StepPreview would be helpful too!

QuickLookStepV1.zip

Here's what it looks like right now. There are thumbnails, previews, and a basic viewer app (since the extensions need to be bundled in a .app)

Image Image Image

johnboiles avatar Jul 17 '25 16:07 johnboiles

Unfortunately, doesn't appear to be working for me. Can't find any logs for StepThumbnail or StepPreview in console. But it appears enabled? Restarted computer to make sure all finder processes would have picked it up.

Image

prestonbrown avatar Jul 24 '25 15:07 prestonbrown

Thanks for trying it! Strange that they show up in Settings but don't run. The one other person who tried it had a similar experience. Code signature looks correct to me:

codesign --verify --deep --strict --verbose=2 /Applications/QuickLookStep.app
--prepared:/Applications/QuickLookStep.app/Contents/PlugIns/StepThumbnail.appex
--prepared:/Applications/QuickLookStep.app/Contents/PlugIns/StepPreview.appex
--validated:/Applications/QuickLookStep.app/Contents/PlugIns/StepThumbnail.appex
--validated:/Applications/QuickLookStep.app/Contents/PlugIns/StepPreview.appex
/Applications/QuickLookStep.app: valid on disk
/Applications/QuickLookStep.app: satisfies its Designated Requirement

I need to find a fresh Mac to try to debug further.

johnboiles avatar Jul 24 '25 15:07 johnboiles

Can you try running qlmanage -r and qlmanage -r cache to reload the generators list and reset the thumbnail disk cache?

Then run qlmanage -p yourstepfile.step (of course replacing yourstepfile.step with a real step file).

Edit: Let's also try:

pluginkit -mvvv -i johnboiles.QuickLookStep.StepThumbnail
pluginkit -mvvv -i johnboiles.QuickLookStep.StepPreview

And post the output (if any). Then run

pluginkit -e use -i johnboiles.QuickLookStep.StepPreview
pluginkit -e use -i johnboiles.QuickLookStep.StepThumbnail

johnboiles avatar Jul 24 '25 16:07 johnboiles

Sure thing. After resetting quicklookd and quicklook cache:

Image
+    johnboiles.QuickLookStep.StepPreview(1.0)
                    Path = /Applications/QuickLookStep.app/Contents/PlugIns/StepPreview.appex
                    UUID = 9FEBDB63-B8B2-4117-8796-449A9AA97BB0
               Timestamp = 2025-07-24 15:11:01 +0000
                     SDK = com.apple.quicklook.preview
           Parent Bundle = /Applications/QuickLookStep.app
            Display Name = StepPreview
              Short Name = StepPreview
             Parent Name = QuickLookStep
                Platform = macOS

 (1 plug-in)

```pluginkit -mvv -i johnboiles.QuickLookStep.StepThumbnail
+    johnboiles.QuickLookStep.StepThumbnail(1.0)
                    Path = /Applications/QuickLookStep.app/Contents/PlugIns/StepThumbnail.appex
                    UUID = 4A52E595-7A6C-42D6-A9B1-E61B59C17218
               Timestamp = 2025-07-24 15:11:01 +0000
                     SDK = com.apple.quicklook.thumbnail
           Parent Bundle = /Applications/QuickLookStep.app
            Display Name = StepThumbnail
              Short Name = StepThumbnail
             Parent Name = QuickLookStep
                Platform = macOS

 (1 plug-in)```

prestonbrown avatar Jul 24 '25 16:07 prestonbrown

Thank you!

This all looks correct. The + at the start indicates the user has elected to use the plug-in so that's correct. My only idea is to fully remove the plugins with plugin kit then add them back.

pluginkit -r /Applications/QuickLookStep.app/Contents/PlugIns/StepPreview.appex
pluginkit -r /Applications/QuickLookStep.app/Contents/PlugIns/StepThumbnail.appex
pluginkit -a /Applications/QuickLookStep.app/Contents/PlugIns/StepPreview.appex
pluginkit -a /Applications/QuickLookStep.app/Contents/PlugIns/StepThumbnail.appex
pluginkit -e use -i johnboiles.QuickLookStep.StepPreview
pluginkit -e use -i johnboiles.QuickLookStep.StepThumbnail

johnboiles avatar Jul 24 '25 17:07 johnboiles

Unfortunately, that did not work either.

Preston

On Thu, Jul 24, 2025 at 1:16 PM John Boiles @.***> wrote:

johnboiles left a comment (Formlabs/foxtrot#12) https://github.com/Formlabs/foxtrot/issues/12#issuecomment-3114241729

Thank you!

This all looks correct. The + at the start indicates the user has elected to use the plug-in so that's correct. My only idea is to fully remove the plugins with plugin kit then add them back.

pluginkit -r /Applications/QuickLookStep.app/Contents/PlugIns/StepPreview.appex pluginkit -r /Applications/QuickLookStep.app/Contents/PlugIns/StepThumbnail.appex pluginkit -a /Applications/QuickLookStep.app/Contents/PlugIns/StepPreview.appex pluginkit -a /Applications/QuickLookStep.app/Contents/PlugIns/StepThumbnail.appex pluginkit -e use -i johnboiles.QuickLookStep.StepPreview pluginkit -e use -i johnboiles.QuickLookStep.StepThumbnail

— Reply to this email directly, view it on GitHub https://github.com/Formlabs/foxtrot/issues/12#issuecomment-3114241729, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABVTAX46SIQ4E5IOTWPDRQD3KEIGRAVCNFSM6AAAAAB4LER66CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTCMJUGI2DCNZSHE . You are receiving this because you commented.Message ID: @.***>

prestonbrown avatar Jul 24 '25 17:07 prestonbrown

Ok thanks for trying those. I think i'll need to find a fresh computer and try to repro.

johnboiles avatar Jul 24 '25 17:07 johnboiles

I just installed on my M3 MacBook Air (Sequoia 15.5) I took notes and screenshots along the way. However like others, pressing the space bar in Finder doesn't bring up a quicklook and the preview is not displayed. I have a second machine, but it would be best to keep that one clean until I can figure out what the issue is (then I can try a full install on a clean machine).

I had a thought that maybe rust, cargo and python need to be installed (they are foxtrot pre-requisites), but since the app will view STEP files dropped on it, then it looks like the step viewing does work, just the extension parts are not.

I've checked in Console and there are three questionable messages:

Unexpected bundle class 16 declaring type a360.step
No extension found for \<private\>, reason: \<private\>
Sandbox: com.apple.quicklook.ThumbnailsAg(542) deny(1) file-read-xattr /Users/xxxxx/Library/Mobile Documents

(I replaced my username with xxxxx, and note the private tags in the second message, which I'm having trouble adding to the comment!)

These messages come up repeatedly when I select a step file in finder

DerekK19 avatar Jul 24 '25 21:07 DerekK19

Thank you for trying it! I'm glad at least that the failure is consistent.

I had a thought that maybe rust, cargo and python need to be installed

I'm pre-compiling Foxtrot as a universal (x86_64+arm64) binary lib for use in my application, so you shouldn't need any of the Foxtrot build dependencies on your machine. Making C-compatible libraries from Rust was surprisingly easy!

johnboiles avatar Jul 24 '25 21:07 johnboiles

Was gonna try it, but I'm still on Sonoma (14.7.4), any reason why this can only work on Sequoia?

rv0 avatar Aug 01 '25 20:08 rv0

The QuickLook APIs I'm using didn't exist prior to Sequoia so almost certainly it only works in Sequoia. The app as a lightweight previewer might work though!

https://eclecticlight.co/2024/10/31/how-sequoia-has-changed-quicklook-and-its-thumbnails/

johnboiles avatar Aug 01 '25 22:08 johnboiles

Hello, I tried it on Sequoia as well, unfortunatly it does not work. I have followed every step suggested until now

% pluginkit -mvvv -i johnboiles.QuickLookStep.StepThumbnail
pluginkit -mvvv -i johnboiles.QuickLookStep.StepPreview

+    johnboiles.QuickLookStep.StepThumbnail(1.0)
	            Path = /Applications/Utilities/Quicklook plugin/QuickLookStep.app/Contents/PlugIns/StepThumbnail.appex
	            UUID = 1FAFA6EB-FB1B-40AD-8D87-AB18CB0ED69E
	       Timestamp = 2025-08-06 15:03:52 +0000
	             SDK = com.apple.quicklook.thumbnail
	   Parent Bundle = /Applications/Utilities/Quicklook plugin/QuickLookStep.app
	    Display Name = StepThumbnail
	      Short Name = StepThumbnail
	     Parent Name = QuickLookStep
	        Platform = macOS

 (1 plug-in)
+    johnboiles.QuickLookStep.StepPreview(1.0)
	            Path = /Applications/Utilities/Quicklook plugin/QuickLookStep.app/Contents/PlugIns/StepPreview.appex
	            UUID = 56913B1C-F26F-4508-B6A1-C7361EA9EC70
	       Timestamp = 2025-08-06 15:03:52 +0000
	             SDK = com.apple.quicklook.preview
	   Parent Bundle = /Applications/Utilities/Quicklook plugin/QuickLookStep.app
	    Display Name = StepPreview
	      Short Name = StepPreview
	     Parent Name = QuickLookStep
	        Platform = macOS

 (1 plug-in)

AR17HY avatar Aug 06 '25 15:08 AR17HY

Really interested in this. I'd happily buy the working result from the App Store.

Seems that you're close. Hopefully you'll be able to keep making forward progress.

dennyblokland avatar Aug 08 '25 14:08 dennyblokland

Looks like a good start but didn’t work on my MacBook (Sequoia 15.6) neither unfortunately. Hope that you find a way to get it running and let me know if I can provide some more information to help.

By the way: Would it be possible to use your App to teach macOS that .step is a file extension. At the moment Finder recognize it only as part of a name (included in highlight, when renaming e.g.)?

tweh avatar Aug 17 '25 09:08 tweh

I've tried it as well, not much success, I was digging around through the console and the only things that I noticed related to the plugins that look suspicios are the following lines, not sure what are the 2 files a360.stp and public.step, I searched for them on my machine, could not find them. But maybe it gives some hint to what is going on.

Image

LE: Running qlmanage -p file.step will always generate the same 2 messages above only this time the process is qlmanage and not Finder as before, and this message right before the 2 messages above

discovered extensions: attributes {
    "LS:ExtensionPlatforms" =     (
        1,
        6
    );
    NSExtensionPointName = "com.apple.quicklook.preview";
}, extensionSet {(
    <EXConcreteExtension: 0x600000443900> {id = johnboiles.QuickLookStep.StepPreview},
    <EXConcreteExtension: 0x600000443a80> {id = com.apple.CalendarUI.SpotlightEventPreview},
    <EXConcreteExtension: 0x600000443b40> {id = com.apple.QuickLookUIFramework.QLPreviewGenerationExtension},
    <EXConcreteExtension: 0x600000443c00> {id = com.apple.osanalytics.IPSExtension},
    <EXConcreteExtension: 0x600000443cc0> {id = com.apple.HydraQLPreviewExtension},
    <EXConcreteExtension: 0x600000443d80> {id = com.apple.dt.DVTProvisioningProfileQuicklookExtension},
    <EXConcreteExtension: 0x600000443e40> {id = com.apple.CoreHapticsTools.QLPreviewExtension},
    <EXConcreteExtension: 0x600000443f00> {id = com.apple.reminders.quicklookextension},
    <EXConcreteExtension: 0x60000045d200> {id = com.apple.shortcuts.QuickLookExtension},
    <EXConcreteExtension: 0x600000444000> {

LLE: Figured out what the 2 "files" where, found them in Info.plist. It does suggest that the system does not understand the file extension this plugin handles. For another similar app for 3mf files the QLSupportedContentTypes where defined based on the app name, suggesting those should be something like johnboiles.QuickLookStep.step and johnboiles.QuickLookStep.stp. I don't fully understand apples UTIs, just going by felling

70mmy avatar Aug 20 '25 19:08 70mmy

@70mmy good find! That's the best lead we have. Maybe there's something else that needs to be done to register those universal type identifiers.

johnboiles avatar Aug 21 '25 17:08 johnboiles

As far as I can tell that should do the trick. The public.step looks like it is for known UTIs by apple, and not used with the file extension, but with stuff like public.data

There's the https://github.com/DavidPhillipOster/ThumbHost3mf that uses the pluginkit as well, maybe you can have a look there for inspiration. He also registers the host to be able to handle the 3mf and gcode files, so the app shows up in Open with menu, but I don't think that is necessary.

70mmy avatar Aug 21 '25 17:08 70mmy

Give this one a try: QuickLookStep.zip

I added this to the Info.plist.

<key>UTExportedTypeDeclarations</key>
<array>
	<dict>
		<key>UTTypeDescription</key>
		<string>STEP File (ISO 10303-21)</string>
		<key>UTTypeConformsTo</key>
		<array>
			<string>public.data</string>
			<string>public.text</string>
		</array>
		<key>UTTypeIdentifier</key>
		<string>public.step</string>
		<key>UTTypeTagSpecification</key>
		<dict>
			<key>public.mime-type</key>
			<array>
				<string>application/step</string>
			</array>
			<key>public.filename-extension</key>
			<array>
				<string>step</string>
				<string>stp</string>
			</array>
		</dict>
	</dict>
</array>

johnboiles avatar Aug 21 '25 17:08 johnboiles

That did the trick! Works for me

70mmy avatar Aug 21 '25 18:08 70mmy

Woohoo! Thanks for your help, it put me on the right path!

johnboiles avatar Aug 21 '25 19:08 johnboiles

You’re welcome! Good job with the plugin, it works nicely!

I did notice a small quirk, if you rotate the model in the preview up side down, dragging the model to the left, rotates it to the right, not sure if it’s something easy to fix

70mmy avatar Aug 21 '25 20:08 70mmy

I think that's the just SceneKit default behavior. I see the same thing when using the built-in macOS previewer for STL files (which is what I'm trying to match)

johnboiles avatar Aug 21 '25 20:08 johnboiles

Nice work there. The built-in STL previewer works in the Finder Column mode view too. Select an STL file in Finder (column view) and it shows a preview of the model. Your previewer works just the same, but there is one thing to bear in mind - and this is not an issue with the app, it's an issue with the (in my case "dumb") user.

If you run the app e.g from your Downloads folder to try it out, then you move it to your Applications folder, the Finder Column view previewing will stop working. Reason is that when you first run the app (in the Downloads folder) the STEP files are associated with the file in the Downloads folder (i.e its full path name), which you then deleted when you moved it to the Applications folder so the path association is now broken. So If you want to move the file, I found you have to extract the file again from the ZIP archive, then move it, then open it in its new location. You get the "App downloaded from the internet OK to use?" prompt, which you OK. The Finder previewing then works happily. Just don't move the file after you've opened it

Bit of a long-winded explanation, but it might help some confused users

DerekK19 avatar Aug 21 '25 23:08 DerekK19

Thank you very much. Works here too now! Great work!

You might like to add that the App icon will be used for STEP files as well. at the moment they get the text (?) file icon in coulumn view. In every other vie it seems like it’s using the preview.

And would it be possible to change the color of the preview to be bit darker for better contrast with the light background?

Image

tweh avatar Aug 22 '25 04:08 tweh

Tobias: You might want to check that you haven't moved the app after first using it. In my case, I do see a document icon, but the document has a preview in it (a slightly darker white on white). STL files have a sightly different shaped document icon, but also included a preview (again dark white on white!). I use the dark theme on my Macs, but I'd also like a non-monochrome image (that would go for the STL files too!), at least on my Mac I can see the previews

Image

DerekK19 avatar Aug 22 '25 05:08 DerekK19