tonylukasavage / triple

REPL for Titanium
MIT License
96 stars 21 forks source link

Return focus to terminal #25

Closed skypanther closed 10 years ago

skypanther commented 10 years ago

When launching triple, focus is given to the simulator that's opened. Instead, focus should be returned to your terminal window so that you can more easily start entering commands.

tonylukasavage commented 10 years ago

I'll need to talk to @cb1kenobi about that. That's part of the ios sim launch process, but perhaps there's a clean way to avoid it.

jhaynie commented 10 years ago

here's how to do it: https://github.com/appcelerator/ioslib/blob/master/lib/simulator.js#L208

tonylukasavage commented 10 years ago

I'm actually working on a PR right now to add a titanium CLI option to skip the activation step, found here: https://github.com/appcelerator/titanium_mobile/blob/master/iphone/cli/hooks/run.js#L125

That'll be easier than pulling in the activation code.

tonylukasavage commented 10 years ago

created a TIMOB ticket and submitted PRs to both master and 3_3_X: https://jira.appcelerator.org/browse/TIMOB-17397

Since this is non-critical behavior, I'm OK with requiring TiSDK 3.3.1+ for it. I don't to add special iOS sim handling in here just for the sake of 3.3.0.

tonylukasavage commented 10 years ago

In the meantime, if you're up for a quick and dirty hack, you can comment out this small section in your target SDK, my case my 3.3.0.GA SDK:

~/Library/Application Support/Titanium/mobilesdk/osx/3.3.0.GA/iphone/cli/hooks/run.js
/*
// focus the simulator
logger.info(__('Focusing the iOS Simulator'));
exec([
    'osascript',
    '"' + path.join(build.titaniumIosSdkPath, 'iphone_sim_activate.scpt') + '"',
    '"' + path.join(build.xcodeEnv.path, 'Platforms', 'iPhoneSimulator.platform', 'Developer', 'Applications', 'iPhone Simulator.app') + '"'
].join(' '), function (err, stdout, stderr) {
    if (err) {
        logger.error(__('Failed to focus the iPhone Simulator window'));
        logger.error(stderr);
    }
});
*/
jhaynie commented 10 years ago

i'm not sure if we can skip activation step without some timeout or something. FWIW

tonylukasavage commented 10 years ago

@jhaynie everything works fine skipping that step, it just doesn't focus the simulator. That activate script does nothing more than bring the sim to the foreground.

Also, if you look in the code for the run.js hook, the focus step there is executed asynchronously, but not in any kind of series, meaning nothing in the rest of the execution path is contingent on its completion.

jhaynie commented 10 years ago

OK, i missed understand.