Xfce Forum

Sub domains

You are not logged in.

#1 2012-09-03 09:12:21

Registered: 2012-09-03
Posts: 1

Applet controlled by an external program

XFCE provides panel applets for a the most common features one can expect in a modern desktop. Quite regularly, I find myself looking for a feature that is not provided by the standard applets.

For example, the mount applet is not suitable to control userland FUSE filesystems (sshfs, encfs, ...) that are by definition not listed in /etc/fstab. I would be happy to know if there is a way to do that in XFCE but that is not the main point of that post.

I could install a third party plugin or create one from scratch but that would require quite some work and maintenance. The plugin API (http://wiki.xfce.org/dev/howto/panel_plugins) itself is not difficult but coding the applet itself requires quite some knowledges about Gtk (and a makefile, and to be programmed in C, ...) 

My idea is that it should be possible to create a new XFCE applet that would be entirely controlled by an external program written in any language. All communications would be via stdin and stdout and the protocol should be simple enough to be handled by a shell script (even though Perl or Python are probably more suitable for that kind of tasks).

Here is a non exhaustive list of actions that could be sent by the applet to the program:

  - mouse click on the applet
  - a menu entry was selected/toggled 
  - the applet is destroyed
  - the applet becomes visible/invisible

And here is a list of actions that could be sent by the program to the applet:
  - query and control the applet/panel geometry (horizontal/vertical, size, borders, background color, ....) 
  - create or destroy an icon (from a stock icon, from a file, from base64 image data)
  - display a previously created icon
  - display and control a label (text, position, font, ...)
  - set the tooltip
  - create and control an optional menu (controlled by the mouse)
  - query the applet/panel geometry (horizontal/vertical, current width/height)
  - execute some system actions (e.g. logout, lock, ...)

Some simple examples could be provided in various languages (bash, python, perl, C/C++, ...) to allow people to create custom applets in a few minutes without having to know anything about the GTK and XFCE apis.

To help debugging, the applet could also provide a log window showing all communications (including stderr from the program).


#2 2012-09-03 22:54:49

Registered: 2010-01-15
Posts: 169

Re: Applet controlled by an external program

Hi, stef70.

Very interesting post, but I'm a little confused. Most panel applets do something, like call on the services of a program. If what you want to do when clicking on an applet is to get that program going, isn't it enough to use a Launcher applet pointed at the program or a shell script?

I may not be understanding what you're asking for, but it sounds like: "I want to use an applet to run program A. To do that I want a program B which controls the applet which starts A running."


#3 2012-09-05 17:36:12

Registered: 2011-06-26
Posts: 121

Re: Applet controlled by an external program

If I remember correctly, if you add a launcher, you may edit on-the-fly its .desktop file , for example, changing its icon or its name...
Or maybe if you want to "display something from a program / execute something else on click" you could try genmon plugin.
Then, you can create menus using custom menu files, or multiple launchers with more than one items...

This is just to say that a similar plugin would be really nice, but even without it probably there's a way to show what you want to show :-)


Board footer

Powered by FluxBB