7

I guess this is a related question to Can I use GNOME applets in Unity? (moved by suggestion of @Jorge Castro)

I'd like to use stickynotes_applet in Unity.. Now in Gnome, this applet gets added to a bar, then I have to click it to create a new note, and I can call preferences to have the notes stick on the desktop - which is all I need.

Obviously, as mentioned here, it will not be possible to use this applet directly in Unity; but basically, all I'd need to do is to raise the Preferences window (so as to make the notes stick), and to somehow issue a command for a new note (which would otherwise be performed by a click on the applet icon in the Gnome bar).

I have tried running '/usr/lib/gnome-applets/stickynotes_applet' and seemingly it runs, although no applet icon is shown (which is expected), and no any other windows either (which I otherwise hoped will show :) ).

So I was wandering - given that this applet doesn't (seem to) have anything special related to desktop - is there a command line way to basically run this applet, issue a 'Show Preferences' command to it, and issue a new note command to it within a Unity environment (currently I can call tomboy from command line and it works - but its windows are too clunky for my taste)?

(and bonus question - how would you start an applet related window only from the command line in classic Gnome?)

Desktop integration doesn't matter all that much to me - I'd run this manually from the command line gladly, as long as I get small compact notes that stay on the desktop (as long as the process is active)..

Thanks for any comments,
Cheers!

3
  • 1
    You could dive into the code and check how this could be realized... Then it would be easy to just fork this and provide the fix via a PPA. :) I will look into it soon... Apr 22, 2011 at 11:54
  • Thanks for the link, @Sebastian R. - great to have it handy! Essentially, I was hoping to avoid to look through it, by finding a command line way to raise just the 'window' part of the 'application', bypassing the rest of the functionality inherent in applet icons and such.. But I'm guessing that is not possible.. Thanks again - cheers!
    – sdaau
    Apr 23, 2011 at 17:14
  • 1
    added bug May 6, 2011 at 21:04

4 Answers 4

3

You could have a small gnome-panel running your applet only. See How do I use the GNOME Panel in Unity?

2
  • Awesome @Egil - thanks a lot! Still haven't tried it, but that approach seems like it would work for me... Thanks again, cheers! (As soon as I've tested it, I'll add an accept to this answer)
    – sdaau
    May 6, 2011 at 7:19
  • Well, finally I tested this gnome-applet technique - and indeed, it works fine for me on Natty! However, in the meantime I found a command-line based technique, which I posted in this answer, so I accepted that instead.. Thanks again - cheers!
    – sdaau
    Mar 28, 2013 at 22:06
3

I came back to this problem again (still on Natty); so I thought I'd post my results.

First, I started looking up if you can run Gnome applets from the command line, and in a separate window - turns out, this was a technique for debugging Python applets;

invest-applet-unity-standalone

This is the script:

import sys
import gtk
import pygtk
pygtk.require('2.0')
# sudo apt-get install python-gnomeapplet
import gnomeapplet
import CORBA # must have import gnomeapplet before!
import bonobo
import bonobo.ui
import bonobo.activation

bcontrol = bonobo.activation.activate_from_id('OAFIID:Invest_Applet', 0, False)
win = bonobo.ui.Window("foo", "FOOOOO")
buiwid = bonobo.ui.widget_new_control_from_objref(bcontrol, win.get_ui_container().corba_objref())
win.set_contents(buiwid)
win.show_all()
win.connect("destroy", lambda x: sys.exit(0))
bonobo.ui.main()

... and the extended script (with debug output, and a ton of messy comments) is in gtk_bonobo_applet_widget.py.


This is exactly what I wanted, and at first, I thought that it would be applicable to all applets - at least in Natty (and among them stickynotes); but alas, no:

Now, Natty is a bit specific, because it is the last Gnome 2 Ubuntu - however, it also features (the first) Unity. As such:

  • some applets are based on (or exposing a) bonobo/CORBA interface (in Python, via gnomeapplet); those, like invest-applet or brightness-applet, can use the above technique to be raised in their own window - and can be queried through libbonobo2-bin tools (like activation-client)
  • other applets, like stickynotes, have migrated toward GSettings/DBUS base (interface)

