quick and dirty script to find games in the xdg menu

This commit is contained in:
Mathieu Comandon 2012-04-25 01:30:46 +02:00
parent ad662df15d
commit 5f86396385

34
lutris/xdgmenu.py Normal file
View file

@ -0,0 +1,34 @@
from xdg.Menu import MenuEntryCache, Menu
from xdg.Menu import xdg_config_dirs
import xdg
from xdg import BaseDirectory
print xdg_config_dirs
cache = xdg.Menu.parse("/etc/xdg/menus/applications.menu")
print cache
for entry in cache.getEntries():
#print entry
if str(entry) == 'Games':
print("youpi")
for game in entry.getEntries():
print "============"
print game
#print dir(game)
if isinstance(game, xdg.Menu.MenuEntry):
print game.getType()
print game.getDir()
print dir(game)
print unicode(game.DesktopEntry)
desktop_entry = game.DesktopEntry
print "Icon", desktop_entry.getIcon()
print "DesktopFileID", game.DesktopFileID
print "Filename", game.Filename
print "Path", desktop_entry.getPath()
print "Exec", desktop_entry.getExec()
else:
print game.__class__
r = xdg.Menu.Rule(cache)
results = r.parseAll()
print results