mirror of
https://github.com/lanyeeee/bilibili-video-downloader.git
synced 2026-05-06 20:02:57 +08:00
feat: 添加窗口置顶功能
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
"core:window:allow-minimize",
|
||||
"core:window:allow-toggle-maximize",
|
||||
"core:window:allow-close",
|
||||
"core:window:allow-set-always-on-top",
|
||||
"dialog:default"
|
||||
]
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import icon from '../../src-tauri/icons/128x128.png'
|
||||
import { PhCopySimple, PhMinus, PhSquare, PhX } from '@phosphor-icons/vue'
|
||||
import { PhCopySimple, PhMinus, PhPushPin, PhSquare, PhX } from '@phosphor-icons/vue'
|
||||
import { getCurrentWindow } from '@tauri-apps/api/window'
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { useStore } from '../store.ts'
|
||||
@@ -13,6 +13,7 @@ const store = useStore()
|
||||
const appWindow = getCurrentWindow()
|
||||
const windowMaximised = ref<boolean>(false)
|
||||
const windowFullscreen = ref<boolean>(false)
|
||||
const windowAlwaysOnTop = ref<boolean>(false)
|
||||
|
||||
const currentPlatform = platform()
|
||||
|
||||
@@ -20,12 +21,18 @@ const loginDialogShowing = ref<boolean>(false)
|
||||
|
||||
onMounted(async () => {
|
||||
windowMaximised.value = await appWindow.isMaximized()
|
||||
windowFullscreen.value = await appWindow.isFullscreen()
|
||||
|
||||
await appWindow.onResized(async () => {
|
||||
windowMaximised.value = await appWindow.isMaximized()
|
||||
windowFullscreen.value = await appWindow.isFullscreen()
|
||||
})
|
||||
})
|
||||
|
||||
function handleAlwaysOnTopButton() {
|
||||
windowAlwaysOnTop.value = !windowAlwaysOnTop.value
|
||||
appWindow.setAlwaysOnTop(windowAlwaysOnTop.value)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -55,6 +62,14 @@ onMounted(async () => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
title="窗口置顶"
|
||||
class="mr-2 cursor-pointer p-1.5 rounded-lg flex items-center justify-between hover:bg-gray-3/70"
|
||||
:class="windowAlwaysOnTop ? 'text-sky-5' : 'text-black'"
|
||||
@click="handleAlwaysOnTopButton">
|
||||
<PhPushPin size="18" :weight="windowAlwaysOnTop ? 'fill' : 'regular'" />
|
||||
</div>
|
||||
|
||||
<div v-if="currentPlatform !== 'macos'" class="flex items-center select-none">
|
||||
<div
|
||||
class="flex items-center justify-center h-9 w-9 hover:bg-gray/20 cursor-pointer"
|
||||
|
||||
Reference in New Issue
Block a user