launch-services

Mac OS X file association works, but file icon not changed

。_饼干妹妹 提交于 2020-01-23 05:44:09
问题 I have developed a Mac application using Qt 5.3.2. This application handles files with specific extension (lets say .xyz ). I have created an icon file named XYZ.icns and added it to my app bundle Resource folder ( MyApp.app/Contents/Resources/XYZ.icns ). I have also modified the bundle's Info.plist file in order to set the file association. I have added this entry: <key>CFBundleDocumentTypes</key> <array> <!-- Registered file accociation --> <dict> <key>CFBundleTypeRole</key> <string>Editor<

Is there a way to distinguish app being started by Launch Services at login or by user? [duplicate]

巧了我就是萌 提交于 2020-01-13 13:45:23
问题 This question already has answers here : How to tell whether a Mac Cocoa application has been launched normally or as a login item? (6 answers) Closed 9 months ago . Cocoa app can add themselves to LSSharedFileList 's list of login items. This will allow application to be started when user logs in. However, is there a way to tell whether user started the application or the app auto-started at login? This is useful because in one case we can show a user interface in another we can hide the UI

When an OS X app is launched by a registered URL scheme, how do you access the full URL?

旧时模样 提交于 2019-12-29 04:14:07
问题 I'm working on an Cocoa app which is launched/activated using URLs with a custom scheme which is registered in the Info.plist file like so: <key>CFBundleURLTypes</key> <array> <dict> <key>CFBundleURLName</key> <string>Open myscheme:// URLs</string> <key>CFBundleURLSchemes</key> <array> <string>myscheme</string> </array> </dict> </array> My question is, once the app is launched or activated, how do I tell what the URL was that launched the app? On iOS, this is easy with the -application

What exactly should I pass to -[NSApp activateIgnoringOtherApps:] to get my application to start “naturally” in comparison to most other OS X apps?

≡放荡痞女 提交于 2019-12-22 10:52:36
问题 When I learned how to start NSApplications on my own, the code I used (based on here and here) did [NSApp activateIgnoringOtherApps:YES]; which forces the app to the front at startup. I'd like to know what most other apps do. I want to be able to run programs both directly from the binary and from an app bundle, and I'm not using Xcode to build this (raw building). So I'd rather this act naturally, so to speak. The docs do say Finder issues NO , but... why Finder? Isn't this a method that's

Find the filename that launched your OS X app

若如初见. 提交于 2019-12-11 06:19:59
问题 Setting the info of a file you can associate an app with a particular file type so that when clicked the application is launched. My question is how the app can discover the full filename of the file that caused it to be launched. 回答1: Mac apps are not launched every time an associated file is opened. They may be launched, but if they're already running, then they're just asked to open another file. So the path doesn't come to the app via the commandline. It's sent as a message to the

What exactly should I pass to -[NSApp activateIgnoringOtherApps:] to get my application to start “naturally” in comparison to most other OS X apps?

你。 提交于 2019-12-05 21:53:18
When I learned how to start NSApplications on my own, the code I used (based on here and here ) did [NSApp activateIgnoringOtherApps:YES]; which forces the app to the front at startup. I'd like to know what most other apps do. I want to be able to run programs both directly from the binary and from an app bundle, and I'm not using Xcode to build this (raw building). So I'd rather this act naturally, so to speak. The docs do say Finder issues NO , but... why Finder? Isn't this a method that's run from within the process, not outside? (I'm not in control of the choice.) And what about the Dock

Is there a way to distinguish app being started by Launch Services at login or by user? [duplicate]

喜夏-厌秋 提交于 2019-12-05 20:04:43
This question already has an answer here: How to tell whether a Mac Cocoa application has been launched normally or as a login item? 6 answers Cocoa app can add themselves to LSSharedFileList 's list of login items. This will allow application to be started when user logs in. However, is there a way to tell whether user started the application or the app auto-started at login? This is useful because in one case we can show a user interface in another we can hide the UI and run the app in background as a menubar app. Here's some code for this. I'm not sure what it returns for login items, but

Mac OS X file association works, but file icon not changed

独自空忆成欢 提交于 2019-12-05 03:53:29
I have developed a Mac application using Qt 5.3.2. This application handles files with specific extension (lets say .xyz ). I have created an icon file named XYZ.icns and added it to my app bundle Resource folder ( MyApp.app/Contents/Resources/XYZ.icns ). I have also modified the bundle's Info.plist file in order to set the file association. I have added this entry: <key>CFBundleDocumentTypes</key> <array> <!-- Registered file accociation --> <dict> <key>CFBundleTypeRole</key> <string>Editor</string> <key>CFBundleTypeName</key> <string>XYZ</string> <key>CFBundleTypeExtensions</key> <array>

Can you dynamically assign CFBundleDocumentTypes to your Cocoa application?

倾然丶 夕夏残阳落幕 提交于 2019-12-03 16:29:45
问题 Can you dynamically assign CFBundleDocumentTypes to your Cocoa application? Meaning during run time can I assign more extensions for my app to handle. Currently I set some extensions for my app to handle using CFBundleDocumentTypes in the Info.plist, but I would like to do this through code while the application is executing (during run time). Basically can I make Launch Services aware of new extensions without modifying the Info.plist file. Thanks. 回答1: At the moment, there’s no public API 1

Can you dynamically assign CFBundleDocumentTypes to your Cocoa application?

久未见 提交于 2019-12-03 05:34:48
Can you dynamically assign CFBundleDocumentTypes to your Cocoa application? Meaning during run time can I assign more extensions for my app to handle. Currently I set some extensions for my app to handle using CFBundleDocumentTypes in the Info.plist, but I would like to do this through code while the application is executing (during run time). Basically can I make Launch Services aware of new extensions without modifying the Info.plist file. Thanks. At the moment, there’s no public API 1 for an application to dynamically (un)register document types with Launch Services during runtime. Open Emu