How to enable “use low resolution” on Retina display for an Application when shipping it?

前端 未结 3 1224
鱼传尺愫
鱼传尺愫 2020-12-09 06:25

I have an application that breaks in HiDPI mode unless I chose \"get Info\" in finder and there tick the \"open in low resolution\" checkbox. Fixing the application is not a

相关标签:
3条回答
  • 2020-12-09 07:01

    I'll answer these the wrong way around

    b) the preference key is called LSHighResolutionModeIsMagnified and is stored as per-app entries in ~/Library/Preferences/com.apple.LaunchServices/com.apple.LaunchServices.plist

    a) you can write the preference for an app. I use plistbuddy as follows to set low resolution (the number 3) for OpenSCAD.app which has a bundle id of org.openscad.OpenSCAD

    /usr/libexec/PlistBuddy -c "Set :LSHighResolutionModeIsMagnified:org.openscad.OpenSCAD:1 3" ~/Library/Preferences/com.apple.LaunchServices/com.apple.LaunchServices.plist
    

    This information is adapted from an answer to a similar question I posed at: https://apple.stackexchange.com/questions/398846/where-is-the-open-in-low-resolution-setting-stored-for-an-app?noredirect=1#comment551034_398846

    0 讨论(0)
  • 2020-12-09 07:04

    Takes a little more finesse, you need to reset the -user- domain.

    /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -f /Applications -all local,user

    0 讨论(0)
  • 2020-12-09 07:20

    I'm not currently in a position to check, but it's likely that the presence or absence of the NSHighResolutionCapable key is cached in the Launch Services database. That's where most properties of an app which are specified in the Info.plist are stored. The fact that copying the app to a USB thumb drive worked seems to confirm that theory.

    You might search the output of the following command for your app's bundle ID and then see if there's anything obviously related to high resolution capability:

    /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -dump
    

    If there is, then, after you modify an app's Info.plist, it might work to do:

    /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -f /path/to/the/modified.app
    

    If not, then perhaps the more powerful:

    /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -seed
    

    If none of that helps, then (from our above comments) it seems that trying in a new user account works.

    0 讨论(0)
提交回复
热议问题