Skip to content

Commit

Permalink
fix(view): 🐛 修复系统托盘无法变化成多列表操作
Browse files Browse the repository at this point in the history
  • Loading branch information
nongyehong committed Jan 6, 2025
1 parent 7aaabb2 commit 36d9a03
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/views/Notify.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
</n-flex>
</n-scrollbar>
<component :is="division" />
<p @click="handleTip" class="pt-4px pl-6px text-(12px #909090) cursor-pointer">忽略全部</p>
<p @click="handleTip" class="pt-4px pl-6px text-(12px #13987f) cursor-pointer">忽略全部</p>

Check warning on line 36 in src/views/Notify.vue

View check run for this annotation

Codecov / codecov/patch

src/views/Notify.vue#L36

Added line #L36 was not covered by tests
</n-flex>
</template>
<script setup lang="tsx">
Expand Down
40 changes: 19 additions & 21 deletions src/views/Tray.vue
Original file line number Diff line number Diff line change
Expand Up @@ -119,28 +119,31 @@ watchEffect(async () => {
}
})
// 可以使用 watch 来观察焦点状态的变化
watch([isFocused, () => tipVisible.value], ([newFocused, newTipVisible]) => {
console.log('Focus or tip state changed:', { focused: newFocused, tipVisible: newTipVisible })
})
onMounted(async () => {
home = await WebviewWindow.getByLabel('home')
isFocused.value = (await home?.isFocused()) || false
await pushListeners([
appWindow.listen('login_success', () => {
isLoginWin.value = false
resizeWindow('tray', 130, 356)
}),
appWindow.listen('logout_success', () => {
isLoginWin.value = true
resizeWindow('tray', 130, 44)
})
])
if (home) {
// 监听窗口焦点变化
home.listen('tauri://focus', () => {
isFocused.value = true
})
home.listen('tauri://blur', () => {
isFocused.value = false
})
await pushListeners([
// 监听窗口焦点变化
home.listen('tauri://focus', () => {
isFocused.value = true
appWindow.listen('login_success', () => {
isLoginWin.value = false
resizeWindow('tray', 130, 356)
}),
home.listen('tauri://blur', () => {
isFocused.value = false
appWindow.listen('logout_success', () => {
isLoginWin.value = true
resizeWindow('tray', 130, 44)
}),
appWindow.listen('show_tip', async () => {
console.log('Received show_tip event')
Expand All @@ -150,11 +153,6 @@ onMounted(async () => {
}
})
// 可以使用 watch 来观察焦点状态的变化
watch([isFocused, () => tipVisible.value], ([newFocused, newTipVisible]) => {
console.log('Focus or tip state changed:', { focused: newFocused, tipVisible: newTipVisible })
})
onUnmounted(async () => {
if (interval) {
clearInterval(interval)
Expand Down

0 comments on commit 36d9a03

Please sign in to comment.