Giter VIP home page Giter VIP logo

fruitbasket's Introduction

mrmekon's repos

GitHub is a mirror. The official home of my repos is here.

Repo Description Language
itsy-gitsy A static site generator for Git repositories Rust
circadian Suspend-On-Idle Daemon for GNU/Linux Power Management Rust
ossuary Rust library for establishing encrypted communication channels Rust
connectr A super lightweight Spotify controller Rust
fruitbasket Rust framework for running in a Mac "app bundle" environment Rust
rubrail Rust library for interfacing with the Mac Touch Bar Rust
tempest-cljs Tempest arcade game, in ClojureScript Clojurescript
libsimplepgp C library for loading PGP keys and decrypting PGP messages C
snitch-el Firewall for emacs elisp
qemu-stormcrow USB passthrough daemon for libvirt Rust
toucHNews Hacker News news feed for the Mac Touch Bar Rust
hn-rs Rust bindings for the Hacker News API Rust

fruitbasket's People

Contributors

jorgenpt avatar logandark avatar maaku avatar mrmekon avatar sim-o avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

fruitbasket's Issues

Bundling another executable (ie, not the current executable)

See my fork. My primary usage was to bundle another executable, rather than bundling the current executable and then immediately launching the bundle. This is because I want to distribute a rust program to mac users in the form of a .app bundle. The current API requires the end user to run an executable (instead of .app).

My fork above moves the src_exe variable in self_bundle() and build() to the function's parameters. The code that immediately launches the bundle is now from a method of FruitApp instead of Trampoline.

The code for the bundler program would be like:

fn main() {
    fruitbasket::Trampoline::new("myapp", "myapp", "com.me.myapp")
    .resource(icon)
    .self_bundle("path/to/myapp", fruitbasket::InstallDir::Custom("dist".to_string()))
    .unwrap();
}

When the bundler program is run, it will bundle the myapp executable into a .app, which can be double clicked to launch.

The main app needs to be modified like this so that the resource path can be accessed etc:

fn main() {
    let app = fruitbasket::FruitApp::new();
    let bundle_path = std::path::Path::new("dist/myapp.app");
    fruitbasket::FruitApp::launch_bundle(bundle_path);

    let path = fruitbasket::FruitApp::bundled_resource_path("icon", "");
    original_main(path);

    fruitbasket::FruitApp::terminate(0);
}

I think letting the user to pass in src_exe will make this library more flexible - it's up to them if they want to bundle the current executable or another executable. Please let me know your thoughts on this.

Publish on crates.io

Hello!
Would it be possible to publish the most recent version on crates.io if it's considered stable enough? I depend on this crate for handling file open functionality on Mac OS (woelper/oculante#16) and would be very happy if I could remove the git dependency! Thanks in advance!

Should there be a HiDPI convenience method?

Currently, HiDPI support can be declared to macOS by specifying two properties in the plist:

	.plist_key("NSHighResolutionCapable", "True")
	.plist_key("NSPrincipleClass", "NSApplication")

Without these two properties, macOS will default to displaying your application in 1x mode and scaling it up on Retina displays. This makes it really blurry and honestly looks bad.

Compare this, the default:
image

To this, with the properties:
image

As you can see, there is a shockingly large difference between the two, and the first one definitely doesn't look very appealing.

Even though fruitbasket is not itself a GUI library, it's still used in applications that do use GUI libraries, so perhaps there should be a method in the builder specifically for this. Something like fn hidpi(&mut self, doit: bool). You'd be hard-pressed to find a Mac without a Retina display these days, and not everyone knows the HiDPI trick.

What are your thoughts on this? Is this within the scope of fruitbasket to provide these convenience methods, even though they have nothing to do with fruitbasket itself? I'd argue that it is, since fruitbasket is intended to bootstrap applications that often need these properties, but I'd love to hear your thoughts on the matter.

tag new version

v0.8.0 is currently broken on stable, due to afcb6df. Can a new version be published to make this change go live?

Output from the child process is lost after trampoline

I just ran into an issue and it took me a while to figure out what was happening. In #15, @mrmekon helpfully points out that output from the child process is not piped to the original stdout/stderr of the parent process, which causes the output to essentially be lost. Debug prints cannot be seen when launching from IntelliJ, since the app is handed off to macOS and then the parent process terminated.

I'm opening this issue to both represent the issue I just had, and act as something for their pull request to close, because it's always nice to close a real issue with a pull request :D

Support for nested plist array definitions

Hi! First off, awesome crate - thanks so much for making it.

I want to register a custom URI protocol to my app (i.e. CFBundleURLTypes), but the plist api in fruitbasket doesn't appear to support this directly, or by allowing arrays instead of just strings.
https://github.com/mrmekon/fruitbasket/blob/master/src/osx.rs#L380

Basically, I need to represent something like this:

<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleURLName</key>
        <string>My Proto</string>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>myproto</string>
        </array>
    </dict>
</array>

Do you have ideas on the best way to go about this?

Old-style plist parser: missing semicolon in dictionary on line 2. Parsing will be abandoned.

2020-07-13 10:51:35.982 rust-fruitbasket-test[5183:19013837] CFPropertyListCreateFromXMLData(): Old-style plist parser: missing semicolon in dictionary on line 2. Parsing will be abandoned. Break on _CFPropertyListMissingSemicolon to debug.
2020-07-13 10:51:35.982 rust-fruitbasket-test[5183:19013837] There was an error parsing the Info.plist for the bundle at URL <0x7fee68001320>: NSCocoaErrorDomain - 3840

This happens when you use spaces in the name. Fruitbasket doesn't quote the name in the plist, causing the parser to get confused. When there are no spaces in the name, the plist parser doesn't get confused. When you put double quotes in the name (as in "\"Fruitbasket Test\"") it doesn't get confused because it's quoted in the plist, but then it names the app bundle with those quotes as well.

Handling openFile events

This is actually more of a question, but I am very happy to contribute an example once I can work out if this is possible.
There is already a nice example how to register URL callbacks, but I am unable to find a way to register and handle opening filetypes.

I've read https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/DocumentInteraction_TopicsForIOS/Articles/RegisteringtheFileTypesYourAppSupports.html#//apple_ref/doc/uid/TP40010411-SW1 and believe I can add all the relevant plist entries, but I am unsure about actually handling application:openFile: events. Would this be something that is possible using fruitbasket?

Request for a `core-foundation` example

I believe it would be helpful to have a core-foundation example (as in, that one project created solely for Servo's use, but that is also useful for general purposes) as those are the bindings I plan on using for my own projects.

As those seem to be the only bindings out there for macOS (as far as I know), it's only natural that it's what you'd use after fruitbasket, in my opinion. (assuming you're directly making a native macOS app)

It may still be a little opinionated, but I would like to request an example showing how to use core-foundation with fruitbasket.

Do you have an example of an app that uses fruitbasket and works as a document type handler?

I've been checking out this x-platform image viewer on a Mac and it has a peculiar issue: you can register it as a PNG file handler, and it works for the first image, but then if the app is already opened, you can't open a second PNG file, it shows a warning window instead, complaining that "App cannot open files in the “PNG image format”"

207240233-91df46aa-09ec-4979-9f28-a49a050c2a8f

woelper/oculante#33

Do you have an example of a Mac app that uses your framework and is able to register itself successfully as the default document type handler? That might help the dev find out what's wrong with his app
Or maybe you have an idea what's wrong :)

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.