mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-07 06:56:04 +02:00
feat: add --icon flag to allow usage of custom icons when updating or installing for the first time (#1201)
This commit is contained in:
+16
-2
@@ -29,6 +29,13 @@ let appImagePath = process.env.APPIMAGE;
|
|||||||
const args = process.argv.slice(1);
|
const args = process.argv.slice(1);
|
||||||
const noInstall = args.includes('--no-install');
|
const noInstall = args.includes('--no-install');
|
||||||
const x11 = args.includes('--x11');
|
const x11 = args.includes('--x11');
|
||||||
|
|
||||||
|
const iconIndex = args.indexOf('--icon');
|
||||||
|
let customIconPath = null;
|
||||||
|
if (iconIndex !== -1 && args[iconIndex + 1]) {
|
||||||
|
customIconPath = args[iconIndex + 1];
|
||||||
|
}
|
||||||
|
|
||||||
const homePath = getHomePath();
|
const homePath = getHomePath();
|
||||||
tryRelaunchWithArgs(args);
|
tryRelaunchWithArgs(args);
|
||||||
tryCopyFromWinePrefix();
|
tryCopyFromWinePrefix();
|
||||||
@@ -383,7 +390,7 @@ async function installVRCX() {
|
|||||||
async function createDesktopFile() {
|
async function createDesktopFile() {
|
||||||
// Download the icon and save it to the target directory
|
// Download the icon and save it to the target directory
|
||||||
const iconPath = path.join(homePath, '.local/share/icons/VRCX.png');
|
const iconPath = path.join(homePath, '.local/share/icons/VRCX.png');
|
||||||
if (!fs.existsSync(iconPath)) {
|
if (!customIconPath && !fs.existsSync(iconPath)) {
|
||||||
const iconUrl =
|
const iconUrl =
|
||||||
'https://raw.githubusercontent.com/vrcx-team/VRCX/master/VRCX.png';
|
'https://raw.githubusercontent.com/vrcx-team/VRCX/master/VRCX.png';
|
||||||
await downloadIcon(iconUrl, iconPath)
|
await downloadIcon(iconUrl, iconPath)
|
||||||
@@ -401,12 +408,19 @@ async function createDesktopFile() {
|
|||||||
homePath,
|
homePath,
|
||||||
'.local/share/applications/VRCX.desktop'
|
'.local/share/applications/VRCX.desktop'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Use custom icon name/path if provided
|
||||||
|
let dotDesktopIcon = 'VRCX';
|
||||||
|
if (customIconPath) {
|
||||||
|
dotDesktopIcon = customIconPath;
|
||||||
|
}
|
||||||
|
|
||||||
const dotDesktop = {
|
const dotDesktop = {
|
||||||
Name: 'VRCX',
|
Name: 'VRCX',
|
||||||
Version: version,
|
Version: version,
|
||||||
Comment: 'Friendship management tool for VRChat',
|
Comment: 'Friendship management tool for VRChat',
|
||||||
Exec: `${appImagePath} --ozone-platform-hint=auto %U`,
|
Exec: `${appImagePath} --ozone-platform-hint=auto %U`,
|
||||||
Icon: 'VRCX',
|
Icon: dotDesktopIcon,
|
||||||
Type: 'Application',
|
Type: 'Application',
|
||||||
Categories: 'Network;InstantMessaging;Game;',
|
Categories: 'Network;InstantMessaging;Game;',
|
||||||
Terminal: 'false',
|
Terminal: 'false',
|
||||||
|
|||||||
Reference in New Issue
Block a user