After two weeks without working on it, this evening I finally returned to GtkUnique and finished the bacon-like backend. Now, beside using D-Bus and Xlibs, you can use Un*x sockets as an IPC method to send a command to a running instance of an application which is using GtkUnique.
Next items in the TODO are:
- Add more documentation on the protocol used in the three backends;
- Fix the Perl bindings;
- Finish and publish the Python bindings;
In the meantime, you can grab GtkUnique 0.5.0 here or pull it from the bazaar repository.
Nice one. Have you got a .deb of the library up somewhere? My packaging skills are not good enough for debian just yet. :-)
I intend on converting gnome-power-manager from guniqueapp to GtkUnique for the 2.17.x cycle. Keep rocking!
Admittedly I haven’t looked at the code yet, but I have a question nonetheless…
Would it be possible to generalize to unique gobjects instead of applications?
richard: not yet – I’m not really good with building debian packages too. :-) I still have to check whether subclassing is possible – then I’ll ask for a CVS module on cvs.gnome.org. if you want to depend on gtkunique I’ll ask for a “blessed dependency” to the release-team.
mikkel: what you want is D-Bus, if I understand what you’re asking. :-)
Hi, I have a bit of concern with this GtkUnique thing. I run a dual-head, non-xinerama setup, because I feel it makes me the most productive to be able to split my virtual desktops in such a manner. This means that each monitor has its own display id of :0.0 and :0.1.
Certain applications which display this Unique style behavior, most notably Firefox, do not let me run another instance on my second monitor, it just errors out and says one is already running. This is BEYOND annoying, and I just wanted to see how GtkUnique interacts with this problem.
thanks.
Emmanuele: Yeah, that’s a point. Well I guess what I really want is serializable gobject where my_object_new() returns the unique session wide object… But that’s probably not really related to what you are doing, now that I come to think of it… Or?
Correcting my self: Well my previous comment makes more sense with s/my_object_new/myObject.getInstance/g
mikkel: you can implement a singleton pattern, overriding the constructor vfunc like it’s explained in the GObject tutorial; in the constructor you can use D-Bus to check whether there’s an object registered on the bus and get a proxy for it.
in any case, what I’m doing has more to do with application instances, that is decide whether or not a GTK application is already running, and if it is, then send a message to it with a command the user might have decided to execute (open a new document, open a document with a give uri or just raise the window).
dave: I don’t have a dual-head setup, so I cannot really test it. in gtkunique HEAD I added a “screen” parameter to the message that gets passed between the running instance and the launched instances, which should be used to place application windows on the “right” screen. you should try and download the latest gtkunique code from cvs.gnome.org (the module is gtkunique) and test it. I’d really like feedback from multi-head setup owners. :-)