kasper / phoenix

A lightweight macOS window and app manager scriptable with JavaScript
https://kasper.github.io/phoenix/
Other
4.36k stars 128 forks source link

Cannot open kitty via Phoenix #308

Closed mono-chrome closed 2 years ago

mono-chrome commented 2 years ago

When using App.launch('kitty'); I cannot get kitty to open. I can observe the application opening and immediately terminating in the Dock.

Console logs the following:

LAUNCHING:0x0-0xc20c2 kitty foreground=1 bringForward=0 seed=449 userActivityCount=0

OSStatus _LSLaunch(LSContext *, FSNode *, LSLaunchFlags, void *, CFArrayRef, const AppleEvent *, const AEDescList *, CFArrayRef, CFDictionaryRef, LSBundleID, const audit_token_t *, const _LSOpen2Options *, ProcessSerialNumber *, Boolean *, NSError **): launching '<private>' result=0

Error: Could not launch app “kitty”. (Error Domain=NSCocoaErrorDomain Code=256 "The application “kitty” could not be launched because a miscellaneous error occurred." UserInfo={NSURL=file:///Applications/kitty.app/, NSLocalizedDescription=The application “kitty” could not be launched because a miscellaneous error occurred., NSUnderlyingError=0x600000ab3c00 {Error Domain=NSOSStatusErrorDomain Code=-10810 "kLSUnknownErr: Unexpected internal error" UserInfo={NSURL=file:///Applications/kitty.app/}}})

Following the file path, reveals that the application exists exactly where Phoenix tries to open it.

If kitty has been opened manually (any other launcher works in this case) focus toggle and application switching works well.

I have tried using Task.run(), but could not get that to work using Task.run('/bin/zsh', ['open', '-a', 'kitty']) (or using ['open -a kitty']). Alternatively running the open command in terminal would open the application just fine.

mafredri commented 2 years ago

No issues on macOS 12.4 (kitty 0.25.0). Might be a kitty bug when running on macOS 10.15.7.

If you want to try Task.run again, zsh needs -c (e.g. Task.run('/bin/zsh', ['-c', 'open -a kitty']) or you can try open directly: Task.run('/usr/bin/open', ['-a', 'kitty']).

mono-chrome commented 2 years ago

@mafredri Indeed. I've tried this in a VM with a different OS and that works fine. I've also tried your suggestion for running the Task options and both work too. Thank you so much!