Home Forums Wiki Doc Install Extras Screenshots Source Code Projects Blog Users Groups Register
Glx-Dock / Cairo-Dock List of forums Technical discussions | Discussions techniques Is it possible to have a menu widget on left-click?
The latest stable release is the *3.4.0* : How to install it here.
Note: We just switched from BZR to Git on Github! (only to host the code and your future pull requests)
Technical discussions | Discussions techniques

Subjects Author Language Messages Last message
[Locked] Is it possible to have a menu widget on left-click?
jesuisbenjamin English 9 fabounet [Read]
26 August 2011 à 11:50

jesuisbenjamin, Sunday 14 August 2011 à 11:17


Subscription date : 28 October 2009
Messages : 415
Hello,

I'm working on applets and it would be great to have a menu widget on left-click. Is that possible? Is there a Python binding for it too?

PS: i mean a menu other than the current right-click menu available, i.e. I'd like a new, blank one.

Thanks

fabounet, Tuesday 16 August 2011 à 13:05


Subscription date : 30 November 2007
Messages : 17118
you can do a gtk-menu in python, and place it at the mouse position.
although it might look a bit weird because all the other menus are placed above the icon.

if it's not a good solution, we might think of something more sophisticated with dbusmenu.

jesuisbenjamin, Tuesday 16 August 2011 à 13:11


Subscription date : 28 October 2009
Messages : 415
Option 1 would be OK if you give me the means to get the icon's position instead.
Option 2 would definitely expand possibilities though.

fabounet, Tuesday 16 August 2011 à 16:16


Subscription date : 30 November 2007
Messages : 17118
indeed, you can get the icon's position with the main interface:
http://www.glx-dock.org/ww_page.php?p=Control_your_dock_with_DBus&lang=en#24-GetIconProperties

but you can start with the cursor position, it's easier

jesuisbenjamin, Tuesday 23 August 2011 à 12:43


Subscription date : 28 October 2009
Messages : 415
hi there,

I've got some difficulties implementing a pop-up menu, because of the API (which i don't understand completely to be honest).

A GTK Menu needs some data to pop up. Usually it needs data from the event, but in the case of the API how do I get the event? I have the iState, but all it returns is "256".

So I've defined a class:

class Menu(gtk.Menu):

    
def __init__(self):
        
gtk.Menu.__init__(self)


        
# add menu item
        
menu_item gtk.MenuItem('test')
        
self.append(menu_item)
        
menu_item.show()

        
self.show()


And in the applet's main file:

def on_click(selfiState):

        
menu Menu()
        
menu.popup()


Now some arguments should be passed in there, the first two can be "None". The third and fourth are for the menu placement. Another example shows that one can pass "None" as a third argument and ignore the fourth. 5th and 6th should be event.button and event.time respectively.

So how can I get the event data from the API?

Could I later one use the third and fourth arguments to locate the menu above the icon you think?

Cheers,
B.

fabounet, Wednesday 24 August 2011 à 13:17


Subscription date : 30 November 2007
Messages : 17118
I think you can safely ignore all the arguments, (None for placement means under the mouse, and you can set the button and time to 0)

jesuisbenjamin, Wednesday 24 August 2011 à 14:33


Subscription date : 28 October 2009
Messages : 415
OK I've got it, now I need to place it above the icon thanks.

PS: i'd like to theme the menu, but that would be applet-centric. We once spoke of theming the menus globally. Did anything happen since then?

Otherwise, could it be done with a .rc file?

fabounet, Thursday 25 August 2011 à 16:53


Subscription date : 30 November 2007
Messages : 17118
you can, but that's not a good idea to make it different from the rest of the dock.

it's possible to change it though, but I forgot the GTK functions to do that.

jesuisbenjamin, Thursday 25 August 2011 à 23:19


Subscription date : 28 October 2009
Messages : 415
Heya,

i agree it's better to have it globally as an option. Will that be difficult to implement you think? Suppose I try to figure out how to make some menu theme, would you try implement it?

Also: i'm almost done with implementing a left-click menu for Gmail inbox. Now can I make the dock freeze while the menu's open as with right-click menu? Preferably without using Dbus.

Thanks.
B.

fabounet, Friday 26 August 2011 à 11:50


Subscription date : 30 November 2007
Messages : 17118
yep, actually I've done it for widgets inside the dialogs, but not for menus.
I think you have already found how to do (seeing your latest gmail applet screenshot ), and it's probably straightforward to port it in C.
so ok to add it as an option in the config (in the Dialogs options for instance)

Technical discussions | Discussions techniques

Subjects Author Language Messages Last message
[Locked] Is it possible to have a menu widget on left-click?
jesuisbenjamin English 9 fabounet [Read]
26 August 2011 à 11:50


Glx-Dock / Cairo-Dock List of forums Technical discussions | Discussions techniques Is it possible to have a menu widget on left-click? Top

Online users :

Powered by ElementSpeak © 2007 Adrien Pilleboue, 2009-2013 Matthieu Baerts.
Dock based on CSS Dock Menu (Ndesign) with jQuery. Icons by zgegball
Cairo-Dock is a free software under GNU-GPL3 licence. First stable version created by Fabounet.
Many thanks to TuxFamily for the web Hosting and Mav for the domain name.