cardapio needs docky support!

Bug #660620 reported by Paweł Bara on 2010-10-14
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Paweł Bara

Bug Description

As far as I know, one of major things that people don't like about docks is their inability to replace the Gnome menu. The reason behind this is simply lack of the application menu support.

So... If Cardapio does this and does it well, our ratings could go really high. :)

The goal here is to provide a native Cardapio support for Docky.

Related branches

Paweł Bara (keirangtp) on 2010-10-14
Changed in cardapio:
status: New → Confirmed
importance: Undecided → Low
assignee: nobody → Paweł Bara (keirangtp)
Paweł Bara (keirangtp) wrote :

I'm actually pretty happy of things shaping up. :) Now I need some feedback.

I'm attaching a few screenshots and I'm open to any comments you may have.

Paweł Bara (keirangtp) wrote :
Paweł Bara (keirangtp) wrote :
Paweł Bara (keirangtp) wrote :

The algorithm I'm using to calculate the window's position works just like show-near-mouse mode except that instead of a mouse pointer position we use the coordinates of a point that's just above / below / etc. the Cardapio's launcher on its dock. "above / below etc." depends of course on the dock's orientation.

Few things that come to my mind:
- I should probably increase the Cardapio's offset by a few pixels because the Docky's tooltip appears on the Cardapio's window
- somehow Cardapio misses a border of some kind - it looks naked... GnoMenu fellows have done this right -

Thiago Teixeira (tvst) wrote :

Looking good! Now I see why you wanted a nicer icon for Cardapio :)

I will give this a try tomorrow and will let you know if I have any comments.

Can you post here some installation instructions?

Paweł Bara (keirangtp) wrote :

One more thing I'll do is I'll change Cardapio's show-near-mouse code preference to bottom orientation meaning that if there's space to put Cardapio below the given (x, y) point - always do it. You can see what I mean on the "right panel" screenshot. There's clearly a lot of space below the launcher yet Cardapio decided to reach the skies treating the launcher as the bottom borderline. It's natural for menus, context menus and stuff like that to unfold below the cursor.

Installation might be a bit tricky so I'll try to describe it precisely. First get my branch, then get Docky. ;)

Create a launcher for Cardapio: it's name should be "cardapio.desktop" and the command: "cardapio show-docky-mode". Put it on Docky.

Kill your "normal" Cardapio, then start Cardapio from my branch in hidden mode. Now you should alter your "/usr/bin/cardapio" to my version. At this point the Docky's Cardapio Launcher should work (beware - don't put it on two docks at the same time, it'll consciously refuse to cooperate ;)).

Now, to run the helper, you'll need to prepare yourself a Docky's Cardapio plugin. Use the script that's inside src/other/docky folder. It'll create a .tar file and put it inside your home folder. Click the Docky's icon on... Docky, select your lower dock, now go to the Helper's tab and click on "Install" button. Point to the just created tar file and enjoy Cardapio on your helper's list. ;) Also - the plugin should start working immediately, providing the Cardapio's launcher with RMB context menu. Don't click anything there - the options do nothing. ;)

Paweł Bara (keirangtp) wrote :

Oh - and while you're at it, comment on my proposed changes too.

Paweł Bara (keirangtp) wrote :

I've just prettyfied the show-near-mouse-algorithm on the branch.

I still can't avoid overlapping of Docky's tooltip with Cardapio's window in every situation though. Nevertheless, I've added some logic which tries to do it as good, as it can.

PromoGest (m3nt0r3) wrote :

i think that cardapio in docky can be THE perfect solution to ubuntu "split in two toolbar waste a lot of space" philosophy

Paweł Bara (keirangtp) wrote :

That's why we'll try to do our best. ;)

The helper (edit menus, preferences etc.) now works even though the "Preferences" and "About Cardapio" windows position themselves rather weirdly.

Wow, nice work Pawel. :)

