Some minor tweaks of the xdg install

This commit is contained in:
Veronica K. B. Olsen
2020-10-22 23:00:06 +02:00
parent 299b8cde1b
commit bfcbf66044
2 changed files with 8 additions and 10 deletions
+7 -9
View File
@@ -193,13 +193,11 @@ def xdgInstall():
# =========================== # ===========================
desktopData = "" desktopData = ""
with open(os.path.join("setup", "novelwriter.desktop"), mode="r") as inFile: with open("./setup/novelwriter.desktop", mode="r") as inFile:
desktopData = inFile.read() desktopData = inFile.read()
desktopData = desktopData.replace(r"%%exec%%", useExec) desktopData = desktopData.replace(r"%%exec%%", useExec)
with open("./novelwriter.desktop", mode="w+") as outFile:
desktopFile = os.path.join(os.getcwd(), "novelwriter.desktop")
with open(desktopFile, mode="w+") as outFile:
outFile.write(desktopData) outFile.write(desktopData)
exCode = subprocess.call( exCode = subprocess.call(
@@ -225,7 +223,7 @@ def xdgInstall():
exCode = subprocess.call([ exCode = subprocess.call([
"xdg-mime", "install", "xdg-mime", "install",
"setup/mime/x-novelwriter-project.xml" "./setup/mime/x-novelwriter-project.xml"
]) ])
if exCode == 0: if exCode == 0:
print("Installed mimetype") print("Installed mimetype")
@@ -237,7 +235,7 @@ def xdgInstall():
# Install Icons # Install Icons
# ============= # =============
sizeArr = ["16", "22", "24", "32", "48", "96", "128", "256", "512"] sizeArr = ["16", "22", "24", "32", "48", "64", "96", "128", "256", "512"]
# App Icon # App Icon
for aSize in sizeArr: for aSize in sizeArr:
@@ -246,7 +244,7 @@ def xdgInstall():
"--novendor", "--noupdate", "--novendor", "--noupdate",
"--context", "apps", "--context", "apps",
"--size", aSize, "--size", aSize,
f"setup/icons/scaled/icon-novelwriter-{aSize}.png", f"./setup/icons/scaled/icon-novelwriter-{aSize}.png",
"novelwriter" "novelwriter"
]) ])
if exCode == 0: if exCode == 0:
@@ -261,7 +259,7 @@ def xdgInstall():
"--noupdate", "--noupdate",
"--context", "mimetypes", "--context", "mimetypes",
"--size", aSize, "--size", aSize,
f"setup/icons/scaled/mime-novelwriter-{aSize}.png", f"./setup/icons/scaled/mime-novelwriter-{aSize}.png",
"application-x-novelwriter-project" "application-x-novelwriter-project"
]) ])
if exCode == 0: if exCode == 0:
@@ -274,7 +272,7 @@ def xdgInstall():
if exCode == 0: if exCode == 0:
print("Updated icon cache") print("Updated icon cache")
else: else:
print("Error {exCode}: Could not update icon cache") print(f"Error {exCode}: Could not update icon cache")
print("") print("")
print("Done!") print("Done!")
+1 -1
View File
@@ -2,7 +2,7 @@
Type=Application Type=Application
Encoding=UTF-8 Encoding=UTF-8
Name=novelWriter Name=novelWriter
Comment=Multi-document markdown editor for novels Comment=Multi-document markdown-like editor for novels
Exec=%%exec%% %f Exec=%%exec%% %f
Icon=novelwriter Icon=novelwriter
Categories=Qt;Office;WordProcessor; Categories=Qt;Office;WordProcessor;