added quick launch script, edited paths
This commit is contained in:
parent
dfe7b2bb63
commit
868b075bd5
|
@ -27,8 +27,9 @@ class Main(Context):
|
||||||
while True:
|
while True:
|
||||||
self.clear()
|
self.clear()
|
||||||
if not self.menuData:
|
if not self.menuData:
|
||||||
path = "/usr/share/applications/"
|
HOME = os.path.expanduser('~') + "/.local/share/applications/"
|
||||||
self.menuData = self.getDesktopFilesInfo(path)
|
paths = ["/usr/share/applications/", HOME]
|
||||||
|
self.menuData = self.getDesktopFilesInfo(paths)
|
||||||
|
|
||||||
group = self.call_method("mainMenu")["group"]
|
group = self.call_method("mainMenu")["group"]
|
||||||
query = ""
|
query = ""
|
||||||
|
@ -51,7 +52,7 @@ class Main(Context):
|
||||||
return method(data) if data else method()
|
return method(data) if data else method()
|
||||||
|
|
||||||
|
|
||||||
def getDesktopFilesInfo(self, path):
|
def getDesktopFilesInfo(self, paths):
|
||||||
menuObjs = {
|
menuObjs = {
|
||||||
"Accessories": [],
|
"Accessories": [],
|
||||||
"Multimedia": [],
|
"Multimedia": [],
|
||||||
|
@ -66,47 +67,48 @@ class Main(Context):
|
||||||
"Other": []
|
"Other": []
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for path in paths:
|
||||||
|
for f in listdir(path):
|
||||||
|
fPath = path + f
|
||||||
|
flags = ["mimeinfo.cache", "defaults.list"]
|
||||||
|
if not f in flags and isfile(fPath):
|
||||||
|
xdgObj = DesktopEntry(fPath)
|
||||||
|
|
||||||
for f in listdir(path):
|
title = xdgObj.getName()
|
||||||
fPath = path + f
|
groups = xdgObj.getCategories()
|
||||||
flags = ["mimeinfo.cache", "defaults.list"]
|
comment = xdgObj.getComment()
|
||||||
if not f in flags and isfile(fPath):
|
# icon = xdgObj.getIcon()
|
||||||
xdgObj = DesktopEntry(fPath)
|
mainExec = xdgObj.getExec()
|
||||||
|
tryExec = xdgObj.getTryExec()
|
||||||
|
|
||||||
title = xdgObj.getName()
|
group = ""
|
||||||
groups = xdgObj.getCategories()
|
if "Accessories" in groups or "Utility" in groups:
|
||||||
comment = xdgObj.getComment()
|
group = "Accessories"
|
||||||
# icon = xdgObj.getIcon()
|
elif "Multimedia" in groups or "Video" in groups or "Audio" in groups:
|
||||||
mainExec = xdgObj.getExec()
|
group = "Multimedia"
|
||||||
tryExec = xdgObj.getTryExec()
|
elif "Development" in groups:
|
||||||
|
group = "Development"
|
||||||
|
elif "Game" in groups:
|
||||||
|
group = "Game"
|
||||||
|
elif "Internet" in groups or "Network" in groups:
|
||||||
|
group = "Internet"
|
||||||
|
elif "Graphics" in groups:
|
||||||
|
group = "Graphics"
|
||||||
|
elif "Office" in groups:
|
||||||
|
group = "Office"
|
||||||
|
elif "System" in groups:
|
||||||
|
group = "System"
|
||||||
|
elif "Settings" in groups:
|
||||||
|
group = "Settings"
|
||||||
|
elif "Wine" in groups:
|
||||||
|
group = "Wine"
|
||||||
|
else:
|
||||||
|
group = "Other"
|
||||||
|
|
||||||
group = ""
|
menuObjs[group].append( {"title": title, "groups": groups,
|
||||||
if "Accessories" in groups or "Utility" in groups:
|
"comment": comment, "exec": mainExec,
|
||||||
group = "Accessories"
|
"tryExec": tryExec, "fileName": f
|
||||||
elif "Multimedia" in groups or "Video" in groups or "Audio" in groups:
|
})
|
||||||
group = "Multimedia"
|
|
||||||
elif "Development" in groups:
|
|
||||||
group = "Development"
|
|
||||||
elif "Game" in groups:
|
|
||||||
group = "Game"
|
|
||||||
elif "Internet" in groups or "Network" in groups:
|
|
||||||
group = "Internet"
|
|
||||||
elif "Graphics" in groups:
|
|
||||||
group = "Graphics"
|
|
||||||
elif "Office" in groups:
|
|
||||||
group = "Office"
|
|
||||||
elif "System" in groups:
|
|
||||||
group = "System"
|
|
||||||
elif "Settings" in groups:
|
|
||||||
group = "Settings"
|
|
||||||
elif "Wine" in groups:
|
|
||||||
group = "Wine"
|
|
||||||
else:
|
|
||||||
group = "Other"
|
|
||||||
|
|
||||||
menuObjs[group].append( {"title": title, "groups": groups,
|
|
||||||
"comment": comment, "exec": mainExec,
|
|
||||||
"tryExec": tryExec, "fileName": f} )
|
|
||||||
|
|
||||||
return menuObjs
|
return menuObjs
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,8 @@ from .mixins import StylesMixin
|
||||||
|
|
||||||
|
|
||||||
GROUPS = ["[ Search ]", "Accessories", "Multimedia", "Graphics", "Game",
|
GROUPS = ["[ Search ]", "Accessories", "Multimedia", "Graphics", "Game",
|
||||||
"Office", "Development", "Internet", "Settings",
|
"Office", "Development", "Internet", "Settings", "System",
|
||||||
"System", "Wine", "Other", "[ Exit ]"]
|
"Wine", "Other", "[ Exit ]"]
|
||||||
|
|
||||||
|
|
||||||
class Context(StylesMixin):
|
class Context(StylesMixin):
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# set -o xtrace ## To debug scripts
|
||||||
|
# set -o errexit ## To exit on error
|
||||||
|
# set -o errunset ## To exit if a variable is referenced but not set
|
||||||
|
|
||||||
|
|
||||||
|
function main() {
|
||||||
|
SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
|
||||||
|
cd "${SCRIPTPATH}"
|
||||||
|
python3 .
|
||||||
|
}
|
||||||
|
main $@;
|
Loading…
Reference in New Issue