Hi list,
is it possible to have Pharo run headless while still showing up in the dock? In the same direction, is it possible to add contextual menu items to the dock menu? Or for what matters, to the top system menu?
Thanks! Bernat Romagosa. |
not directly but you can use the Alien ObjC bridge to work with the cocoa libraries and intercept your app.
use ConfigurationOfOldAlien from alien repo in squeaksource or in the configurations browser. Esteban On 27 May 2014, at 07:02, Bernat Romagosa <[hidden email]> wrote: > Hi list, > > is it possible to have Pharo run headless while still showing up in the dock? > > In the same direction, is it possible to add contextual menu items to the dock menu? Or for what matters, to the top system menu? > > Thanks! > > -- > Bernat Romagosa. |
In reply to this post by Bernat Romagosa
Hi Bernat, About a year ago I did implement that on the Pharo VM (the Pharo's branch of Cog). It was integrated as far as I remember. I copied pasted here the ANN I sent to the mailing list:
Hello there,
For a long time, Pharaoers and Squakers have been asking for headless support in the Cocoa VMs just as we have with Carbon VMs. Carbon is becoming a legacy framework so people needed this. I wanted to thanks Square [i] International for sponsoring me to implement such a support. Not only have they sponsored the development but they have also agreed to release it under MIT license for the community. This headless support will be included in the official Pharo VM and will be, therefore, accessible to everybody.
The project is not yet finished but I do have a demo/prototype that I wanted to share with you so that you can test it and give me feedback. This VM should only work starting at OSX 10.6.
How to use it? Basically it works this way: to have headless, just edit the Info.plist and set the flag LSBackgroundOnly to 1 (add the key if it is not present):
<key>LSBackgroundOnly</key>
<true/> When doing this, you don't even need the -headless anymore since, setting LSBackgroundOnly to 1, will cause the same effect (being the flag almost mandatory). If you don't want headless, put it to false or don't even put the key. If you don't set LSBackgroundOnly to 1 but send -headless, the VM will still be headless but you will see a little flash. If this flash bothers you, then set the flag. I am trying to get a way to avoid the "flash" while also avoiding to set LSBackgroundOnly to 1, but I still couldn't find it. Anyway, I think we can live with the current situation.
How to test it? You should run the image with something like RFB or Seaside or whatever you can and then confirm if it is working even if you areheadless. As a matter of testing, I saved an image with seaside running in the port 5555. You can get both, this Seaside image and the VM withheadless from: https://www.dropbox.com/sh/r7qk49bxywk2xce/6N7-fdyx6V
So if you run the VM headless with that image and go to localhost:5555, you should see that Seaside is running. I would appreciate if you can test it. And please let me know in which version of OSX you tried. Of course, the more of you who can test it, the better. Notice that this VM was compiled with LLVM GCC 4.2 and it may have some problems in older OSX versions (but I think it shouldn't). I still couldn't compile a VM with GNU GCC 4.2 as I get a crash :(
Expected results? In headless mode, anything should be displayed (no window, no menu, no item in the dock and nothing appear when switching apps). When running headfull, everything should be normal.
Where is the code? The code I have modified to the VM is committed to my own fork of the VM: https://gitorious.org/~marianopeck/cogvm/marianopecks-blessed
Once the code is ready, I will do a pull request so that it can be integrated.
On Tue, May 27, 2014 at 7:02 AM, Bernat Romagosa <[hidden email]> wrote:
Mariano http://marianopeck.wordpress.com |
Hi Mariano, Thanks, I used this method, but my problem is I do need an icon in the dock :) I'm using Pharo as a server, and I'd need the user to be able to stop it without any command-line knowledge.
Esteban, I'll try with Alien. I'm curious though, doesn't NativeBoost replace Alien now? Thanks! Bernat. 2014-05-27 14:35 GMT+02:00 Mariano Martinez Peck <[hidden email]>:
Bernat Romagosa. |
On 27 May 2014, at 10:13, Bernat Romagosa <[hidden email]> wrote:
yes, but the ObjC bridge for NB is not working (yet, and until I found time to do it :( ) better to use the Alien FFI until then, so you can do something like: #NSApplication asObjectiveC sharedApplication dockTile … (and etc.) :) Esteban
|
OK! I'll try that! You sure deserve some credit in the Snap4Arduino MacOSX version... ;) Thanks a lot! Bernat. 2014-05-27 15:32 GMT+02:00 Esteban Lorenzano <[hidden email]>:
Bernat Romagosa. |
Installing Alien proved to be quite a challenge... but I managed! Here's what I have: #NSApplication inObjectiveC sharedApplication dockTile What kind of methods does this take? I see ObjectiveCAlien is a proxy, so I can't really browse what messages can I send it. Any hints?
Thanks!!! Bernat. 2014-05-27 15:44 GMT+02:00 Bernat Romagosa <[hidden email]>:
Bernat Romagosa. |
On 30 May 2014, at 08:00, Bernat Romagosa <[hidden email]> wrote:
why? configuration should work out of the box.
you can browse the Cocoa documentation (I use http://appkido.com but you need xcode installed and docs intalled too). Esteban
|
Hi Esteban, The configuration didn't work out of the box. I had to load the bleeding edge version from the configuration, then manually load the latest Core and all MacOSX packages from the MC repo.
I'll check appkido, thanks a lot! :) Bernat. 2014-05-30 14:17 GMT+02:00 Esteban Lorenzano <[hidden email]>:
Bernat Romagosa. |
Free forum by Nabble | Edit this page |