Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider adding airyx LaunchServices #116

Open
probonopd opened this issue Aug 16, 2021 · 3 comments
Open

Consider adding airyx LaunchServices #116

probonopd opened this issue Aug 16, 2021 · 3 comments

Comments

@probonopd
Copy link
Member

probonopd commented Aug 16, 2021

https://github.com/helloSystem/Filer/compare/master...mszoek:airyx?expand=1 introduces LaunchServices to Filer 🥇, hence addressing long-standing issues with how applications and documents are associated. It does so by introducing ObjC code whereas the rest of Filer is written in Qt/C++, and by introducing depenedencies on other Airyx components such as <LaunchServices/LaunchServices.h>.

#define COCOA
#import <LaunchServices/LaunchServices.h>
#import "cocoa.h"
  • Can we replace the ObjC code by Qt/C++ code to make it consistent with the rest of the code?
  • Can we satisfy <LaunchServices/LaunchServices.h> with a Qt/C++ implementation of the same?
  • Can we replace plist XML with something modern like json?

cc @mszoek

@probonopd probonopd changed the title Consider adding airyx LaunchServices, or implement the same database format Consider adding airyx LaunchServices Aug 16, 2021
@mszoek
Copy link

mszoek commented Aug 16, 2021

https://github.com/helloSystem/Filer/compare/master...mszoek:airyx?expand=1 introduces LaunchServices to Filer 🥇, hence addressing long-standing issues with how applications and documents are associated

Well... maybe starting to address them! :)

* Can we replace the ObjC code by Qt/C++ code to make it consistent with the rest of the code?

The ObjC++ in cocoa.mm is a stub that lets the rest of C++ Filer access the LS and Foundation frameworks. That code is used to e.g. load a .app bundle and extract its program arguments, display name, and icon file.

Most of the APIs provided by LS are actually plain C so they could be called directly from C++. (There are currently some NSString references in LaunchServices.h but they could be changed to CFStringRef to avoid needing Foundation.) I can probably switch from using Foundation NSBundle to use CoreFoundation (plain C) CFBundle as well. So that would get ObjC code out of Filer itself.

You would still need to have the frameworks themselves in /System/Library/Frameworks.

* Can we satisfy `<LaunchServices/LaunchServices.h>` with a Qt/C++ implementation of the same?

Wouldn't this involve duplicating all the work I've done on LS, rewriting it in C++ with Qt?

* Can we replace plist XML with something modern like json?

Of course! A property list is just a dictionary of keys and values. Just add a suitable Reader and Writer here: https://github.com/mszoek/airyx/tree/main/Frameworks/Foundation/NSPropertyList

Incidentally, I am also planning to make Filer use NSFileManager in Foundation and remove the libfm dependency.

@probonopd
Copy link
Member Author

So that would get ObjC code out of Filer itself.

Sounds great.

We should definitely try to work toward a common codebase, as you are making changes I always wanted to make but never came around to (e.g., rename filer-qt to Filer, parse Info.plist, add LS, remove libfm,...).

You would still need to have the frameworks themselves in /System/Library/Frameworks.

How would one compile them on helloSystem?

@mszoek
Copy link

mszoek commented Aug 18, 2021

Check out the PR I submitted this evening. ObjC has been rewritten as C++ calling out to Qt and CoreFoundation. I also wrapped everything in ifdefs so it only builds my changes on Airyx. Let me know if it works OK on helloSystem; everything seems fine here!

To build the frameworks on helloSystem, you should be able to just do make prep frameworks installairyx in the top of the airyx git repo. See my .cirrus.yml for a list of build dependencies to be installed from pkg. Filer needs LaunchServices and CoreFoundation which in turn need Foundation and CFNetwork. Add -D__AIRYX__=1 to CFLAGS or use the Airyx clang toolchain (it automatically defines that) to build my version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants