-
Notifications
You must be signed in to change notification settings - Fork 749
Description
描述 Bug
After enabling "Launch on startup", the Bongo Cat desktop pet starts correctly and displays on the desktop, but the tray context menu shows incorrect text for the show/hide option.
重现步骤
Steps to Reproduce
Open Bongo Cat application
Go to Preferences → General Settings
Enable "Launch on startup" option
Restart computer
After system startup, Bongo Cat auto-starts and displays on desktop
Right-click the tray icon
Observe menu text: shows "Show Cat" (incorrect) instead of "Hide Cat" (correct)
预期行为
Current Behavior:
Cat window is visible on desktop
But right-click menu shows "Show Cat" (should be "Hide Cat")
Expected Behavior:
When cat window is visible, menu should show "Hide Cat"
When cat window is hidden, menu should show "Show Cat"
软件信息
{
"appName": "BongoCat",
"appVersion": "0.8.1",
"tauriVersion": "2.5.1",
"platform": "windows",
"platformArch": "x86_64",
"platformVersion": "10.0.26100"
}
附加信息
The issue is in src/composables/useSharedMenu.ts:
Problematic code (around lines 53-58):
MenuItem.new({
text: catStore.window.visible ? t('composables.useSharedMenu.labels.hideCat') : t('composables.useSharedMenu.labels.showCat'),
action: () => {
catStore.window.visible = !catStore.window.visible
},
}),
Root Cause:
The menu text is only set once when the menu is created, based on the initial state. It doesn't update automatically when:
There are timing issues during auto-start initialization
The cat visibility state changes
Proposed Solutions
Solution 1: Add state listener and menu update mechanism
import { watch } from 'vue'
// Watch cat visibility changes and update menu in real-time
watch(() => catStore.window.visible, (newVal) => {
updateToggleCatMenuText()
})
Solution 2: Fix initialization order during auto-start
// Force menu text synchronization after app fully starts
onMounted(() => {
setTimeout(() => {
updateToggleCatMenuText()
}, 1000)
})
Solution 3: Update text immediately after menu action
action: () => {
catStore.window.visible = !catStore.window.visible
updateToggleCatMenuText() // Update menu text immediately
}