6 from MenuMaker
import indent
, writeFullMenu
11 menuFile
= "~/.config/compiz/deskmenu/menu.xml"
17 for d
, s
in (("&", "&"), ("\'", "\"")) :
25 def emit(self
, level
) :
26 return ['%s<separator/>' % indent(level
)]
32 def emit(self
, level
) :
34 xx
= indent(level
+ 1)
36 if self
.app
.terminal
:
37 cmd
= MenuMaker
.terminal
.runCmd(cmd
)
39 '%s<item type="launcher">' % x
,
40 '%s<name>%s</name>' % (x
, _map(self
.app
.name
)),
41 '%s<command>%s</command>' % (x
, cmd
),
48 def emit(self
, level
) :
49 menu
= ['%s<menu name="%s">' % (indent(level
), _map(self
.name
))]
51 menu
+= x
.emit(level
+ 1)
52 menu
.append('%s</menu>' % indent(level
))
57 def __init__(self
, subs
) :
59 subs
= subs
+ [MenuMaker
.Sep(), SysMenu()]
60 super(Root
, self
).__init
__(subs
)
61 def emit(self
, level
) :
68 menu
.append('</menu>')
80 class SysMenu(MenuMaker
.Menu
) :
84 X('<item type="launcher">'),
85 X(' <name>Edit Menu</name>'),
86 X(' <icon>gtk-edit</icon>'),
87 X(' <command>compiz-deskmenu-editor</command>'),
89 X('<item type="viewportlist"/>'),
90 X('<item type="reload"/>'),
92 X('<item type="launcher">'),
93 X(' <name>Logout</name>'),
94 X(' <icon>gnome-session-logout</icon>'),
95 X(' <command>killall X</command>'),
98 super(SysMenu
, self
).__init
__(subs
)
99 self
.align
= MenuMaker
.Entry
.StickBottom
104 class X(MenuMaker
.Entry
) :
105 def __init__(self
, x
) :
106 super(X
, self
).__init
__()
107 self
.align
= MenuMaker
.Entry
.StickBottom
109 def emit(self
, level
) :
110 return [indent(level
) + self
.x
]