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

Cannot launch Alacritty via Phoenix #209

Closed
mafredri opened this issue Apr 21, 2018 · 19 comments
Closed

Cannot launch Alacritty via Phoenix #209

mafredri opened this issue Apr 21, 2018 · 19 comments

Comments

@mafredri
Copy link
Contributor

mafredri commented Apr 21, 2018

I've noticed that Phoenix is unable to launch Alacritty via App.launch('Alacritty').

When I do, I see the following error in Phoenix:

2018-04-21 12:00:12.847549+0300 0xde8ad    Default     0x0                  28697  Phoenix: Error: Could not launch app “Alacritty”. (Error Domain=NSCocoaErrorDomain Code=256 "The application “Alacritty” could not be launched because a miscellaneous error occurred (OSStatus -10810)." UserInfo={NSURL=file:///Applications/Alacritty.app/, NSLocalizedDescription=The application “Alacritty” could not be launched because a miscellaneous error occurred (OSStatus -10810)., NSUnderlyingError=0x608000247890 {Error Domain=NSOSStatusErrorDomain Code=-10810 "kLSUnknownErr: Unexpected internal error"}})
2018-04-21 12:00:22.821005+0300 0x134af4   Default     0x0                  28697  Phoenix: (LaunchServices) [com.apple.launchservices:default] LSExceptions shared instance invalidated for timeout.

This could of course be an issue with Alacritty as well, but then again: open -a Alacritty works. I've tried to inspect the Alacritty Info.plist but haven't found anything obvious missing.

Do you have any ideas @kasper? If you don't think this is fixable in Phoenix I'll open up an issue at the Alacritty repo.

  • Version: 2.6.1
  • macOS: 10.13.4
@kasper
Copy link
Owner

kasper commented Apr 21, 2018

@mafredri Phoenix doesn’t do anything fancy to open applications other than call the API (https://github.com/kasper/phoenix/blob/master/Phoenix/PHApp.m#L55-L58). I guess the app has somehow broken the application URL? The error code doesn’t tell much more than it’s an unknown error (https://www.osstatus.com/search/results?platform=all&framework=all&search=-10810). Hard to say what could be wrong. Could you try reinstalling Alacritty?

@mafredri
Copy link
Contributor Author

That's what I was afraid of, dang :/

Could you try reinstalling Alacritty?

Not really, there's no official release so I've basically just:

carbo build --release
make app
rm -r /Applications/Alacritty.app
mv target/release/osx/Alacritty.app /Applications/

I've tried rebuilding, etc, but that does not help.

I forgot to add this to my issue, but the Alacritty icon in the Dock tries to bounce (it jumps once) but then nothing happens (except Phoenix error).

@kasper
Copy link
Owner

kasper commented Apr 21, 2018

For now you could just run open -a Alacritty as a task.

@mafredri
Copy link
Contributor Author

Yeah, that's what I'm doing now. It works OK since App.get('Alacritty') at least works when the app is running :).

@kasper
Copy link
Owner

kasper commented Apr 23, 2018

I wonder if the app doesn’t respond properly for NSWorkspaceLaunchWithoutActivation.

@mafredri
Copy link
Contributor Author

I tried changing it to: NSWorkspaceLaunchDefault, NSWorkspaceLaunchNewInstance and NSWorkspaceLaunchAsync, makes no difference (although, with Default and Async Phoenix does not print an error).

@jasonm23
Copy link
Contributor

I think this is a problem with Alacritty.

Apr 23 18:40:50 com.apple.xpc.launchd[1] (com.apple.xpc.launchd.oneshot.0x1000002f.alacritty[78448]): Service exited with abnormal code: 1

@jasonm23
Copy link
Contributor

Spotlight and Alfred launch it ok... I wonder what they do.

@kasper
Copy link
Owner

kasper commented Jun 8, 2018

Let me know if you figure out what Alacritty is doing to cause this.

@kasper kasper closed this as completed Jun 8, 2018
@mhartington
Copy link

Not to resurrect an old issue, but also seeing this issue with kitty terminal as well. Once the app is launched with spotlight or some other mechanism, it can be focused.

@mafredri
Copy link
Contributor Author

mafredri commented Nov 10, 2020

@mhartington it's likely a problem with Kitty, but as a workaround you can try to focus it by launching it (App.launch('Kitty', {focus: true});).

Edit: Replied without looking at what the original issue was about 🤦🏻‍♂️. Anyway, that's what I used to do with Alacritty before switching back to iTerm. Not sure if using {focus: true} will help you or not :/.

@mhartington
Copy link

Yeah, tried that and still no dice.

Key.on('f', ['alt'], () => launch('kitty'));
const launch = (appName) => {
  App.launch(appName, { focus: true })
};

It looks like it will try to start kitty, but for what ever reason, kitty will quickly fail before it fully "launches". The same behaviour is observed with alacirtty.

ScreenFlow

@lukesmurray
Copy link

I can also reproduce with kitty. Same behavior as @mhartington . I'm getting the same error as #264.

Error: Could not get process identifier for accessibility element (null). (-25201)

@lukesmurray
Copy link

Can reproduce with Slack and Spotify. Simple reproduction. Just close an application and try to open it with phoenix.

Key.on("k", ["alt", "shift"], function () {
  const appName = "Spotify"; // set this to any application
  let app = startApp(appName, { focus: true });
});

/**
 * Get or launch the application with the passed in name.
 * Returns undefined if the application fails to start.
 * @param {string} appName the name of the application to start
 * @param {{focus: boolean}} options focus determines whether or not to focus the app on launch
 */
function startApp(appName, { focus }) {
  let app = App.get(appName);
  if (app === undefined) {
    app = App.launch(appName, { focus });
  }
  return app;
}

@lukesmurray
Copy link

Ok this occurs in two events. When the mainWindow is closed but the app is still open. For example clicking X on spotify leaves spotify open but closes the window. It also occurs on launch when the application is completely closed.

@kasper
Copy link
Owner

kasper commented Feb 20, 2021

@lukesmurray Thanks for the information, I will look into it!

@kasper
Copy link
Owner

kasper commented Mar 21, 2021

@lukesmurray In the above code snippet, I think you are making the assumption that if the app is running that App.get(…) will focus it. To bring the app to the front, you would need to also call .focus(). If I do that, I think everything works as expected.

@mono-chrome
Copy link

Also getting this issue with kitty. Focus toggle once the app is running works fine, trying to launch kitty results in the same error that others have reported in this thread.

Console reports this error:
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=0x6000012e3b40 {Error Domain=NSOSStatusErrorDomain Code=-10810 "kLSUnknownErr: Unexpected internal error" UserInfo={NSURL=file:///Applications/kitty.app/}}})

(Following that file url shows the application exists and other launchers open it just fine)

@lukesmurray
Copy link

@mono-chrome I got around this with a little bit of logic and an apple script helper. maybe that will help you.

https://github.com/lukesmurray/bootstrap/blob/8f99acd194e0e2c73c7a0abf689d78544fc7b9f5/.phoenix.js#L262-L321

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

No branches or pull requests

6 participants