Skip to content

Commit

Permalink
perf: adjust display scale, close #61 (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
orangelckc committed Mar 22, 2023
1 parent 4c718fa commit f7c4a84
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
8 changes: 4 additions & 4 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<script setup lang="ts">
import { appWindow } from '@tauri-apps/api/window'
import { platform } from '@tauri-apps/api/os'
import { type } from '@tauri-apps/api/os'
import { initSQL } from '@/sqls'
import { useSessionStore, useSettingsStore } from '@/stores'
import { useSettingsStore } from '@/stores'
import { useObserverLink } from '@/hooks'
const { isFix, windowFocused } = storeToRefs(useSettingsStore())
Expand Down Expand Up @@ -38,9 +38,9 @@ onMounted(async () => {
watch(
windowFocused,
async (newValue) => {
const platformName = await platform()
const platformName = await type()
if (platformName !== 'darwin') {
if (platformName !== 'Darwin') {
windowClass.value = 'bordered'
} else {
let className = 'rounded-xl '
Expand Down
11 changes: 6 additions & 5 deletions src/stores/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,12 @@ export const useSettingsStore = defineStore(

// 监听开机自启动
watchEffect(() => {
if (autoStart.value) {
enable()
} else {
disable()
}
autoStart.value ? enable() : disable()
})

// 监听显示设备变化时,重置窗口位置到中间,以防止窗口位置偏移到屏幕外
appWindow.onScaleChanged(() => {
appWindow.center()
})

return {
Expand Down

0 comments on commit f7c4a84

Please sign in to comment.