The GnoMenu screenshot is exactly what I meant when I was proposing the minimal layout as a »dock theme« for Cardapio. The full menu just looks ugly and way too big there.

Paweł Bara (keirangtp) wrote :

Yes, discuss, discuss.

Meanwhile I'm attaching a screenshot of Cardapio not overlaping Docky's tooltip. Also - it presents the panel mode.

Paweł Bara (keirangtp) wrote :

If you want Jan, please upgrade your minimal layout .ui file to be compatible with latest revisions of Cardapio's trunk. Having this done, I could add support for lauching Cardapio in minimal configuration from Docky thus letting you all to experiment with this on my branch. Also - I could use two ".ui" files: one for Cardapio with search bar on top, and one with search bar on bottom.

Thiago Teixeira (tvst) wrote :

I think the "searchbar on bottom" configuration is a good idea. But it should be done on the same UI file, really, so there's litle duplication of effort later on when making a UI change. Also, I think Cardapio should automatically choose between "searchbar on top" and "searchbar on bottom" mode, based on whether the panel/dock is on top or on the bottom.

Paweł Bara (keirangtp) wrote :

Beware - I've just changed the launcher's argument to "cardapio docky-mode".

Also, I've probably finished refactoring of window showing code. About and Preferences windows now work just like the main window does: if there's applet, position near it, if there's none - position in the center.

tvst: what do you think about the session buttons - should they always stay on the bottom?

Thiago Teixeira (tvst) wrote :

Yes, I think the session buttons should always stay in the bottom.

About minimode and searchbar placement: let's discuss that here

Paweł Bara (keirangtp) wrote :

I've started to implement the things discussed in the blueprint on my Docky branch.

I've done the top / bottom search bar thing - no minimal layout for now. Unfortunately I had some problems:

- I somehow can't position the bottom search slab on the bottom because the "Software center etc." slab is glued to the bottom!! I don't know shit about Gtk though
- if you have the flag "remember the search text on window closure" set and you search in one window position, then you open the window in another position (meaning the toggle of search bars visibility), the newly visible search bar isn't filled with the search string (even though the results are clearly being remembered)

Could you check this if you'll find some spare time, Thiago?

> - I somehow can't position the bottom search slab on the bottom because the "Software center etc." slab is glued to the bottom!! I don't know shit about Gtk though

Just open the UI file with Glade, click on the widget you want to position at the bottom, click on the "packing" tab on the right, then select "pack type: end". :)

> - if you have the flag "remember the search text on window closure" set and you search in one window position, then you open the window in another position (meaning the toggle of search bars visibility), the newly visible search bar isn't filled with the search string (even though the results are clearly being remembered)

We can just add a line or two in Cardapio's hide() method to make the text from the active searchbar get copied to all hidden searchbars.

> Could you check this if you'll find some spare time, Thiago?

I will. Probably on Tuesday, though, because I have a big deadline at work tomorrow :)


- Thiago

Paweł Bara (keirangtp) wrote :

That were precisely the answers I was looking for and having my questions answered, I've pushed my branch even further!

We have now those four search entries discussed inside the blueprint. What's more, the entries are hidden behind a common facade which let's you to keep using methods like self.search_entry.set_text() or self.search_entry.set_position(). You don't have to worry about which entry is active.

I've also started working on the mini layout. You can start it by using "cardapio something mini-mode" command (for example "cardapio docky-mode mini-mode"). Cardapio started in mini mode works this way until you quit it. I'm having some minor problems with shrinking the window but I'll probably find the answer before Tuesday. ;) Everything I've described means that about 80% of blueprint are implemented now.

I'm attaching two screenshots.

PS. Notice the border. Unfortunately, the border is more of a mockup than a real working thing because it breaks resizing.

Thiago Teixeira (tvst) wrote :

Looking good! A few comments:

1) Why did you add the border? It seems unnecessary to me, and visually displeasing -- although that's obviously a personal assessment :) . Either way, as a general rule I think we should always remove anything that doesn't have too much of a function.

