Fix Desktop links (Appimages, wrong path)
This commit is contained in:
parent
363fda6d5e
commit
ea78aa7b64
|
@ -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:
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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"
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue