1
0
Fork 0
mirror of synced 2024-06-02 10:44:40 +12:00

Fix Desktop links (Appimages, wrong path)

This commit is contained in:
Dummerle 2021-08-17 16:54:55 +02:00
parent 363fda6d5e
commit ea78aa7b64
3 changed files with 13 additions and 7 deletions

View file

@ -1,10 +1,9 @@
# appimage-builder recipe see https://appimage-builder.readthedocs.io for details
version: 1
script:
# Remove any previous build
- rm -rf AppDir Rare | true
- rm -rf AppDir Rare | true
# Make usr and icons dirs
- mkdir -p AppDir/usr/src
- mkdir -p AppDir/usr/share/icons/hicolor/256x256/apps/
@ -16,7 +15,6 @@ script:
# Install application dependencies
- python3 -m pip install --system --ignore-installed --prefix=/usr --root=AppDir -r Rare/requirements.txt
AppDir:
path: AppDir
app_info:

View file

@ -135,7 +135,7 @@ class RareSettings(QWidget, Ui_RareSettings):
def create_desktop_link(self):
if not os.path.exists(self.desktop_file):
utils.create_rare_desktop_link("start_menu")
utils.create_rare_desktop_link("desktop")
self.desktop_link.setText(self.tr("Remove Desktop link"))
else:
os.remove(self.desktop_file)

View file

@ -223,18 +223,22 @@ def create_rare_desktop_link(type_of_link):
# Linux
if platform.system() == "Linux":
if type_of_link == "desktop":
path = os.path.expanduser(f"~/Desktop/")
path = os.path.expanduser("~/Desktop/")
elif type_of_link == "start_menu":
path = os.path.expanduser("~/.local/share/applications/")
else:
return
if p := os.environ.get("APPIMAGE"):
executable = p
else:
executable = f"{sys.executable} {os.path.abspath(sys.argv[0])}"
with open(os.path.join(path, "Rare.desktop"), "w") as desktop_file:
desktop_file.write("[Desktop Entry]\n"
f"Name=Rare\n"
f"Type=Application\n"
f"Icon={os.path.join(resources_path, 'images', 'Rare.png')}\n"
f"Exec={os.path.abspath(sys.argv[0])}\n"
f"Exec={executable}\n"
"Terminal=false\n"
"StartupWMClass=rare\n"
)
@ -293,12 +297,16 @@ def create_desktop_link(app_name, core: LegendaryCore, type_of_link="desktop") -
return False
if not os.path.exists(path):
return False
if p := os.environ.get("APPIMAGE"):
executable = p
else:
executable = f"{sys.executable} {os.path.abspath(sys.argv[0])}"
with open(f"{path}{igame.title}.desktop", "w") as desktop_file:
desktop_file.write("[Desktop Entry]\n"
f"Name={igame.title}\n"
f"Type=Application\n"
f"Icon={icon}.png\n"
f"Exec=rare launch {app_name}\n"
f"Exec={executable} launch {app_name}\n"
"Terminal=false\n"
"StartupWMClass=rare-game\n"
)