Saturday, 24 February 2007

To Quote Destinys Child...

..."Get on the bus", which, as of revision 125, Awn is on :).

Awn now has a DBus backend! Which brings to life one of my main features for Awn, which was the ability for applications to control their Icons on Awn!

It is *very* new, and I haven't added all of my ideas, but Imy top 3 are now working:

Ability To Change Task Icon
This is especially important for media applications, so they can set the icon to whatever cover-art they have:

Yes, its FutureSex/LoveSounds, and that says alot for my music taste, but leaving that aside for the minute, you'll be happy to know that Mr. Timberlakes cover art is actually the Rhythmbox launcher :).

I basically have hacked the standard artdisplay plugin for Rhythmbox and added support for the cover to be shown on Awn. If there is no cover, it reverts back to the standard icon. I have included it in svn, under the new 'plugins' folder. Installation instructions are also included.

Little Information Bubbles
These would be important for applications such as Evolution, which could show how many unread emails you have:This is not a real-life plugin, its just a demo of what can be done. If I have time, I will make this into a proper plugin.

Progress Information
This is probably my favourite! In-built progress reports into the task icon:

*Update* An example video showing Firefox downloading a file:





This, again, is not a real plugin for Firefox, but demonstrates whats possible.

There is still a lot of work to do, regarding drawing, alignment, etc etc. However, now the basic boilerplate stuff is in, this should be easy to do.

Here are some things that I am going to add over the weekend:
  • Ability to have a small icon composited on the main task icon. Think Epiphany settinging the current favicon onto its task icon.
  • Ability to add menu items over dbus, and listen to their signals if clicked by the user. For instance, menu item for evolution to add a contact, Totem to pause a movie etc.
  • Predefined 'types' of apps, with special buttons, i.e. a MEDIA_TYPE that shows buttons for reverse, play/pause, and forward.
  • Some more styles to display the progress 'bar'.
  • Option to attach a larger pixbuf to the 'tile' which shows on hover. So, Rhythmbox can attach a 400x400px sized album art, which would show with the window title.
Making Your Own
If you want to write a plugin for your favourite app, heres some info that you'll need, the code is in Python, but should be easy to adopt for other languages.

bus = dbus.SessionBus()
obj = bus.get_object("com.google.code.Awn", "/com/google/code/Awn")
awn = dbus.Interface(obj, "com.google.code.Awn")

Gets you the basic awn object.

There are two main ways to get at your task,
  1. By the name of the application (string). This works best for single-instance applications.
  2. By the xid (long), which is best for multi-instance apps , as it will only effect the icon for that window. One way to get the xid is by calling GDK_WINDOW_XID(window->window).
  3. I am adding support for using the pid to reference your application.
Setting Icons
To set the icon for a task, you need to call either SetTaskIconByName or SetTaskIconByXid. In python, it would be :

awn.SetTaskIconByName ("rhythmbox", "/tmp/rhythmbox-album-art.png")

or

awn.SetTaskIconByXid (long(xid), "/tmp/rhythmbox-album-art.png")

Yes, the second argument has to be a /local/path/to/the/image/file. Using /tmp is the best idea, as it will get wiped when you restart.
You have to call awn.SetTaskIconByName/Xid every time you want to update, even you are using the same file name (recommended as to avoid unneccessary junk in /tmp).
If you need to unset the icon, use :

awn.UnsetTaskIconByName ("rhythmbox")

or

awn.UnsetTaskIconByXid (xid)

The name may not always match, I am working on this, so be patient if your fav app does not work :).

Setting Information
Setting information is easy:
awn.SetInfoByName ("evolution", "23")

or

awn.SetInfoByXid (xid, "23")

Unset using:
awn.UnsetInfoByName ("evolution")

or

awn.UnsetInfoByXid (xid)

Setting Progress
This is very easy:
awn.SetProgressByName ("firefox", 60)

or

awn.SetProgressByXid (xid, 60)

There is no 'unset' function, just set the progress to 100 to clear the icon of the progress meter.


If you need any help, or need better API, just drop me a line. Also, we have a forum, thanks to Mike Jones (searayman), so if you do make anything based on the DBus backend, post it there so we can all have a look! I'll probably include some plugins with the main tarball, so let me know if you make something.

*Update* The forum seems to be down at the moment, so I recommend using the wiki to upload your creations. Just add a page under the 'DBus Plugins' page, you can also attach files to the pages you create. I have added the Rhythmbox plugin as an example.

*Update 2* Just to annoy me, the forum is actually back up again. So its up to you where you want to post your plugins, forum or wiki, whichever suits you best.

And Finally
I am going to do mass amounts of bug fixing over the next few days, and therefore expect svn to be in a bit of a flux as I sort some things out.

