whomwah / qlstephen

A QuickLook plugin that lets you view plain text files without a file extension
https://github.com/whomwah/qlstephen
MIT License
2.75k stars 161 forks source link

the fix for known/unknown child UTIs to be handled by QLStephen, resolves #87 #135

Open toy opened 2 years ago

toy commented 2 years ago

So cheaply pretending to be a QLGenerator from Apple seems to be the way to make Quick Look use QLStephen also for UTIs with direct, indirect, explicit and implicit (for dynamic UTIs) conformance to UTI registered for it.

If this is the fix, I can only remember that most used language in programming is profanity.

MikaelHashiCorp commented 2 years ago

I tested this fix and it worked for me.

Commands and sample output:

git clone git@github.com:toy/qlstephen.git
cd qlstephen
git switch extensions-fix
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
make && make install
    xcodebuild SYMROOT=../build -project QuickLookStephenProject/QuickLookStephen.xcodeproj -configuration "Release" build
    2022-04-08 18:16:06.766
    ...
    ** BUILD SUCCEEDED **
qlmanage -m
    public.data -> /Users/mikael/Library/QuickLook/QLStephen.qlgenerator (1.5.1)

/Users/mikael/Library/QuickLook/QLStephen.qlgenerator/Contents/Info.plist:

            <key>LSItemContentTypes</key>
            <array>
                <string>public.data</string>
                <string>public.content</string>
                <string>public.unix-executable</string>
            </array>

Finder Screenshot: 2022-04-08_18-25-50

Thank you Ivan.

UPDATE 2023-03-22: After updating my Intel Macbook 2019 to Venture, I had to remake and reinstall QLStephen, but it still works.

glorious1 commented 1 year ago

This is not working for some reason:

`JimsMBPro:Packages jim$ git clone git@github.com:toy/qlstephen.git Cloning into 'qlstephen'... git@github.com: Permission denied (publickey). fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists. JimsMBPro:Packages jim$`

toy commented 1 year ago

@glorious1 Try git clone https://github.com/toy/qlstephen.git instead

glorious1 commented 1 year ago

@toy JimsMBPro:Packages jim$ git clone https://github.com/com:toy/qlstephen.git Cloning into 'qlstephen'... fatal: unable to access 'https://github.com/com:toy/qlstephen.git/': The requested URL returned error: 400 I think the problem must be that my github key expired or something. I'll work on it. Thanks.

toy commented 1 year ago

@glorious1 I failed with copy-pasting 🤦, see the corrected command

glorious1 commented 1 year ago

I set up my github keys again and was able to get it with the original URL, thank you. Also thanks to @MikaelHashiCorp for putting in the build commands; I would have never guessed it requires Xcode and how to do it.

After running these for good measure:

qlmanage -r
qlmanage -r cache

it works like magic! Thank you @toy

EDIT: I found a few text files that didn't work, like xml, srt. I just used mdls to get their kMDItemContentType, like "public.xml" and "dyn.ah62d4um4ge81g6xy", and added them and "public.item" also to ~/Library/QuickLook/QLStephen.qlgenerator/Contents/Info.plist, the LSItemContentTypes array, and they work, which they didn't before.

cvn commented 9 months ago

This works! So many file extensions are working again. 🥲 Thank you, @toy!

On macOS 14.2.1, with Xcode 15.1, my first build failed with a warning about MACOSX_DEPLOYMENT_TARGET. So I opened the project in Xcode and set a Deployment Target. Then I ran make && make install again and it worked.