Rubycocoa script application without nib



A good topic for some sleepless nights. I searched several times the
whole google index for a solution but my efforts were in vain. So I
turn to you, as last resort for salvation, and perhaps this can also
help other tormented souls.

I am writing a thin wrapper around existing toolkits like f.ex Qt,
Cocoa. I use a Mac as my primary platform and want the wrapper to be
well integrated within the Cocoa ecosystem. When run under linux with
Qt bindings installed it should use Qt, when under Gnome it should use
Gtk etc.

This thin wrapper shouldn’t introduce external dependencies like an
external, but it should suffice to gem install it and
require it and use it without external help; so the same ruby
interpreter, the same ruby process the same thread as the script.

For the moment I keep around an empty which sole purpose
is to launch the ruby script containing the Cocoa code, so that when
launched there is a default empty MainMenu which is load by
NSApplicationMain and so that NSTextField get the keyboard input.

99% of the fonctionnality works as expected without the external; only Key focus and
MainMenu is still a mystery to solve. I found a possibility described
on internet that from Objective-C the problem can be solved by
invoking the NSApplicaton method ‘setAppleMenu’ which should do the
trick but when called from RubyCocoa nothing happens.

As my project will reach a useable sate in a few weeks I would be
thankful for any clean solution, before announcing my wrapper, that
goes the Ruby/Gem way without special addition.