In fact, stickynotes migrated from bonobo to dbus shortly before Natty came out (in the revision Port to new libpanel-applet API); which is obvious by the replacement of the PANEL_APPLET_BONOBO_FACTORY macro with PANEL_APPLET_OUT_PROCESS_FACTORY. Arguably, if one checks out the last revision of stickynotes based on bonobo and builds it - one should also be able to use the above technique to instantiate the applet in a separate window, and run it from there, even without gnome-panel.

I would have otherwise believed, that all applets (or rather, applet developing frameworks) should have the capability to run in a separate window like that - if not for any other reason, then to facilitate debugging of applets during development. And given that some applets have command line switches for running in a separate window (both the "beginner's guide" above, and also invest-applet, feature such switches) - I hoped maybe stickynotes features such command line arguments too; however, I did grep through its source files - and alas, I cannot find any mention of command line options.

But then, I wondered - why this migration? Well, it is because bonobo is (or rather, has been) deprecated for a while now:

AppletsDbusMigration - GNOME Live!: (2009)

Gnome Panel drop the libbonobo dependency recently (see bug #572131).

gnome-devel-list mailing list - What will replace bonobo? (2009)

Dbus is not a direct replacement for bonobo. There is no exact replacement of bonobo as such.
...
However, the main usecase of bonobo, which is embedding one application in another (say mine-sweeper in gnumeric, or (slighly more useful) a dia diagram in gnumeric) just is not used all that much.

gnome-components mailing list 'Re: What will replace bonobo?' (2005)

> About DBUS it's hard to say that it will be replacement some day.
> First problem is that it's not component system, just message passing API.
Trust me, there are definitely plans to implement an IDL compiler of some sort to imitate CORBA-style RPC on top of D-BUS messages. It will happen sooner or later.

Well, shucks - I myself think, the "embedding one application in another" was very useful in this case - to run (at least some) applets in Unity, with support for them removed :) Of course, it was a more-less a "lucky" arrangement of desktop packages in Natty that allowed for that (given that it is still Gnome 2 and still has the bonobo libraries) - obviously, later versions that are Gnome 3 based have bonobo removed completely - and the above Python-script-instantiation-in-a-window technique will most definitely not work there :/

The final question is - could we similarly use a Python script, but with bindings for dbus, to achieve something similar to the above bonobo based script?

Closest I got to that, is with the script gtk_dbus_applet_widget.py, however, that script doesn't raise an applet in a window - and cannot even add an applet to the bar! The only thing it can do, is talk to the applet "factory" via dbus, and instruct it to create an applet; but this applet remains simply as data somewhere on the filesystem (and it persists across reboots!), and never becomes instantiated as a Gnome widget... And given the comments above, I doubt something like that is currently (well, on Natty at least) possible with dbus.

In conclusion - I guess this, along with the gnome-panel technique, exhausts the possibilities of frivolously running applets under Unity in Natty.

2

Rhinote has keyboard shortcuts

3
  • Thanks for the suggestion, @aking1012 - I was more interested in the principle of running (what I see as) relatively simple Gnome Applets under Unity, though...
    – sdaau
    Apr 18, 2011 at 6:45
  • 1
    If you want applets, disable unity as referenced here: khattam.info/… Apr 18, 2011 at 12:54
  • Thanks for the nice link, @aking1012! However, I am basically starting from the assumption that Gnome applets, in the end, show a Gnome window - and a plain Gnome window should (I guess) run under Unity too :) So, in essence, all I'm asking is for a way to run the 'window' part of the 'application' - bypassing all kinds of icon/event hooking that would be inherent in the applet architecture (which I think is possible for stuff like stickynotes - but obviously not for, say, system monitor applet). Thanks again for the comment - cheers!
    – sdaau
    Apr 23, 2011 at 17:12
0

For those who are still looking for something similar, handy and supporting Note Category feature, there is Indicator Sticky notes.

Installation:

sudo add-apt-repository ppa:umang/indicator-stickynotes

sudo apt-get update

sudo apt-get install indicator-stickynotes

Hope it'll help... Enjoy!

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .