1import os.path 2import MenuMaker 3import Prophet 4import Prophet.Legacy 5 6from MenuMaker import indent, writeFullMenu 7from MenuMaker.xBox import X, Sep, App, Menu, Root as _Root 8 9menuFile = "~/.fluxbox/menu" 10 11 12class fluxbox(Prophet.Legacy.App): 13 pass 14 15 16class Root(_Root): 17 name = "FluxBox" 18 19 def __init__(self, subs): 20 if writeFullMenu: 21 subs += [MenuMaker.Sep(), SysMenu()] 22 super(Root, self).__init__(subs) 23 24 25class StylesMenu(MenuMaker.Menu): 26 name = "Styles" 27 28 def __init__(self, dirs): 29 super(StylesMenu, self).__init__( 30 [X(x, "stylesdir") for x in dirs if os.path.isdir(os.path.expanduser(x))]) 31 self.align = MenuMaker.Entry.StickBottom 32 33 34class SysMenu(MenuMaker.Menu): 35 name = "FluxBox" 36 37 def __init__(self): 38 subs = [X("Workspaces", "workspaces")] 39 try: 40 subs += [StylesMenu([os.path.join(fluxbox().prefix, 41 "share/fluxbox/styles"), 42 "~/.fluxbox/styles"])] 43 except Prophet.NotSet: 44 pass 45 subs += [ 46 X("Configure", "config"), 47 X("Reconfig", "reconfig"), 48 X("Restart", "restart"), 49 MenuMaker.Sep(), 50 X("Exit", "exit") 51 ] 52 super(SysMenu, self).__init__(subs) 53 self.align = MenuMaker.Entry.StickBottom 54