2) Mini mode: To reduce the buttons even more, take a look at the code in setup_panel_button() where I change the "toggle-spacing" option of the GtkImageMenuItem to remove the extra padding at the right of the icons. It appears that GtkButtons have a similar option*, called "image-spacing", which should be changed the same way. This should shave off some of the extra button width.


Paweł Bara (keirangtp) wrote :

1) As I wrote higher, I think that Cardapio's too "naked" without the border when unglued from the Gnome panel. Check the attached image for comparison of different modes: no border, smaller border or bigger border. I changed the border to small version on my branch now and am awaiting your opinions.

Paweł Bara (keirangtp) wrote :

2) I'm attaching the latest mini-mode screen.

Paweł Bara (keirangtp) wrote :

Oh... And if you ask why I did not narrow the left panel even further, there's a problem when there are too many items on it. We get a scroller then and it looks really bad if the panel is too narrow.

I'm attaching a screenshot of left panel with scroller in it's current size.

Paweł Bara (keirangtp) wrote :

I'd like to hear you opinions now, guys, because the things I wanted to do here (and even more...) are done.

Wow, great work Pawel! :)

3 things, every one of them about interface cruft and also valid for the normal layout:
1) We should get rid of the scrollbar for categories / view – it is just ugly and clunky. _If_ the list is longer than what normally fits, then rather sacrifice that instead of having general ugliness. The one and only scrollbar in the interface _ever_ should be the vertical scrollbar for the results.
2) Remove the border. Without it, it does not look naked, it is lighter. The less stuff, the better. :)
3) »Search« should go into the search box (as »Search …« like on many websites) because this extra header under the result list seems confusing.

Let me know what you think.

Paweł Bara (keirangtp) wrote :

I'll wait for Thiago's comments on this - then comment myself.

Changed in cardapio:
status: Confirmed → In Progress
Lee Hyde (anubeon) wrote :

Great work Paweł!

Although, would it be possible to make Cardapio look more native w.r.t. Docky, such that it looks similar to the translucent tool-tips and right-click menus drawn by Docky?

Also, I agree with your comments about Cardapio (sans border) looking naked when detached from gnome-panel. It reminds me of how windows appear when gtk-window-decorator fails, which incidentally makes me feel naked (jk). I prefer the narrower of the two borders though, which you appear to have adopted.

All the Best.

Paweł Bara (keirangtp) wrote :

The answer to the first question - no. As far as I know, Docky doesn't let you do things like that easily. There are native-look Docky plugins like Stacks (which is currently being developed) but those require some SERIOUS coding.

The only thing we can do is to provide a native helper and we've done it. It's presented on one of the screens attached to this bug. It seems that the only possibility to apply this style to the whole Cardapio would be some kind of Cardapio's theming which is currently nonexistent. Correct me if I'm wrong and you know other native-Docky-look-and-feel Docky's plugins.

About the lack of the border - I also think that this looks like the decoration failed. Nevertheless, it seems that the border's gone and it won't come back because the team didn't like it.

PS. It's quite possible that this stuff will reach our PPA really soon. :)

Thiago Teixeira (tvst) wrote :


I have finally tried your Cardapio modifications for Docky and it seems to work well, including your code for placing Cardapio away from the dock. Nice!

However, I'm not sure that Cardapio should be a Docky "helper", but a "plugin" instead. As a helper, the Cardapio/Docky thing is a bit of a hack. Besides, the installation takes way too many steps to add Cardapio to Docky. Way too complicated. I know *I* had to try it 3 or 4 times before getting everything to work.

Any ideas on how to fix this? To me, it seems like creating a Docky "plugin" would resolve these problems. Or if we can automate the helper installation and the creation of the .desktop file in just the right way, that /could/ be acceptable too...

Thiago Teixeira (tvst) wrote :

