|
@ -38,6 +38,7 @@ class App: |
|
|
''' |
|
|
''' |
|
|
A class to keep individual app details in. |
|
|
A class to keep individual app details in. |
|
|
''' |
|
|
''' |
|
|
|
|
|
|
|
|
def __init__(self, name, icon, command, path): |
|
|
def __init__(self, name, icon, command, path): |
|
|
self.name = name |
|
|
self.name = name |
|
|
self.icon = icon |
|
|
self.icon = icon |
|
@ -46,26 +47,30 @@ class App: |
|
|
|
|
|
|
|
|
def __repr__(self): |
|
|
def __repr__(self): |
|
|
return repr((self.name, self.icon, self.command, |
|
|
return repr((self.name, self.icon, self.command, |
|
|
self.path)) |
|
|
self.path)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class MenuEntry: |
|
|
class MenuEntry: |
|
|
''' |
|
|
''' |
|
|
A class for each menu entry. Includes the class category and app details |
|
|
A class for each menu entry. Includes the class category and app details |
|
|
from the App class. |
|
|
from the App class. |
|
|
''' |
|
|
''' |
|
|
|
|
|
|
|
|
def __init__(self, category, app): |
|
|
def __init__(self, category, app): |
|
|
self.category = category |
|
|
self.category = category |
|
|
self.app = app |
|
|
self.app = app |
|
|
|
|
|
|
|
|
def __repr__(self): |
|
|
def __repr__(self): |
|
|
return repr((self.category, self.app.name, self.app.icon, |
|
|
return repr((self.category, self.app.name, self.app.icon, |
|
|
self.app.command, self.app.path)) |
|
|
self.app.command, self.app.path)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class MenuCategory: |
|
|
class MenuCategory: |
|
|
''' |
|
|
''' |
|
|
A class for each menu category. Keeps the category name and the list of |
|
|
A class for each menu category. Keeps the category name and the list of |
|
|
apps that go in that category. |
|
|
apps that go in that category. |
|
|
''' |
|
|
''' |
|
|
|
|
|
|
|
|
def __init__(self, category, applist): |
|
|
def __init__(self, category, applist): |
|
|
self.category = category |
|
|
self.category = category |
|
|
self.applist = applist |
|
|
self.applist = applist |
|
@ -247,7 +252,7 @@ def get_entry_info(desktopfile, ico_paths=True): |
|
|
de = dentry.DesktopEntry(filename=desktopfile) |
|
|
de = dentry.DesktopEntry(filename=desktopfile) |
|
|
|
|
|
|
|
|
# skip processing the rest of the desktop entry if the item is to not be |
|
|
# skip processing the rest of the desktop entry if the item is to not be |
|
|
# displayed anyway |
|
|
# displayed anyway |
|
|
onlyshowin = de.getOnlyShowIn() |
|
|
onlyshowin = de.getOnlyShowIn() |
|
|
notshowin = de.getNotShowIn() |
|
|
notshowin = de.getNotShowIn() |
|
|
hidden = de.getHidden() |
|
|
hidden = de.getHidden() |
|
@ -271,7 +276,6 @@ def get_entry_info(desktopfile, ico_paths=True): |
|
|
else: |
|
|
else: |
|
|
icon = None |
|
|
icon = None |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# removing any %U or %F from the exec line |
|
|
# removing any %U or %F from the exec line |
|
|
command = de.getExec().partition('%')[0] |
|
|
command = de.getExec().partition('%')[0] |
|
|
|
|
|
|
|
@ -409,6 +413,7 @@ def category_icon(category): |
|
|
icon = None |
|
|
icon = None |
|
|
return icon |
|
|
return icon |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def blackbox(): |
|
|
def blackbox(): |
|
|
# Blackbox menus are the same as Fluxbox menus. They just don't support |
|
|
# Blackbox menus are the same as Fluxbox menus. They just don't support |
|
|
# icons. |
|
|
# icons. |
|
@ -416,6 +421,7 @@ def blackbox(): |
|
|
seticon = False |
|
|
seticon = False |
|
|
fluxbox() |
|
|
fluxbox() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def fluxbox(): |
|
|
def fluxbox(): |
|
|
if submenu: |
|
|
if submenu: |
|
|
spacing = ' ' |
|
|
spacing = ' ' |
|
@ -603,13 +609,14 @@ def jwm(): |
|
|
print('</Menu>') |
|
|
print('</Menu>') |
|
|
print('</JWM>') |
|
|
print('</JWM>') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def compizboxmenu(): |
|
|
def compizboxmenu(): |
|
|
if submenu: |
|
|
if submenu: |
|
|
spacing = ' ' |
|
|
spacing = ' ' |
|
|
if seticon: |
|
|
if seticon: |
|
|
app_icon = icon_strip(applications_icon) |
|
|
app_icon = icon_strip(applications_icon) |
|
|
print('<menu icon="' + app_icon + |
|
|
print('<menu icon="' + app_icon + |
|
|
'" name="' + applications + '">') |
|
|
'" name="' + applications + '">') |
|
|
else: |
|
|
else: |
|
|
print('<menu name="' + applications + '">') |
|
|
print('<menu name="' + applications + '">') |
|
|
else: |
|
|
else: |
|
@ -628,16 +635,18 @@ def compizboxmenu(): |
|
|
command = app.command |
|
|
command = app.command |
|
|
path = app.path |
|
|
path = app.path |
|
|
if path is not None: |
|
|
if path is not None: |
|
|
command = 'sh -c \'cd "' + path.replace("'", "'\\''") + '" ; ' + command.replace("'", "'\\''") + '\'' |
|
|
command = 'sh -c \'cd "' + \ |
|
|
|
|
|
path.replace("'", "'\\''") + '" ; ' + \ |
|
|
|
|
|
command.replace("'", "'\\''") + '\'' |
|
|
if seticon and icon is not None: |
|
|
if seticon and icon is not None: |
|
|
print(('{} <item type="launcher"><name>{}</name>' |
|
|
print(('{} <item type="launcher"><name>{}</name>' |
|
|
'<icon>{}</icon>' |
|
|
'<icon>{}</icon>' |
|
|
'<command>{}</command></item>').format(spacing, |
|
|
'<command>{}</command></item>').format(spacing, |
|
|
name, icon, command.replace('&', '&'))) |
|
|
name, icon, command.replace('&', '&'))) |
|
|
else: |
|
|
else: |
|
|
print(('{} <item type="launcher"><name>{}</name>' |
|
|
print(('{} <item type="launcher"><name>{}</name>' |
|
|
'<command>{}</command></item>').format(spacing, |
|
|
'<command>{}</command></item>').format(spacing, |
|
|
name, command.replace('&', '&'))) |
|
|
name, command.replace('&', '&'))) |
|
|
print(spacing + '</menu>') |
|
|
print(spacing + '</menu>') |
|
|
if submenu: |
|
|
if submenu: |
|
|
print('</menu>') |
|
|
print('</menu>') |
|
|