OK
Rating:
0.19
Thread Listing » General AWN Discussion
Gnome Menu in awn
#24348 by michote (0.2051) posted on 3:17am Friday, November 21st, 2008
I like the standard gnome-menu and I like to access it from awn.
If I delete the menuicon from the gnome-panel I can access the menu using Alt+F1.
I tried a launcher using the command "xte 'keydown Alt_L' 'key F1' 'keyup Alt_L'"
but it didn't work. sulk
So I tried to whrite my own applet, by hacking "show desktop". It work's smile
but sometimes klicking doesn#t work properbly. sometimes my first klick on the icon shows the menu, sometimes I need to klick 3-4 times, sometimes I have to doubleklick.
[Q]



I'm still a newbee programming with python and gtk D
here's my code:
http://www.file-upload.net/download-1267812/gnome-main-menu.tar.html
[Q]



Is there a possibility to fake the cursor position in the above the icon,
to let the menu appear above the icon, and not in the middle of it.
[Q]



Could somebody help me with this clicking issue?
[Q]



thanks
michote
[Q]

Score: 0 points
Any particular reason?
#24360 by michote (0.2051) posted on 4:33am Monday, November 24th, 2008
nobody?
[Q]

Score: 0 points
Any particular reason?
#24365 by moonbeam (1.0000) posted on 3:50pm Monday, November 24th, 2008
( no avatar )
I'm very, very busy in general but you might want to take a look at either mimenu or awn main menu. They _might_ have some hints about how to fix the issues.
[Q]
Score: 0 points
Any particular reason?
#24368 by michote (0.2051) posted on 3:31am Tuesday, November 25th, 2008
I looked at this stuff
they all use:
[Q]



 
def button_press(self, widget, event):
if event.button == 1:
[Q]



and one click opens the menu.
[Q]



for me - with the same code - only doubleklick works.
I found that a normal launcher also work, but only with doubleclick.
[Q]



*Edited at 3:31am, 11/25/08
Score: 0 points
Any particular reason?
#24395 by sharkbait (0.9176) posted on 4:43pm Tuesday, November 25th, 2008
You're using this, which will work for anything except a single left-click. :)
[Q]



 

if event.button >= 1:
[Q]



It should (probably) be
[Q]



 

if event.button != 3:
[Q]



That will work on anything except a right-click. Once your applet is working well, I would check out the development guidelines, especially the section about right-click menus.
[Q]
Score: 0 points
Any particular reason?
#24397 by michote (0.2051) posted on 2:13am Wednesday, November 26th, 2008
thx:
I added if event.button != 3:
but still the same issue:
only doubbleclick works.
[Q]



richtclicked works (with or without the line from the development guidelines).
awn seems to add rightclick menu automaticly
[Q]

Score: 0 points
Any particular reason?
#25268 by 987poiuytrewq (0.2136) posted on 3:47am Saturday, September 05th, 2009
I don't know if anyone is still interested in this, but I found a sort of solution. I did exactly as michote, editing the showdesktop applet. The problem is that you need a short delay before sending the keystroke to open the menu. I set it as 0.1 seconds. I also made the cursor move to the corner of the icon and back again, so the menu opens in the same place every time. I set the vertical offset to 46 since my awn bar is 48 high, this means it just sits on top of the bar. You also need xsendkeys installed, which can be found in the lineakd package. To test it out, replace the showdesktop.py in /usr/share/avant-window-navigator/applets/showdesktop with the following, and then add the Show Desktop applet to your awn panel.
[Q]



 
[Q]



#!/usr/bin/python
[Q]



import pygtk
pygtk.require('2.0')
import gtk
import time
import subprocess
import awn
from awn.extras import awnlib
awn.check_dependencies(globals(), wnck=['xfce4.netk', 'wnck'])
import Xlib
from Xlib import X, display
[Q]



the_display = display.Display()
the_screen = the_display.screen()
root = the_screen.root
[Q]



applet_name = "Gnome Main Menu"
applet_version = "0.1"
applet_description = "An applet to pop up the gnome main menu."
[Q]



# Applet's themed icon, also shown in the GTK About dialog
applet_logo = "start-here"
[Q]



class ShowDesktopApplet:
[Q]



"""An applet to pop up the gnome main menu.
[Q]



"""
[Q]



def __init__(self, applet):
self.applet = applet
applet.title.set("Main Menu")
applet.connect("button-press-event", self.button_press)
[Q]



def button_press(self, widget, event):
if event.button == 1:
the_focus = the_display.get_input_focus()
[Q]



#move pointer to icon corner
x_corner = event.x_root - event.x
y_corner = event.y_root - event.y + 46
root.warp_pointer(x_corner,y_corner)
the_display.sync()

#display menu
time.sleep(0.1)
subprocess.call(["xsendkeys","Alt_L+F1"])
time.sleep(0.1)
[Q]



#move pointer back to original position
root.warp_pointer(event.x_root,event.y_root)
the_display.sync()
[Q]




if __name__ == "__main__":
awnlib.init_start(ShowDesktopApplet, {"name": applet_name,
"short": "gnome-main-menu",
"version": applet_version,
"description": applet_description,
"theme": applet_logo,
"author": "987poiuytrewq",
"copyright-year": 2009,
"authors": ["987poiuytrewq"]})
[Q]



[Q]



*Edited at 3:52am, 09/05/09
Score: 0 points
Any particular reason?
Thread Listing » General AWN Discussion » Gnome Menu in awn

Post A Reply:

Anonymous posting has been disabled. Please register first before attempting to post.
Powered by Metaforum ©2004-2010
Get your own Free AJAX Forum Messageboard by visiting the offical site.
.