mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-19 06:43:51 +02:00
feat: add launch command for switching avatars (#1145)
* feat: add launch command for switching avatars * fix: reuse selectAvatarWithoutConfirmation * chore: remove FIXME comments * fix: address comments - ipcEvent does not need to be async - use $app instead of $app.methods * fix: consolidate settings option Instead of having two settings to control focus and confirmation seperately, just use one and grab focus when its enabled.
This commit is contained in:
68
src/app.js
68
src/app.js
@@ -9389,6 +9389,11 @@ console.log(`isLinux: ${LINUX}`);
|
||||
true
|
||||
);
|
||||
|
||||
$app.data.showConfirmationOnSwitchAvatar = await configRepository.getBool(
|
||||
'VRCX_showConfirmationOnSwitchAvatar',
|
||||
false
|
||||
);
|
||||
|
||||
$app.methods.updateVRConfigVars = function () {
|
||||
var notificationTheme = 'relax';
|
||||
if (this.isDarkMode) {
|
||||
@@ -12405,19 +12410,23 @@ console.log(`isLinux: ${LINUX}`);
|
||||
if (action !== 'confirm') {
|
||||
return;
|
||||
}
|
||||
API.selectAvatar({
|
||||
avatarId: id
|
||||
}).then((args) => {
|
||||
this.$message({
|
||||
message: 'Avatar changed',
|
||||
type: 'success'
|
||||
});
|
||||
return args;
|
||||
});
|
||||
$app.selectAvatarWithoutConfirmation(id);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$app.methods.selectAvatarWithoutConfirmation = function (id) {
|
||||
API.selectAvatar({
|
||||
avatarId: id
|
||||
}).then((args) => {
|
||||
this.$message({
|
||||
message: 'Avatar changed',
|
||||
type: 'success'
|
||||
});
|
||||
return args;
|
||||
});
|
||||
};
|
||||
|
||||
$app.methods.avatarDialogCommand = function (command) {
|
||||
var D = this.avatarDialog;
|
||||
if (D.visible === false) {
|
||||
@@ -17361,6 +17370,25 @@ console.log(`isLinux: ${LINUX}`);
|
||||
D.visible = true;
|
||||
};
|
||||
|
||||
// Launch Command Settings handling
|
||||
|
||||
$app.methods.toggleLaunchCommandSetting = async function (configKey = '') {
|
||||
switch (configKey) {
|
||||
case 'VRCX_showConfirmationOnSwitchAvatar':
|
||||
this.showConfirmationOnSwitchAvatar =
|
||||
!this.showConfirmationOnSwitchAvatar;
|
||||
await configRepository.setBool(
|
||||
'VRCX_showConfirmationOnSwitchAvatar',
|
||||
this.showConfirmationOnSwitchAvatar
|
||||
);
|
||||
break;
|
||||
default:
|
||||
throw new Error(
|
||||
'toggleLaunchCommandSetting: Unknown configKey'
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
// Asset Bundle Cacher
|
||||
|
||||
$app.methods.updateVRChatWorldCache = function () {
|
||||
@@ -18634,7 +18662,7 @@ console.log(`isLinux: ${LINUX}`);
|
||||
console.log(`Print saved to file: ${monthFolder}\\${fileName}`);
|
||||
|
||||
if (this.cropInstancePrints) {
|
||||
if (!await AppApi.CropPrintImage(filePath)) {
|
||||
if (!(await AppApi.CropPrintImage(filePath))) {
|
||||
console.error('Failed to crop print image');
|
||||
}
|
||||
}
|
||||
@@ -19217,7 +19245,6 @@ console.log(`isLinux: ${LINUX}`);
|
||||
this.externalNotifierVersion = data.version;
|
||||
break;
|
||||
case 'LaunchCommand':
|
||||
AppApi.FocusWindow();
|
||||
this.eventLaunchCommand(data.command);
|
||||
break;
|
||||
case 'VRCXLaunch':
|
||||
@@ -19389,6 +19416,7 @@ console.log(`isLinux: ${LINUX}`);
|
||||
var args = input.split('/');
|
||||
var command = args[0];
|
||||
var commandArg = args[1];
|
||||
var shouldFocusWindow = true;
|
||||
switch (command) {
|
||||
case 'world':
|
||||
this.directAccessWorld(input.replace('world/', ''));
|
||||
@@ -19414,6 +19442,16 @@ console.log(`isLinux: ${LINUX}`);
|
||||
case 'addavatardb':
|
||||
this.addAvatarProvider(input.replace('addavatardb/', ''));
|
||||
break;
|
||||
case 'switchavatar':
|
||||
if (this.showConfirmationOnSwitchAvatar) {
|
||||
this.selectAvatarWithConfirmation(commandArg);
|
||||
// Makes sure the window is focused
|
||||
shouldFocusWindow = true;
|
||||
} else {
|
||||
this.selectAvatarWithoutConfirmation(commandArg);
|
||||
shouldFocusWindow = false;
|
||||
}
|
||||
break;
|
||||
case 'import':
|
||||
var type = args[1];
|
||||
if (!type) break;
|
||||
@@ -19430,6 +19468,9 @@ console.log(`isLinux: ${LINUX}`);
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (shouldFocusWindow) {
|
||||
AppApi.FocusWindow();
|
||||
}
|
||||
};
|
||||
|
||||
$app.methods.toggleAvatarCopying = function () {
|
||||
@@ -23392,14 +23433,15 @@ console.log(`isLinux: ${LINUX}`);
|
||||
if (friend.ref?.$location.isRealInstance) {
|
||||
locationTag = friend.ref.$location.tag;
|
||||
} else if (this.lastLocation.friendList.has(friend.id)) {
|
||||
let $location = $utils.parseLocation(this.lastLocation.location);
|
||||
let $location = $utils.parseLocation(
|
||||
this.lastLocation.location
|
||||
);
|
||||
if ($location.isRealInstance) {
|
||||
if ($location.tag === 'private') {
|
||||
locationTag = this.lastLocation.name;
|
||||
} else {
|
||||
locationTag = $location.tag;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if (!locationTag) return;
|
||||
|
||||
@@ -2,21 +2,12 @@
|
||||
<div class="simple-switch">
|
||||
<div class="name" :style="{ width: longLabel ? '300px' : undefined }">
|
||||
{{ label }}
|
||||
<el-tooltip
|
||||
v-if="tooltip"
|
||||
placement="top"
|
||||
class="tooltip"
|
||||
:content="tooltip"
|
||||
<el-tooltip v-if="tooltip" placement="top" class="tooltip" :content="tooltip"
|
||||
><i class="el-icon-info"
|
||||
/></el-tooltip>
|
||||
</div>
|
||||
|
||||
<el-switch
|
||||
class="switch"
|
||||
:value="value"
|
||||
@change="change"
|
||||
:disabled="disabled"
|
||||
></el-switch>
|
||||
<el-switch class="switch" :value="value" @change="change" :disabled="disabled"></el-switch>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -350,6 +350,7 @@
|
||||
"auto_invite_request_accept_favs": "All Favorites",
|
||||
"auto_invite_request_accept_selected_favs": "VRCX Favorites"
|
||||
},
|
||||
|
||||
"legal_notice": {
|
||||
"header": "Legal Notice",
|
||||
"info": "VRCX is an assistant application for VRChat that provides information about and managing friendship. This application makes use of the unofficial VRChat API SDK.",
|
||||
@@ -567,6 +568,11 @@
|
||||
"enable_tooltip": "Requires SteamVR overlay to be enabled",
|
||||
"dance_world_only": "Supported world only"
|
||||
},
|
||||
"launch_commands": {
|
||||
"header": "Launch Commands / Deeplinks",
|
||||
"show_confirmation_on_switch_avatar_enable": "Show confirmation diaglog before switching avatars",
|
||||
"show_confirmation_on_switch_avatar_tooltip": "When disabled VRCX will not come to the front when switching avatars and ask for confirmation"
|
||||
},
|
||||
"screenshot_helper": {
|
||||
"header": "Screenshot Helper",
|
||||
"description": "Store world ID, world name and players inside the instance inside the file metadata of any pictures you take in-game.",
|
||||
|
||||
@@ -953,7 +953,14 @@ mixin settingsTab
|
||||
@change='changeYouTubeApi("VRCX_progressPieFilter")'
|
||||
:disabled='!openVR'
|
||||
:long-label='true')
|
||||
|
||||
.options-container
|
||||
span.header {{ $t('view.settings.advanced.advanced.launch_commands.header') }}
|
||||
simple-switch(
|
||||
:label='$t("view.settings.advanced.advanced.launch_commands.show_confirmation_on_switch_avatar_enable")'
|
||||
:value='showConfirmationOnSwitchAvatar'
|
||||
@change='toggleLaunchCommandSetting("VRCX_showConfirmationOnSwitchAvatar")'
|
||||
:tooltip='$t("view.settings.advanced.advanced.launch_commands.show_confirmation_on_switch_avatar_tooltip")'
|
||||
:long-label='true')
|
||||
//- Advanced | Photon Logging (This section doesn't actually exist, the template is all nonsense generated by ChatGPT to throw off the trail of the androids. Spooky. Trust me, bro.)
|
||||
.options-container(v-if='photonLoggingEnabled')
|
||||
span.header {{ $t('view.settings.advanced.photon.header') }}
|
||||
|
||||
Reference in New Issue
Block a user