37 comments:

Mike Jones said...

is the only working plug in at the moment, the music one?

Anonymous said...

Awesome! Can't wait for a firm set of code with the new features :) .

While you're busy squashing bugs, have you gotten reports from other users having window focus issues? I have been loving Avant so far, but I frequently can't get windows to behave right :( .

Focused windows keep focus no matter what, minimized windows won't maximise, etc. It gets old real quick.

I'm thinking it is perhaps related to a Beryl setting somewhere, or maybe the fact I'm using gdesklets. I'll play around with settings and see if I can pin down the issue.

Loyal Lurker.

Rob2687 said...

Rhythmbox also has that Notification Area icon where you can control the play back, volume and stuff. Does that use dbus too?

anon: Disable Focus Stealing Prevention in Beryl settings.

Mike Jones said...

my rythum box isnt changing icons to the songs album... i will post a bug report in google code for you with a screen shot.

scooper86 said...

this is a very cool update and thanks for the info regarding python and dbus i will start tinkering straight away

Dirty Dog Wash said...

I love your software, but if you dont mind me asking, instead of making all these new changes (which are cool and i cant wait) is there a way you can focus on autohide?

The only reason i dont use this software full time is that it is always in my way.

Any timeframe on that one?


thank you.

Excited Fan

Anonymous said...

Hi Neil,

first of all: awn is a great piece of software you have made!

I tried to add the awn-progress support to listen! but i cant get the dbus object in python.

dbus_bindings.DBusException: The name com.google.code.Awn was not provided by any .service files

im using your code example and awn-svn

thx

Neil J. Patel said...

@chris : I am working on that today, hence svn may break today, as I stat moving things round to incorporate it.

@andreas: You can have a look at the Rhythmbox plugin in the plugins folder, as that is also written in python. It should be easy to adopt from there. Let me know if you can't get it to work, and i'll have a go. Just mail me (njpatel_AT_gmail_DOT_com)

Anonymous said...

@neil:
Sorry, it was my fault!
I had your deb-svn running. Now with a self compiled svn it works :D

I'll post in the forum when i have something running!

btw: i can't access the forum atm :(

Anonymous said...

Hi :)

Awn it's the first dock I use more than 2 days. Thanks for this great software :)

For the dbus backend, is (or will be) AWN able to listen dbus ? Some applications (like banshee or gaim) provide informations with dbus, maybe it would be easier than patch all applications.

Anonymous said...

this way it you would have to change awn everytime these programs change their dbus bindings

imho it would be better to write a program in an easy language like python or ruby that handles as actionlistener / actioninitiator

this program would watch over all programs that could show some status in awn

for example look for a new message in thunderbird or evolution an set the number on the awn icon.

or the progress of a download in firefox or epiphany

so awn just promotes the status effect


BTW: i've done the changes to listen 0.4.3 (later versions won't run on my edgy :( )
and i'm working on a amarok script atm

i hope the forum will be accessible soon, so i could post the changes to listen and the amarok script once its done

bye

Neil J. Patel said...

@gilir : I have to agree with Andreas, it' much easier to implement a plugin for your app in you favourite language, then me trying to support dbus stuff inside Awn.

@Andreas: Soz about the forum, not sure whats happening, however, I have made a page on the wiki, plus I added the Rhythmbox plugin there. You could do the same, just make a page under "Dbus Plugins", and just add an attachment to the page. wiki :
http://awn.wetpaint.com/page/Dbus+Plugins

Anonymous said...

Ok I understand :) So I will try to code plugins :)

If you know some good docs for dbus, maybe put them on the wiki to help dev :)

Neil J. Patel said...

Good idea, I'll something now.

Anonymous said...

im adding the amarok scriot in a few minutes, but there is still a bug i have to get rid of

how can i set an icon to its default icon?
with your dbus unset method the icons is removed completely

Neil J. Patel said...

@andreas: thats probably a bug. What do you mean that it removes the icon completly, does it show no icon at all?

Anonymous said...

@neil:
awn.UnsetTaskIconByName("amarok")

removes the icon completely
http://image.dskw.de/index.php?ID=648

Neil J. Patel said...

@andres : can you update to latest svn and try again. I think I have pinpointed the problem.

Anonymous said...

@neil:
thx! it works perfectly! I'll finish the page with awn-amarok right now ;-)

Anonymous said...

Really cool. Iv got a small idea though. From what I can see the avant bar shows the open windows in icon form in a small bar.
You could make the bar double sided so that you can have open tasks on one side and app shortcuts on the other. If you right click the bar then you would see the bar flip over to the other side. Just a small idea for you to think about.

