add support for game shortcuts on windows
This commit is contained in:
parent
887dcf6ff7
commit
378b5193e8
|
@ -42,12 +42,12 @@ Install via `pip`.
|
|||
|
||||
## Run from source
|
||||
1. Run `pip install -r requirements.txt` to get dependencies. If you use `pacman` you can run `sudo pacman --needed -S python-wheel python-setuptools python-pyqt5 python-qtawesome python-requests python-pillow`
|
||||
2. For unix operating systems run `sh start.sh`. For windows run `set PYTHONPATH=%CD% && python Rare`
|
||||
2. For unix operating systems run `sh start.sh`. For windows run `set PYTHONPATH=%CD% && python rare`
|
||||
|
||||
## Why Rare?
|
||||
|
||||
- Rare uses much less RAM than electron based apps such as [HeroicGL](https://github.com/Heroic-Games-Launcher/HeroicGamesLauncher) and EpicGL which allows the games to run better.
|
||||
- Rare supports all major platforms (Windows, Linux, MacOS) unlike the alternatives.
|
||||
- Rare only uses ~50MB of RAM which is much less than the electron based [HeroicGamesLauncher](https://github.com/Heroic-Games-Launcher/HeroicGamesLauncher) uses.
|
||||
- Rare supports all major platforms (Windows, Linux, macOS) unlike the alternatives.
|
||||
|
||||
## Features
|
||||
|
||||
|
|
10
freeze.py
10
freeze.py
|
@ -5,15 +5,7 @@ from cx_Freeze import setup, Executable
|
|||
from rare import __version__
|
||||
|
||||
# Packages to include
|
||||
python_packages = [
|
||||
"PyQt5",
|
||||
'requests',
|
||||
'PIL',
|
||||
'qtawesome',
|
||||
'notifypy',
|
||||
'psutil',
|
||||
'pypresence',
|
||||
]
|
||||
python_packages = []
|
||||
|
||||
# Modules to include
|
||||
python_modules = []
|
||||
|
|
|
@ -2,12 +2,17 @@ import json
|
|||
import os
|
||||
import shutil
|
||||
import sys
|
||||
import sysconfig
|
||||
from logging import getLogger
|
||||
|
||||
import requests
|
||||
from PIL import Image, UnidentifiedImageError
|
||||
from PyQt5.QtCore import pyqtSignal, QLocale, QSettings
|
||||
|
||||
# Windows
|
||||
if os.name == "nt":
|
||||
from win32com.client import Dispatch
|
||||
|
||||
from rare import lang_path, __version__, style_path
|
||||
from custom_legendary.core import LegendaryCore
|
||||
|
||||
|
@ -164,3 +169,25 @@ def create_desktop_link(app_name, core: LegendaryCore, type_of_link="desktop"):
|
|||
"StartupWMClass=rare-game\n"
|
||||
)
|
||||
os.chmod(os.path.expanduser(f"~/Desktop/{igame.title}.desktop"), 0o755)
|
||||
|
||||
# Windows
|
||||
elif os.name == "nt":
|
||||
# Target of shortcut
|
||||
target = sys.argv[0]
|
||||
|
||||
# Name of link file
|
||||
linkName = igame.title + '.lnk'
|
||||
|
||||
desktopFolder = os.path.expanduser('~/Desktop/')
|
||||
|
||||
# Path to location of link file
|
||||
pathLink = os.path.join(desktopFolder, linkName)
|
||||
|
||||
# Add shortcut
|
||||
shell = Dispatch('WScript.Shell')
|
||||
shortcut = shell.CreateShortCut(pathLink)
|
||||
shortcut.Targetpath = target
|
||||
shortcut.Arguments = f'launch {app_name}'
|
||||
shortcut.WorkingDirectory = os.getcwd()
|
||||
shortcut.IconLocation = os.path.join(os.getcwd(), 'Logo.ico')
|
||||
shortcut.save()
|
||||
|
|
Loading…
Reference in a new issue