Skip to content

Commit

Permalink
在标题栏添加一个快捷打开小窗口的按钮
Browse files Browse the repository at this point in the history
  • Loading branch information
Hanxven committed Aug 11, 2024
1 parent 7ff7d12 commit 012aa84
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 7 deletions.
29 changes: 22 additions & 7 deletions src/renderer/src-main-window/components/MainWindowTitleBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,14 @@
</div>

<div class="traffic">
<div
v-if="aux.settings.enabled"
title="小窗口"
class="traffic-button minimize"
@click="handleShowAuxWindow"
>
<NIcon><WindowNew20FilledIcon /></NIcon>
</div>
<div title="最小化" class="traffic-button minimize" @click="handleMinimize">
<NIcon style="transform: rotate(90deg)"><DividerShort20RegularIcon /></NIcon>
</div>
Expand All @@ -139,7 +147,9 @@
@click="handleMaximize"
>
<NIcon
><Maximize20RegularIcon v-if="mw.windowState === 'normal'" /><CarbonIcon v-else />
><Maximize20RegularIcon v-if="mw.windowState === 'normal'" /><WindowMultiple16FilledIcon
v-else
/>
</NIcon>
</div>
<div title="关闭" class="traffic-button close" @click="handleClose">
Expand All @@ -155,18 +165,19 @@ import { appRendererModule as am } from '@shared/renderer/modules/app'
import { useAppStore } from '@shared/renderer/modules/app/store'
import { useAutoGameflowStore } from '@shared/renderer/modules/auto-gameflow/store'
import { useAutoUpdateStore } from '@shared/renderer/modules/auto-update/store'
import { auxiliaryWindowRendererModule as awm } from '@shared/renderer/modules/auxiliary-window'
import { useAuxiliaryWindowStore } from '@shared/renderer/modules/auxiliary-window/store'
import { useLcuConnectionStore } from '@shared/renderer/modules/lcu-connection/store'
import { useLoginStore } from '@shared/renderer/modules/lcu-state-sync/login'
import { mainWindowRendererModule as mwm } from '@shared/renderer/modules/main-window'
import { useMainWindowStore } from '@shared/renderer/modules/main-window/store'
import { useRespawnTimerStore } from '@shared/renderer/modules/respawn-timer/store'
import { MainWindowCloseStrategy } from '@shared/types/modules/app'
import { Hourglass as HourglassIcon, Queued as QueuedIcon, Time as TimeIcon } from '@vicons/carbon'
import {
Carbon as CarbonIcon,
Hourglass as HourglassIcon,
Queued as QueuedIcon,
Time as TimeIcon
} from '@vicons/carbon'
WindowMultiple16Filled as WindowMultiple16FilledIcon,
WindowNew20Filled as WindowNew20FilledIcon
} from '@vicons/fluent'
import {
DividerShort20Regular as DividerShort20RegularIcon,
Maximize20Regular as Maximize20RegularIcon
Expand All @@ -191,7 +202,7 @@ const mw = useMainWindowStore()
const respawnTimer = useRespawnTimerStore()
const autoGameflow = useAutoGameflowStore()
const login = useLoginStore()
const lc = useLcuConnectionStore()
const aux = useAuxiliaryWindowStore()
const au = useAutoUpdateStore()
const willAcceptIn = ref(0)
Expand Down Expand Up @@ -238,6 +249,10 @@ watch(
{ immediate: true }
)
const handleShowAuxWindow = () => {
awm.show()
}
const handleMinimize = async () => {
await mwm.minimize()
}
Expand Down
4 changes: 4 additions & 0 deletions src/shared/renderer/modules/auxiliary-window/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ export class AuxWindowRendererModule extends StateSyncModule {
getFunctionality() {
return this.call('get-functionality')
}

show() {
return this.call('show')
}
}

export const auxiliaryWindowRendererModule = new AuxWindowRendererModule()

0 comments on commit 012aa84

Please sign in to comment.