added quick launch script, edited paths

This commit is contained in:
Maxim Stewart 2020-04-25 02:22:56 -05:00
parent dfe7b2bb63
commit 868b075bd5
3 changed files with 58 additions and 43 deletions

View File

@ -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,7 +67,7 @@ class Main(Context):
"Other": [] "Other": []
} }
for path in paths:
for f in listdir(path): for f in listdir(path):
fPath = path + f fPath = path + f
flags = ["mimeinfo.cache", "defaults.list"] flags = ["mimeinfo.cache", "defaults.list"]
@ -106,7 +107,8 @@ class Main(Context):
menuObjs[group].append( {"title": title, "groups": groups, menuObjs[group].append( {"title": title, "groups": groups,
"comment": comment, "exec": mainExec, "comment": comment, "exec": mainExec,
"tryExec": tryExec, "fileName": f} ) "tryExec": tryExec, "fileName": f
})
return menuObjs return menuObjs

View File

@ -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):

13
src/shellmen Executable file
View File

@ -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 $@;