Hide and force enable isCloseToTray option on macOS

This commit is contained in:
Natsumi
2025-10-27 19:13:46 +11:00
parent 7b9490e110
commit 03509a441b
3 changed files with 14 additions and 5 deletions

View File

@@ -120,7 +120,13 @@ let mainWindow = undefined;
const VRCXStorage = interopApi.getDotNetObject('VRCXStorage'); const VRCXStorage = interopApi.getDotNetObject('VRCXStorage');
const hasAskedToMoveAppImage = const hasAskedToMoveAppImage =
VRCXStorage.Get('VRCX_HasAskedToMoveAppImage') === 'true'; VRCXStorage.Get('VRCX_HasAskedToMoveAppImage') === 'true';
let isCloseToTray = VRCXStorage.Get('VRCX_CloseToTray') === 'true';
function getCloseToTray() {
if (process.platform === 'darwin') {
return true;
}
return VRCXStorage.Get('VRCX_CloseToTray') === 'true';
}
const gotTheLock = app.requestSingleInstanceLock(); const gotTheLock = app.requestSingleInstanceLock();
const strip_vrcx_prefix_regex = new RegExp('^' + VRCX_URI_PREFIX + '://'); const strip_vrcx_prefix_regex = new RegExp('^' + VRCX_URI_PREFIX + '://');
@@ -361,8 +367,7 @@ function createWindow() {
mainWindow.webContents.setVisualZoomLevelLimits(1, 5); mainWindow.webContents.setVisualZoomLevelLimits(1, 5);
mainWindow.on('close', (event) => { mainWindow.on('close', (event) => {
isCloseToTray = VRCXStorage.Get('VRCX_CloseToTray') === 'true'; if (getCloseToTray() && !appIsQuitting) {
if (isCloseToTray && !appIsQuitting) {
event.preventDefault(); event.preventDefault();
mainWindow.hide(); mainWindow.hide();
} else { } else {
@@ -872,7 +877,7 @@ function tryCopyFromWinePrefix() {
function applyWindowState() { function applyWindowState() {
if (VRCXStorage.Get('VRCX_StartAsMinimizedState') === 'true' && startup) { if (VRCXStorage.Get('VRCX_StartAsMinimizedState') === 'true' && startup) {
if (isCloseToTray) { if (getCloseToTray()) {
mainWindow.hide(); mainWindow.hide();
return; return;
} }

View File

@@ -21,7 +21,7 @@ export const useGeneralSettingsStore = defineStore('GeneralSettings', () => {
const isStartAtWindowsStartup = ref(false); const isStartAtWindowsStartup = ref(false);
const isStartAsMinimizedState = ref(false); const isStartAsMinimizedState = ref(false);
const disableGpuAcceleration = ref(false); const disableGpuAcceleration = ref(false);
const isCloseToTray = ref(process.platform === 'darwin' ? true : false); const isCloseToTray = ref(false);
const disableVrOverlayGpuAcceleration = ref(false); const disableVrOverlayGpuAcceleration = ref(false);
const localFavoriteFriendsGroups = ref([]); const localFavoriteFriendsGroups = ref([]);
const udonExceptionLogging = ref(false); const udonExceptionLogging = ref(false);

View File

@@ -81,6 +81,7 @@
:tooltip="t('view.settings.general.application.startup_linux')" :tooltip="t('view.settings.general.application.startup_linux')"
@change="setIsStartAsMinimizedState" /> @change="setIsStartAsMinimizedState" />
<simple-switch <simple-switch
v-if="!isMacOS"
:label="t('view.settings.general.application.tray')" :label="t('view.settings.general.application.tray')"
:value="isCloseToTray" :value="isCloseToTray"
@change="setIsCloseToTray" /> @change="setIsCloseToTray" />
@@ -364,6 +365,9 @@
const ossDialog = ref(false); const ossDialog = ref(false);
const isLinux = computed(() => LINUX); const isLinux = computed(() => LINUX);
const isMacOS = computed(() => {
return navigator.platform.indexOf('Mac') > -1;
});
const OpenSourceSoftwareNoticeDialog = defineAsyncComponent( const OpenSourceSoftwareNoticeDialog = defineAsyncComponent(
() => import('../../dialogs/OpenSourceSoftwareNoticeDialog.vue') () => import('../../dialogs/OpenSourceSoftwareNoticeDialog.vue')