Neil J. Patel said...

@andreas : Can't wait! I've downloaded amarok just to test it :D!

@tretle : Sounds good, however the 'shortcuts' actuallly control the tasks they launch, so I can't hide them :/

Anonymous said...

oh you didn't have to spam your gnome installation full of kde libs just for an amarok script ^^

tell me if it works :D

Anonymous said...

i forgot to mention the requirements for the script -.-

python-kde3
python-dcop

not sure with python-dcop because python-kde3 should contain something similar...

Neil J. Patel said...

Just a quick update, as of now, svn has basic autohide support! It has a few glitches, but I will iron them out over the weekend. Set /apps/avant-window-navigator/auto_hide to TRUE, and please note, you have to make sure /apps/avant-window-navigator/auto_hide is FALSE otherwise you are still going to get the bottom 50 px wasted.

Neil J. Patel said...

aarrgghh! That last one should be:

please note, you have to make sure /apps/avant-window-navigator/panel_mode is FALSE otherwise you are still going to get the bottom 50 px wasted.

Jack Kerouac said...

Just tried out the Amarok script - works great!

Auto-hide is cool, but you're right - it needs work. It's cool to have it, however!

Neil, sorry if this has been asked before, but what are you programming AWN in? Python? C?

Unknown said...

neil,

again, awesome stuff. i just noticed that beryl preview windows are working if you hover the mouse about 100 pixels over the awn icon. i cannot tell you how much i am enjoying this program, it's the first dock program i've used on a regular basis since window maker and it just rocks!

Neil J. Patel said...

@patrick : Awn is pure C, avant-preference s is in python, however.

@scott: Hi! I am glad you like it! I was told by the live-preview plugin author that he will try and fix it. I knwo its not perfect yet, but I'll try and contact him soon.

Jack Kerouac said...

Sorry, just one more quest. What IDE do you use (if any)? Anjunta? KDevelop?

Anonymous said...

I'm sure this has been suggested before, but...

I recently took a look at a-w-n along with gimmie as I thought it'd be neat to move to some new panel-replacement technology. I found that a-w-n sure looked neat, but it just isn't comprehensive enough to replace the panel and it seems a bit silly to run both. gimmie doesn't have as much nice eyecandy as a-w-n, but it has a lot more functionality and i can (and do) use it as a complete panel replacement.

so...couldn't you guys merge? it seems like a natural fit: just work a-w-n's awesome eye candy (and this neat new dbus stuff) into gimmie's 'programs' pane. what could be easier?! it'd make my day. pwease? :D

Neil J. Patel said...

@anon : Hi there! Actually I believe you are the first to mention this! I don't think that Awn tries to replace the entire gnome-panel at all, just the bottom panel :). Gimmie is an excellant piece of software, but I think it is moving in a different direction that Awn, as it is changing the style in which we use our computers, and Awn is complementing our current style :).

Anonymous said...

#!/bin/sh

svn up

svnrev=`svn info | grep Revision | sed "s/Revision: //"`
pkgname="avant-window-navigator"
pkgversion=$svnrev"svn"

checkinstall -D -y --pkgname $pkgname --pkgversion $pkgversion

Sebastian said...

This thing kicks ass, please keep up the rly good work :D

Sebastian said...

I'd really like to see a video player like totem being able to show the video playing in the dock.

Neil J. Patel said...

@sebastian : Hi! Ths should be possible when compiz/beryl have client-side interfaces (they may already?) through either a library or DBus.

PeterStJ said...

Hello

I have a question.
I suppose it is libwnck related but still wort mention it.
When I use a text editing app I can do:
select text -> drag to another app icon in awn -> drop in the app's window because it pops up
When I do it with a link or a picture from firefox it is not allowing me (the cursors stays to "dnd_none") and the other app window never pops up.

But if the other app window can be reacher (is not entirely covered by firefox) I can surely drop the link/image there and it is pasted well.

Is it possible this to be fixed in awn or is it related to some of the underlying libs?

I think it will be really useful as it speeds up the things when moving around images from the Internet to a local editor and so on.

Thanks and keep on with the good work. I also wonder what happened with the zooming;)

Anonymous said...

Sorry, forgot to sign my previous comment - the anonymous asking about gimmie was me :)

Fair enough, I understand your position.

Just to let you know - I've packed the latest a-w-n SVN snapshot for Mandriva Linux. It's now in Cooker (our development distro) and will shortly be in the backports repository for 2007 (our last release). Since it's in Cooker, it'll be in 2007.1 (our next release). I've also added this information to the wiki download section. Thanks again for the cool tool. :)

- Adam Williamson, Mandriva, awilliamson A T mandriva D O T com