mirror of
https://github.com/lutris/lutris
synced 2024-11-02 09:40:17 +00:00
quick and dirty script to find games in the xdg menu
This commit is contained in:
parent
ad662df15d
commit
5f86396385
1 changed files with 34 additions and 0 deletions
34
lutris/xdgmenu.py
Normal file
34
lutris/xdgmenu.py
Normal 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
|
Loading…
Reference in a new issue