Shame on me :S ... an if loop in checkmenu() is get out of place.
Attached a fresh fvwm-menu-desktop.in.p3.patch
I've tested the last fvwm-menu-desktop.in (with p1-3) on OpenSuse 11.4
and Mandriva2010. Works out of the box ^^
Thomas
--- Old/fvwm-menu-desktop.in.p2.py 2012-06-24 14:52:46.900522522 +0200
+++ fvwm-menu-desktop.py 2012-06-24 15:53:14.083372640 +0200
@@ -41,6 +41,7 @@
import xdg.Locale
import os.path
import os
+import fnmatch
from xdg.DesktopEntry import *
@@ -112,7 +113,7 @@
theme='gnome'
icon_dir="~/.fvwm/icons"
top='FvwmMenu'
- install_prefix = '/etc/xdg/menus/'
+ install_prefix = ''
menu_type = 'applications'
with_titles = False
@@ -148,11 +149,11 @@
else:
assert False, "unhandled option"
- menu = checkmenu(install_prefix+desktop+menu_type+'.menu')
+ menu = checkmenu(desktop+menu_type+'.menu')
if menu == None and menu_type == 'applications':
# it could be a Debian system
- menu = checkmenu(install_prefix + 'debian-menu.menu')
+ menu = checkmenu('debian-menu.menu')
if menu == None:
sys.stderr.write( menu + " not available on this system. Exiting...\n" )
@@ -160,9 +161,22 @@
else:
parsemenu(xdg.Menu.parse(menu), top)
-def checkmenu(menu):
- if not os.path.exists(menu):
- menu = None
+def checkmenu(menu_name):
+ stop = False
+ menu = None
+ if install_prefix == '':
+ for dir in xdg_config_dirs:
+ dir = dir + '/menus'
+ if os.path.exists(dir):
+ dir_list = os.listdir(dir)
+ for filename in fnmatch.filter(dir_list, menu_name):
+ menu = os.path.join(dir, filename)
+ stop = True
+ if stop == True:
+ break
+ else:
+ if os.path.exists(install_prefix+menu):
+ menu = install_prefix+menu
return menu
def printtext(text):