Also, please try out the latest version of Cardapio from trunk. Instead of adding an artificial border around the window when Cardapio is running in docky or no-panel mode, I changed the code so that the window manager displays the usual window decorations. Let me know what you think!

Paweł Bara (keirangtp) wrote :

Work in progress. Also - we have a DockManager branch now so we'll see what they think about all this.

Thiago Teixeira (tvst) wrote :

Someone just emailed me asking about the status of Docky support, so I though I might as well post my reply here. This is a summary of what Pawel (mostly) and I (to a smaller degree) have been up to in the past week or two:

For a few weeks we have been trying all sorts of crazy hacks to get Cardapio on Docky, since Docky itself is not really made with main menus in mind. Plus, we'd like to make the installation process as simple as possible. The three options that Docky gives us are:

1) We could write a docklet that opens Cardapio when clicked. However, docklets can only reside on the right side of the dock, which is not a good position.

2) We could install Cardapio as a regular application launcher in your dock. When you click it, Cardapio appears. Then we'd write a helper to add custom context menu options to Cardapio, such as the "About Gnome" launcher and so on. The downside of this is that although it can live on the left side of the dock, there is no /good/ way to automatically add app launcher to Docky -- so the user would have to do it manually. Also, what we would /really/ like is for Cardapio to be the /first/ icon on the dock, which is not allowed by Docky. (this is what the version in that branch does, and I'm not sure if it is complete)

3) We could set up the "Dock" button show Cardapio when clicked. This is easy to do programatically, and very clean. But it does not let us set custom context menu options.

We have chatted with some Docky developers and it is unlikely that they will ever change Docky to allow docklets on the left side or launchers as the leftmost icon. So we're left with option (3). Then, to bypass the lack of a proper context menu on the icon, we'd just make Cardapio's own context menu show "About Gnome" and friends. There are still some questions about /how/ exactly we'll present to the user the option to add Cardapio to Docky. So this is what we're working on right now.

Long story short: for a seamless installation experience you'll have to wait a couple more weeks. But if you're willing to edit some gconf settings by hand, you can try this for now . (Note that in the final version of the Docky code we hope to make Cardapio's window placement a bit more robust, so there are some enhancements coming in that direction)

Paweł Bara (keirangtp) wrote :

After you incorporate my latest code everything's more or less done and I think that we should release the first version - then just correct bugs that might appear.

Also, I don't know why did you link a FAQ about "show-near-mouse" here since this hack has been out there for a while and also - it sucks.

Since mini mode is no more Docky related, we don't need to complete it before releasing our new Docky support. You have my patch in your e-mail box - check it out, merge it and link here a FAQ with the real deal docky mode. ;)

Thiago Teixeira (tvst) wrote :

> After you incorporate my latest code(...)

Yes, I'll take a look at your code now. I've been a bit busy with pesky real-life stuff :)

> Also, I don't know why did you link a FAQ about "show-near-mouse" here

I just posted it above for completeness, since it works with the current PPA version and older Cardapio versions too. It's definitely not the best solution, but at least it's something.

>Since mini mode is no more Docky related, we don't need to complete it before releasing our new Docky support.

Agreed. I'm trying to track some new memory leaks that sprouted out of nowhere, though, and until we get those leaks fixed it is not prudent to update the PPA. So if you have some free time in your hands, let's talk on instant messenger soon and try to track them leaks down!

Thiago Teixeira (tvst) wrote :

Ok, Docky support is now on the PPA! How to use it:

1) Install the package cardapio-docky
2) Open Docky and activate the Cardapio helper

Now just click on the anchor button (the first button in Docky) to show/hide Cardapio!

As a bonus, you may want to make Cardapio's window smaller, as it looks prettier with Docky :) . For this, go to Cardapio's properties and check the box that says "Reduce the size of Cardapio's main window".

Have fun!

Changed in cardapio:
status: In Progress → Fix Released
To post a comment you must log in.