mirror of
https://github.com/ayangweb/BongoCat.git
synced 2026-03-12 17:51:48 +08:00
Compare commits
34 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d9fb19aa2f | ||
|
|
ef17ba9ebc | ||
|
|
d69669bd3a | ||
|
|
2fc6ec9d2f | ||
|
|
50803eb2ce | ||
|
|
57892f3ab3 | ||
|
|
b59ec09354 | ||
|
|
49b5d9954c | ||
|
|
f1fac05975 | ||
|
|
6554508c30 | ||
|
|
7e7c1aded0 | ||
|
|
1e24c04da2 | ||
|
|
392963f6fd | ||
|
|
29623577ff | ||
|
|
a75c2d6a74 | ||
|
|
af76a58fba | ||
|
|
cd0066d2fa | ||
|
|
4b717363c1 | ||
|
|
c486a32372 | ||
|
|
ec4150d68b | ||
|
|
3aa24f5b75 | ||
|
|
5c0de3afb6 | ||
|
|
bbdb63ff6d | ||
|
|
c163f52fd0 | ||
|
|
ff4d590f4c | ||
|
|
e4084aabb5 | ||
|
|
9abd640197 | ||
|
|
54872012b1 | ||
|
|
0eac8e489a | ||
|
|
7a997a4bfd | ||
|
|
9aeee8d105 | ||
|
|
4c0a30d621 | ||
|
|
c33703e368 | ||
|
|
36aaf1067e |
6
.vscode/settings.json
vendored
6
.vscode/settings.json
vendored
@@ -51,5 +51,9 @@
|
||||
],
|
||||
|
||||
"typescript.enablePromptUseWorkspaceTsdk": true,
|
||||
"typescript.tsdk": "./node_modules/typescript/lib"
|
||||
"typescript.tsdk": "./node_modules/typescript/lib",
|
||||
|
||||
"i18n-ally.localesPaths": ["src/locales"],
|
||||
"i18n-ally.keystyle": "nested",
|
||||
"i18n-ally.displayLanguage": "zh-CN"
|
||||
}
|
||||
|
||||
28
Cargo.lock
generated
28
Cargo.lock
generated
@@ -450,7 +450,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "bongo-cat"
|
||||
version = "0.7.0"
|
||||
version = "0.9.0"
|
||||
dependencies = [
|
||||
"fs_extra",
|
||||
"gilrs",
|
||||
@@ -466,6 +466,7 @@ dependencies = [
|
||||
"tauri-plugin-dialog",
|
||||
"tauri-plugin-fs",
|
||||
"tauri-plugin-global-shortcut",
|
||||
"tauri-plugin-locale",
|
||||
"tauri-plugin-log",
|
||||
"tauri-plugin-macos-permissions",
|
||||
"tauri-plugin-opener",
|
||||
@@ -972,6 +973,18 @@ dependencies = [
|
||||
"syn 2.0.101",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "current_locale"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e0be8ddcccda8be68d8e31a421ceea7c79857404daa052434ae30ce2f402cd10"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"objc",
|
||||
"objc-foundation",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "darling"
|
||||
version = "0.20.11"
|
||||
@@ -5018,6 +5031,19 @@ dependencies = [
|
||||
"thiserror 2.0.12",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tauri-plugin-locale"
|
||||
version = "2.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5686c1fe8fb748c45ba0b516db42f78dd6fde91b16bc5248de438eff8d2e6abd"
|
||||
dependencies = [
|
||||
"current_locale",
|
||||
"serde",
|
||||
"tauri",
|
||||
"tauri-plugin",
|
||||
"thiserror 2.0.12",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tauri-plugin-log"
|
||||
version = "2.4.0"
|
||||
|
||||
134
README.md
134
README.md
@@ -2,50 +2,25 @@
|
||||
|
||||
<div align="center">
|
||||
<div>
|
||||
<a href="https://github.com/ayangweb/BongoCat/releases">
|
||||
<img
|
||||
alt="Windows"
|
||||
src="https://img.shields.io/badge/-Windows-blue?style=flat-square&logo=data:image/svg+xml;base64,PHN2ZyB0PSIxNzI2MzA1OTcxMDA2IiBjbGFzcz0iaWNvbiIgdmlld0JveD0iMCAwIDEwMjQgMTAyNCIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHAtaWQ9IjE1NDgiIHdpZHRoPSIxMjgiIGhlaWdodD0iMTI4Ij48cGF0aCBkPSJNNTI3LjI3NTU1MTYxIDk2Ljk3MTAzMDEzdjM3My45OTIxMDY2N2g0OTQuNTEzNjE5NzVWMTUuMDI2NzU3NTN6TTUyNy4yNzU1NTE2MSA5MjguMzIzNTA4MTVsNDk0LjUxMzYxOTc1IDgwLjUyMDI4MDQ5di00NTUuNjc3NDcxNjFoLTQ5NC41MTM2MTk3NXpNNC42NzA0NTEzNiA0NzAuODMzNjgyOTdINDIyLjY3Njg1OTI1VjExMC41NjM2ODE5N2wtNDE4LjAwNjQwNzg5IDY5LjI1Nzc5NzUzek00LjY3MDQ1MTM2IDg0Ni43Njc1OTcwM0w0MjIuNjc2ODU5MjUgOTE0Ljg2MDMxMDEzVjU1My4xNjYzMTcwM0g0LjY3MDQ1MTM2eiIgcC1pZD0iMTU0OSIgZmlsbD0iI2ZmZmZmZiI+PC9wYXRoPjwvc3ZnPg=="
|
||||
/>
|
||||
</a>
|
||||
<a href="https://github.com/ayangweb/BongoCat/releases">
|
||||
<img
|
||||
alt="MacOS"
|
||||
src="https://img.shields.io/badge/-MacOS-black?style=flat-square&logo=apple&logoColor=white"
|
||||
/>
|
||||
</a>
|
||||
<a href="https://github.com/ayangweb/BongoCat/releases">
|
||||
<img
|
||||
alt="Linux"
|
||||
src="https://img.shields.io/badge/-Linux-yellow?style=flat-square&logo=linux&logoColor=white"
|
||||
/>
|
||||
</a>
|
||||
<a href="https://github.com/ayangweb/BongoCat/releases"><img alt="Windows" src="https://img.shields.io/badge/-Windows-blue?style=flat-square&logo=data:image/svg+xml;base64,PHN2ZyB0PSIxNzI2MzA1OTcxMDA2IiBjbGFzcz0iaWNvbiIgdmlld0JveD0iMCAwIDEwMjQgMTAyNCIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHAtaWQ9IjE1NDgiIHdpZHRoPSIxMjgiIGhlaWdodD0iMTI4Ij48cGF0aCBkPSJNNTI3LjI3NTU1MTYxIDk2Ljk3MTAzMDEzdjM3My45OTIxMDY2N2g0OTQuNTEzNjE5NzVWMTUuMDI2NzU3NTN6TTUyNy4yNzU1NTE2MSA5MjguMzIzNTA4MTVsNDk0LjUxMzYxOTc1IDgwLjUyMDI4MDQ5di00NTUuNjc3NDcxNjFoLTQ5NC41MTM2MTk3NXpNNC42NzA0NTEzNiA0NzAuODMzNjgyOTdINDIyLjY3Njg1OTI1VjExMC41NjM2ODE5N2wtNDE4LjAwNjQwNzg5IDY5LjI1Nzc5NzUzek00LjY3MDQ1MTM2IDg0Ni43Njc1OTcwM0w0MjIuNjc2ODU5MjUgOTE0Ljg2MDMxMDEzVjU1My4xNjYzMTcwM0g0LjY3MDQ1MTM2eiIgcC1pZD0iMTU0OSIgZmlsbD0iI2ZmZmZmZiI+PC9wYXRoPjwvc3ZnPg==" /></a>
|
||||
<a href="https://github.com/ayangweb/BongoCat/releases"><img alt="MacOS" src="https://img.shields.io/badge/-MacOS-black?style=flat-square&logo=apple&logoColor=white" /></a>
|
||||
<a href="https://github.com/ayangweb/BongoCat/releases"><img alt="Linux" src="https://img.shields.io/badge/-Linux-yellow?style=flat-square&logo=linux&logoColor=white" /></a>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
<a href="./LICENSE">
|
||||
<img
|
||||
src="https://img.shields.io/github/license/ayangweb/BongoCat?style=flat-square"
|
||||
/>
|
||||
</a>
|
||||
<a href="https://github.com/ayangweb/BongoCat/releases/latest">
|
||||
<img
|
||||
src="https://img.shields.io/github/package-json/v/ayangweb/BongoCat?style=flat-square"
|
||||
/>
|
||||
</a>
|
||||
<a href="https://github.com/ayangweb/BongoCat/releases">
|
||||
<img
|
||||
src="https://img.shields.io/github/downloads/ayangweb/BongoCat/total?style=flat-square"
|
||||
/>
|
||||
</a>
|
||||
<a href="./LICENSE"><img src="https://img.shields.io/github/license/ayangweb/BongoCat?style=flat-square" /></a>
|
||||
<a href="https://github.com/ayangweb/BongoCat/releases/latest"><img src="https://img.shields.io/github/package-json/v/ayangweb/BongoCat?style=flat-square"/></a>
|
||||
<a href="https://github.com/ayangweb/BongoCat/releases"><img src="https://img.shields.io/github/downloads/ayangweb/BongoCat/total?style=flat-square"/></a>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<a href="https://trendshift.io/developers/8507" target="_blank"><img src="https://trendshift.io/api/badge/developers/8507" alt="ayangweb | Trendshift" width="250" height="55" /></a>
|
||||
<a href="https://trendshift.io/repositories/14605" target="_blank"><img src="https://trendshift.io/api/badge/repositories/14605" alt="ayangweb%2FBongoCat | Trendshift" width="250" height="55" /></a>
|
||||
<a href="https://hellogithub.com/repository/7d23863fd4be47b39e816193ded385c9" target="_blank">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://abroad.hellogithub.com/v1/widgets/recommend.svg?rid=7d23863fd4be47b39e816193ded385c9&claim_uid=5ihRVIuTYBmSGtQ&theme=dark" />
|
||||
<source media="(prefers-color-scheme: light)" srcset="https://abroad.hellogithub.com/v1/widgets/recommend.svg?rid=7d23863fd4be47b39e816193ded385c9&claim_uid=5ihRVIuTYBmSGtQ&theme=neutral" />
|
||||
<img alt="Star History Chart" src="https://abroad.hellogithub.com/v1/widgets/recommend.svg?rid=7d23863fd4be47b39e816193ded385c9&claim_uid=5ihRVIuTYBmSGtQ&theme=neutral" />
|
||||
<img alt="Star History Chart" src="https://abroad.hellogithub.com/v1/widgets/recommend.svg?rid=7d23863fd4be47b39e816193ded385c9&claim_uid=5ihRVIuTYBmSGtQ&theme=neutral" width="250" height="55" />
|
||||
</picture>
|
||||
</a>
|
||||
</p>
|
||||
@@ -55,6 +30,12 @@
|
||||
| -------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
|
||||
|  |  |  |
|
||||
|
||||
## 赞助商
|
||||
|
||||
<a href="https://www.toolsetlink.com">
|
||||
<img height="54" alt="UpgradeLink" src="https://github.com/user-attachments/assets/6b84fb0f-3f1d-44b5-9932-2298bc999d8d" />
|
||||
</a>
|
||||
|
||||
## 开发背景
|
||||
|
||||
本项目的灵感来源于 [MMmmmoko](https://github.com/MMmmmoko) 大佬开发的 [Bongo-Cat-Mver](https://github.com/MMmmmoko/Bongo-Cat-Mver)。它以独特的猫咪互动功能深受用户喜爱,但仅支持 Windows 平台。作为一名深度 macOS 用户,我特别希望在自己的设备上也能使用这款可爱的猫咪,于是我决定开发一个适配 macOS 的版本。
|
||||
@@ -66,16 +47,22 @@
|
||||
- [夸克网盘](https://pan.quark.cn/s/70f2f2663ce1)
|
||||
- [GitHub Releases](https://github.com/ayangweb/BongoCat/releases)
|
||||
|
||||
> 不确定下载哪一个?请查阅[下载指南](.github/DOWNLOAD_GUIDE.md)。
|
||||
不确定下载哪一个?请查阅[下载指南](.github/DOWNLOAD_GUIDE.md)。
|
||||
|
||||
## 功能介绍
|
||||
|
||||
- 适配 macOS、Windows 和 Linux(x11)。
|
||||
- 根据据键盘或鼠标操作,同步移动鼠标或敲击键盘。
|
||||
- 根据键盘、鼠标或手柄的操作,同步对应的动作。
|
||||
- 支持导入自定义模型,自由打造专属猫咪形象。
|
||||
- 完全开源,代码公开透明,绝不收集任何用户数据。
|
||||
- 支持离线运行,无需联网,保护用户隐私。
|
||||
|
||||
## 模型转换
|
||||
|
||||
如果你想将 Bongo-Cat-Mver 应用中的模型转换为兼容 BongoCat 的格式,可以使用以下工具:
|
||||
|
||||
🔗 [在线转换](https://bongocat.vteamer.cc)
|
||||
|
||||
## 更多模型
|
||||
|
||||
你可以在这个仓库中探索、下载更多猫咪模型,或提交你的创作,与大家一起分享:
|
||||
@@ -84,20 +71,73 @@
|
||||
|
||||
## 社区交流
|
||||
|
||||
<a href="https://qm.qq.com/q/AS3gNv2Vzy">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://i0.hdslb.com/bfs/openplatform/5ad8e4278c525cca6d3b4426c30b6d299d8a9654.png" />
|
||||
<source media="(prefers-color-scheme: light)" srcset="https://i0.hdslb.com/bfs/openplatform/599680ad67bc9f9f876f76069c2239e9a85bb54d.png" />
|
||||
<img alt="QQ Group" src="https://i0.hdslb.com/bfs/openplatform/599680ad67bc9f9f876f76069c2239e9a85bb54d.png" height="250" />
|
||||
</picture>
|
||||
</a>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>QQ 群 1</th>
|
||||
<th>QQ 群 2</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="https://qm.qq.com/q/AS3gNv2Vzy">
|
||||
<picture>
|
||||
<source
|
||||
media="(prefers-color-scheme: dark)"
|
||||
srcset="https://i0.hdslb.com/bfs/openplatform/8ecdc4982ab01b59d7731fcca3ec26631a274560.png"
|
||||
/>
|
||||
<source
|
||||
media="(prefers-color-scheme: light)"
|
||||
srcset="https://i0.hdslb.com/bfs/openplatform/09f56580397063e1819c4c2ed63d07dee12720e1.png"
|
||||
/>
|
||||
<img
|
||||
alt="QQ Group 1"
|
||||
src="https://i0.hdslb.com/bfs/openplatform/09f56580397063e1819c4c2ed63d07dee12720e1.png"
|
||||
height="250"
|
||||
/>
|
||||
</picture>
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="https://qm.qq.com/q/TmltLAod2O">
|
||||
<picture>
|
||||
<source
|
||||
media="(prefers-color-scheme: dark)"
|
||||
srcset="https://i0.hdslb.com/bfs/openplatform/473c522487ff33e0f32b15466aeb0734f17161c8.png"
|
||||
/>
|
||||
<source
|
||||
media="(prefers-color-scheme: light)"
|
||||
srcset="https://i0.hdslb.com/bfs/openplatform/d5ae8c5af6ae1d0a1f066705ee822d1287384cf6.png"
|
||||
/>
|
||||
<img
|
||||
alt="QQ Group 2"
|
||||
src="https://i0.hdslb.com/bfs/openplatform/d5ae8c5af6ae1d0a1f066705ee822d1287384cf6.png"
|
||||
height="250"
|
||||
/>
|
||||
</picture>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
## 赞赏
|
||||
|
||||
每一份认可都值得被珍视!赞赏随缘,心意无价,谢谢你的支持 ❤️
|
||||
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://i0.hdslb.com/bfs/openplatform/e7438bff14cdfb6bfd0feacbb482f99ea4093294.png" />
|
||||
<source media="(prefers-color-scheme: light)" srcset="https://i0.hdslb.com/bfs/openplatform/da55cc3ec1556580c91e59f589792866c998c7c6.png" />
|
||||
<img alt="微信赞赏码" src="https://i0.hdslb.com/bfs/openplatform/da55cc3ec1556580c91e59f589792866c998c7c6.png" height="250" />
|
||||
</picture>
|
||||
|
||||
## 贡献指南
|
||||
|
||||
感谢大家为 BongoCat 做出的宝贵贡献!如果你也希望为 BongoCat 做出贡献,请查阅[贡献指南](.github/CONTRIBUTING.md)。
|
||||
|
||||
<a href="https://github.com/ayangweb/BongoCat/graphs/contributors">
|
||||
<img src="https://contrib.rocks/image?repo=ayangweb/BongoCat" />
|
||||
<a href="https://openomy.com/ayangweb/BongoCat" target="_blank" style="display: block; width: 100%;" align="center">
|
||||
<img src="https://openomy.com/svg?repo=ayangweb/BongoCat&chart=bubble" alt="Contribution Leaderboard" style="display: block; width: 100%;" />
|
||||
</a>
|
||||
|
||||
## 历史星标
|
||||
@@ -109,7 +149,3 @@
|
||||
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=ayangweb/BongoCat&type=Date" />
|
||||
</picture>
|
||||
</a>
|
||||
|
||||
## 致谢
|
||||
|
||||
- 特别感谢 [UpgradeLink](https://www.toolsetlink.com/) 提供高效稳定的自动更新服务,让本项目得以持续为用户带来最新版本的优质体验。
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "bongo-cat",
|
||||
"type": "module",
|
||||
"version": "0.7.0",
|
||||
"version": "0.9.0",
|
||||
"private": true,
|
||||
"author": {
|
||||
"name": "ayangweb",
|
||||
@@ -39,12 +39,15 @@
|
||||
"dayjs": "^1.11.13",
|
||||
"es-toolkit": "^1.38.0",
|
||||
"is-url": "^1.2.4",
|
||||
"json5": "^2.2.3",
|
||||
"nanoid": "^5.1.5",
|
||||
"pinia": "^3.0.3",
|
||||
"pixi-live2d-display": "^0.4.0",
|
||||
"pixi.js": "^6.5.10",
|
||||
"tauri-plugin-locale-api": "^2.0.1",
|
||||
"tauri-plugin-macos-permissions-api": "^2.3.0",
|
||||
"vue": "^3.5.16",
|
||||
"vue-i18n": "^11.1.12",
|
||||
"vue-markdown-render": "^2.2.1",
|
||||
"vue-router": "^4.5.1",
|
||||
"vue3-masonry-css": "^1.0.7"
|
||||
|
||||
60
pnpm-lock.yaml
generated
60
pnpm-lock.yaml
generated
@@ -62,6 +62,9 @@ importers:
|
||||
is-url:
|
||||
specifier: ^1.2.4
|
||||
version: 1.2.4
|
||||
json5:
|
||||
specifier: ^2.2.3
|
||||
version: 2.2.3
|
||||
nanoid:
|
||||
specifier: ^5.1.5
|
||||
version: 5.1.5
|
||||
@@ -74,12 +77,18 @@ importers:
|
||||
pixi.js:
|
||||
specifier: ^6.5.10
|
||||
version: 6.5.10
|
||||
tauri-plugin-locale-api:
|
||||
specifier: ^2.0.1
|
||||
version: 2.0.1
|
||||
tauri-plugin-macos-permissions-api:
|
||||
specifier: ^2.3.0
|
||||
version: 2.3.0
|
||||
vue:
|
||||
specifier: ^3.5.16
|
||||
version: 3.5.16(typescript@5.6.3)
|
||||
vue-i18n:
|
||||
specifier: ^11.1.12
|
||||
version: 11.1.12(vue@3.5.16(typescript@5.6.3))
|
||||
vue-markdown-render:
|
||||
specifier: ^2.2.1
|
||||
version: 2.2.1(vue@3.5.16(typescript@5.6.3))
|
||||
@@ -733,6 +742,18 @@ packages:
|
||||
'@types/node':
|
||||
optional: true
|
||||
|
||||
'@intlify/core-base@11.1.12':
|
||||
resolution: {integrity: sha512-whh0trqRsSqVLNEUCwU59pyJZYpU8AmSWl8M3Jz2Mv5ESPP6kFh4juas2NpZ1iCvy7GlNRffUD1xr84gceimjg==}
|
||||
engines: {node: '>= 16'}
|
||||
|
||||
'@intlify/message-compiler@11.1.12':
|
||||
resolution: {integrity: sha512-Fv9iQSJoJaXl4ZGkOCN1LDM3trzze0AS2zRz2EHLiwenwL6t0Ki9KySYlyr27yVOj5aVz0e55JePO+kELIvfdQ==}
|
||||
engines: {node: '>= 16'}
|
||||
|
||||
'@intlify/shared@11.1.12':
|
||||
resolution: {integrity: sha512-Om86EjuQtA69hdNj3GQec9ZC0L0vPSAnXzB3gP/gyJ7+mA7t06d9aOAiqMZ+xEOsumGP4eEBlfl8zF2LOTzf2A==}
|
||||
engines: {node: '>= 16'}
|
||||
|
||||
'@jridgewell/gen-mapping@0.3.8':
|
||||
resolution: {integrity: sha512-imAbBGkb+ebQyxKgzv5Hu2nmROxoDOXHh80evxdoXNOrvAnVx7zimzc1Oo5h9RlfV4vPXaE2iM5pOFbvOCClWA==}
|
||||
engines: {node: '>=6.0.0'}
|
||||
@@ -3209,6 +3230,11 @@ packages:
|
||||
json-stable-stringify-without-jsonify@1.0.1:
|
||||
resolution: {integrity: sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==}
|
||||
|
||||
json5@2.2.3:
|
||||
resolution: {integrity: sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==}
|
||||
engines: {node: '>=6'}
|
||||
hasBin: true
|
||||
|
||||
jsonc-eslint-parser@2.4.0:
|
||||
resolution: {integrity: sha512-WYDyuc/uFcGp6YtM2H0uKmUwieOuzeE/5YocFJLnLfclZ4inf3mRn8ZVy1s7Hxji7Jxm6Ss8gqpexD/GlKoGgg==}
|
||||
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
|
||||
@@ -4411,6 +4437,9 @@ packages:
|
||||
resolution: {integrity: sha512-Re10+NauLTMCudc7T5WLFLAwDhQ0JWdrMK+9B2M8zR5hRExKmsRDCBA7/aV/pNJFltmBFO5BAMlQFi/vq3nKOg==}
|
||||
engines: {node: '>=6'}
|
||||
|
||||
tauri-plugin-locale-api@2.0.1:
|
||||
resolution: {integrity: sha512-kiNcbP6ZKUpPbFseePrR9eb8kTRw8tSJ0ZBpQk4mDyGcbK3xGu0/dy7Cx8lBfC/p2MlmnyO4uRVIwta7FoV6eQ==}
|
||||
|
||||
tauri-plugin-macos-permissions-api@2.3.0:
|
||||
resolution: {integrity: sha512-pZp0jmDySysBqrGueknd1a7Rr4XEO9aXpMv9TNrT2PDHP0MSH20njieOagsFYJ5MCVb8A+wcaK0cIkjUC2dOww==}
|
||||
|
||||
@@ -4652,6 +4681,12 @@ packages:
|
||||
peerDependencies:
|
||||
vue: ^3.4.37
|
||||
|
||||
vue-i18n@11.1.12:
|
||||
resolution: {integrity: sha512-BnstPj3KLHLrsqbVU2UOrPmr0+Mv11bsUZG0PyCOzsawCivk8W00GMXHeVUWIDOgNaScCuZah47CZFE+Wnl8mw==}
|
||||
engines: {node: '>= 16'}
|
||||
peerDependencies:
|
||||
vue: ^3.0.0
|
||||
|
||||
vue-markdown-render@2.2.1:
|
||||
resolution: {integrity: sha512-XkYnC0PMdbs6Vy6j/gZXSvCuOS0787Se5COwXlepRqiqPiunyCIeTPQAO2XnB4Yl04EOHXwLx5y6IuszMWSgyQ==}
|
||||
peerDependencies:
|
||||
@@ -5354,6 +5389,18 @@ snapshots:
|
||||
optionalDependencies:
|
||||
'@types/node': 22.15.29
|
||||
|
||||
'@intlify/core-base@11.1.12':
|
||||
dependencies:
|
||||
'@intlify/message-compiler': 11.1.12
|
||||
'@intlify/shared': 11.1.12
|
||||
|
||||
'@intlify/message-compiler@11.1.12':
|
||||
dependencies:
|
||||
'@intlify/shared': 11.1.12
|
||||
source-map-js: 1.2.1
|
||||
|
||||
'@intlify/shared@11.1.12': {}
|
||||
|
||||
'@jridgewell/gen-mapping@0.3.8':
|
||||
dependencies:
|
||||
'@jridgewell/set-array': 1.2.1
|
||||
@@ -7992,6 +8039,8 @@ snapshots:
|
||||
|
||||
json-stable-stringify-without-jsonify@1.0.1: {}
|
||||
|
||||
json5@2.2.3: {}
|
||||
|
||||
jsonc-eslint-parser@2.4.0:
|
||||
dependencies:
|
||||
acorn: 8.14.1
|
||||
@@ -9437,6 +9486,10 @@ snapshots:
|
||||
|
||||
tapable@2.2.2: {}
|
||||
|
||||
tauri-plugin-locale-api@2.0.1:
|
||||
dependencies:
|
||||
'@tauri-apps/api': 2.5.0
|
||||
|
||||
tauri-plugin-macos-permissions-api@2.3.0:
|
||||
dependencies:
|
||||
'@tauri-apps/api': 2.5.0
|
||||
@@ -9710,6 +9763,13 @@ snapshots:
|
||||
dependencies:
|
||||
vue: 3.5.16(typescript@5.6.3)
|
||||
|
||||
vue-i18n@11.1.12(vue@3.5.16(typescript@5.6.3)):
|
||||
dependencies:
|
||||
'@intlify/core-base': 11.1.12
|
||||
'@intlify/shared': 11.1.12
|
||||
'@vue/devtools-api': 6.6.4
|
||||
vue: 3.5.16(typescript@5.6.3)
|
||||
|
||||
vue-markdown-render@2.2.1(vue@3.5.16(typescript@5.6.3)):
|
||||
dependencies:
|
||||
markdown-it: 13.0.2
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "bongo-cat"
|
||||
version = "0.7.0"
|
||||
version = "0.9.0"
|
||||
description = "A Tauri App"
|
||||
authors = [ "ayangweb" ]
|
||||
edition = "2024"
|
||||
@@ -37,6 +37,7 @@ tauri-plugin-fs = "2"
|
||||
fs_extra = "1"
|
||||
tauri-plugin-clipboard-manager = "2"
|
||||
tauri-plugin-global-shortcut = "2"
|
||||
tauri-plugin-locale = "2"
|
||||
rdev = { git = "https://github.com/kunkunsh/rdev" }
|
||||
gilrs = { git = "https://github.com/ayangweb/gilrs", default-features = false, features = ["xinput"] }
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
"core:window:allow-set-decorations",
|
||||
"core:window:allow-set-position",
|
||||
"core:window:allow-set-theme",
|
||||
"core:window:allow-set-title",
|
||||
"custom-window:default",
|
||||
"os:default",
|
||||
"process:default",
|
||||
@@ -46,6 +47,7 @@
|
||||
"clipboard-manager:allow-write-text",
|
||||
"global-shortcut:allow-is-registered",
|
||||
"global-shortcut:allow-register",
|
||||
"global-shortcut:allow-unregister"
|
||||
"global-shortcut:allow-unregister",
|
||||
"locale:default"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ pub fn platform(
|
||||
"window_did_resize" => {
|
||||
window_move_event();
|
||||
|
||||
if let Ok(size) = main_window.inner_size() {
|
||||
if let Ok(size) = main_window.outer_size() {
|
||||
let _ = main_window.emit_to(target, WINDOW_RESIZED_EVENT, size);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,6 +60,7 @@ pub fn run() {
|
||||
.plugin(tauri_plugin_fs::init())
|
||||
.plugin(tauri_plugin_clipboard_manager::init())
|
||||
.plugin(tauri_plugin_global_shortcut::Builder::new().build())
|
||||
.plugin(tauri_plugin_locale::init())
|
||||
.on_window_event(|window, event| match event {
|
||||
WindowEvent::CloseRequested { api, .. } => {
|
||||
let _ = window.hide();
|
||||
|
||||
@@ -21,11 +21,11 @@
|
||||
"transparent": true,
|
||||
"decorations": false,
|
||||
"acceptFirstMouse": true,
|
||||
"skipTaskbar": true
|
||||
"skipTaskbar": true,
|
||||
"maximizable": false
|
||||
},
|
||||
{
|
||||
"label": "preference",
|
||||
"title": "偏好设置",
|
||||
"url": "index.html/#/preference",
|
||||
"visible": false,
|
||||
"titleBarStyle": "Overlay",
|
||||
@@ -48,7 +48,7 @@
|
||||
},
|
||||
"bundle": {
|
||||
"active": true,
|
||||
"category": "Game",
|
||||
"category": "Entertainment",
|
||||
"createUpdaterArtifacts": true,
|
||||
"targets": ["nsis", "dmg", "app", "appimage", "deb", "rpm"],
|
||||
"shortDescription": "BongoCat",
|
||||
|
||||
@@ -4,8 +4,14 @@
|
||||
"windows": {
|
||||
"digestAlgorithm": "sha256",
|
||||
"nsis": {
|
||||
"languages": ["SimpChinese"],
|
||||
"installMode": "both"
|
||||
"languages": [
|
||||
"English",
|
||||
"Vietnamese",
|
||||
"SimpChinese",
|
||||
"PortugueseBR"
|
||||
],
|
||||
"installMode": "both",
|
||||
"displayLanguageSelector": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
20
src/App.vue
20
src/App.vue
@@ -4,16 +4,17 @@ import { error } from '@tauri-apps/plugin-log'
|
||||
import { openUrl } from '@tauri-apps/plugin-opener'
|
||||
import { useEventListener } from '@vueuse/core'
|
||||
import { ConfigProvider, theme } from 'ant-design-vue'
|
||||
import zhCN from 'ant-design-vue/es/locale/zh_CN'
|
||||
import { isString } from 'es-toolkit'
|
||||
import isURL from 'is-url'
|
||||
import { onMounted } from 'vue'
|
||||
import { onMounted, watch } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { RouterView } from 'vue-router'
|
||||
|
||||
import { useTauriListen } from './composables/useTauriListen'
|
||||
import { useThemeVars } from './composables/useThemeVars'
|
||||
import { useWindowState } from './composables/useWindowState'
|
||||
import { LISTEN_KEY } from './constants'
|
||||
import { LANGUAGE, LISTEN_KEY } from './constants'
|
||||
import { getAntdLocale } from './locales/index.ts'
|
||||
import { hideWindow, showWindow } from './plugins/window'
|
||||
import { useAppStore } from './stores/app'
|
||||
import { useCatStore } from './stores/cat'
|
||||
@@ -30,18 +31,25 @@ const shortcutStore = useShortcutStore()
|
||||
const appWindow = getCurrentWebviewWindow()
|
||||
const { isRestored, restoreState } = useWindowState()
|
||||
const { darkAlgorithm, defaultAlgorithm } = theme
|
||||
const { locale } = useI18n()
|
||||
|
||||
onMounted(async () => {
|
||||
generateColorVars()
|
||||
|
||||
await appStore.$tauri.start()
|
||||
await appStore.init()
|
||||
await modelStore.$tauri.start()
|
||||
await modelStore.init()
|
||||
await catStore.$tauri.start()
|
||||
catStore.init()
|
||||
await generalStore.$tauri.start()
|
||||
await generalStore.init()
|
||||
await shortcutStore.$tauri.start()
|
||||
await restoreState()
|
||||
catStore.init()
|
||||
})
|
||||
|
||||
watch(() => generalStore.appearance.language, (value) => {
|
||||
locale.value = value ?? LANGUAGE.EN_US
|
||||
})
|
||||
|
||||
useTauriListen(LISTEN_KEY.SHOW_WINDOW, ({ payload }) => {
|
||||
@@ -81,9 +89,9 @@ useEventListener('click', (event) => {
|
||||
|
||||
<template>
|
||||
<ConfigProvider
|
||||
:locale="zhCN"
|
||||
:locale="getAntdLocale(generalStore.appearance.language)"
|
||||
:theme="{
|
||||
algorithm: generalStore.isDark ? darkAlgorithm : defaultAlgorithm,
|
||||
algorithm: generalStore.appearance.isDark ? darkAlgorithm : defaultAlgorithm,
|
||||
}"
|
||||
>
|
||||
<RouterView v-if="isRestored" />
|
||||
|
||||
@@ -3,6 +3,10 @@ html {
|
||||
|
||||
color-scheme: light;
|
||||
|
||||
body {
|
||||
--uno: transition-opacity-300;
|
||||
}
|
||||
|
||||
&.dark {
|
||||
color-scheme: dark;
|
||||
}
|
||||
|
||||
@@ -19,11 +19,14 @@ const hasDescription = computed(() => {
|
||||
<Flex
|
||||
:align="vertical ? void 0 : 'center'"
|
||||
class="b b-color-2 rounded-lg b-solid bg-color-3 p-4"
|
||||
gap="middle"
|
||||
:gap="vertical ? 'middle' : 'large'"
|
||||
justify="space-between"
|
||||
:vertical="vertical"
|
||||
>
|
||||
<Flex align="center">
|
||||
<Flex
|
||||
align="center"
|
||||
class="flex-1"
|
||||
>
|
||||
<Flex vertical>
|
||||
<div class="text-sm font-medium">
|
||||
{{ title }}
|
||||
|
||||
@@ -110,7 +110,7 @@ function handleKeyUp(event: KeyboardEvent) {
|
||||
@mouseover="isHovering = true"
|
||||
>
|
||||
<span v-if="pressedKeys.length === 0">
|
||||
{{ isFocusing ? '按下录制快捷键' : '点击录制快捷键' }}
|
||||
{{ isFocusing ? $t('components.proShortcut.hints.pressRecordShortcut') : $t('components.proShortcut.hints.clickRecordShortcut') }}
|
||||
</span>
|
||||
|
||||
<span class="text-primary font-bold">
|
||||
|
||||
@@ -8,6 +8,7 @@ import { Flex, message, Modal } from 'ant-design-vue'
|
||||
import dayjs from 'dayjs'
|
||||
import utc from 'dayjs/plugin/utc'
|
||||
import { computed, reactive, watch } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import VueMarkdown from 'vue-markdown-render'
|
||||
|
||||
import { useTauriListen } from '@/composables/useTauriListen'
|
||||
@@ -32,10 +33,11 @@ const state = reactive<State>({
|
||||
downloadProgress: 0,
|
||||
})
|
||||
const MESSAGE_KEY = 'updatable'
|
||||
const { t } = useI18n()
|
||||
|
||||
const { pause, resume } = useIntervalFn(checkUpdate, 1000 * 60 * 60 * 24)
|
||||
|
||||
watch(() => generalStore.autoCheckUpdate, (value) => {
|
||||
watch(() => generalStore.update.autoCheck, (value) => {
|
||||
pause()
|
||||
|
||||
if (!value) return
|
||||
@@ -51,7 +53,7 @@ useTauriListen<boolean>(LISTEN_KEY.UPDATE_APP, () => {
|
||||
message.loading({
|
||||
key: MESSAGE_KEY,
|
||||
duration: 0,
|
||||
content: '正在检查更新...',
|
||||
content: t('components.updateApp.hints.checkingUpdates'),
|
||||
})
|
||||
})
|
||||
|
||||
@@ -91,7 +93,7 @@ async function checkUpdate(visibleMessage = false) {
|
||||
|
||||
message.destroy(MESSAGE_KEY)
|
||||
} else if (visibleMessage) {
|
||||
message.success({ key: MESSAGE_KEY, content: '当前已是最新版本🎉' })
|
||||
message.success({ key: MESSAGE_KEY, content: t('components.updateApp.hints.alreadyLatest') })
|
||||
}
|
||||
} catch (error) {
|
||||
if (!visibleMessage) return
|
||||
@@ -138,15 +140,15 @@ async function handleOk() {
|
||||
<template>
|
||||
<Modal
|
||||
v-model:open="state.open"
|
||||
cancel-text="稍后更新"
|
||||
:cancel-text="$t('components.updateApp.buttons.updateLater')"
|
||||
centered
|
||||
:closable="false"
|
||||
:mask-closable="false"
|
||||
title="发现新版本🥳"
|
||||
:title="$t('components.updateApp.title')"
|
||||
@ok="handleOk"
|
||||
>
|
||||
<template #okText>
|
||||
{{ state.downloading ? downloadProgress : "立即更新" }}
|
||||
{{ state.downloading ? downloadProgress : $t('components.updateApp.buttons.updateNow') }}
|
||||
</template>
|
||||
|
||||
<Flex
|
||||
@@ -155,7 +157,7 @@ async function handleOk() {
|
||||
vertical
|
||||
>
|
||||
<Flex align="center">
|
||||
<span>更新版本:</span>
|
||||
<span>{{ $t('components.updateApp.labels.updateVersion') }}</span>
|
||||
<span>
|
||||
<span>{{ state.update?.currentVersion }} 👉 </span>
|
||||
<a
|
||||
@@ -167,12 +169,12 @@ async function handleOk() {
|
||||
</Flex>
|
||||
|
||||
<Flex align="center">
|
||||
<span>更新时间:</span>
|
||||
<span>{{ $t('components.updateApp.labels.updateTime') }}</span>
|
||||
<span>{{ state.update?.date }}</span>
|
||||
</Flex>
|
||||
|
||||
<Flex vertical>
|
||||
<span>更新日志:</span>
|
||||
<span>{{ $t('components.updateApp.labels.changelog') }}</span>
|
||||
|
||||
<VueMarkdown
|
||||
class="update-note max-h-40 overflow-auto"
|
||||
|
||||
@@ -1,22 +1,27 @@
|
||||
import type { CursorPoint } from '@/utils/monitor'
|
||||
|
||||
import { invoke } from '@tauri-apps/api/core'
|
||||
import { useDebounceFn } from '@vueuse/core'
|
||||
import { isEqual, mapValues } from 'es-toolkit'
|
||||
import { ref } from 'vue'
|
||||
import { getCurrentWebviewWindow } from '@tauri-apps/api/webviewWindow'
|
||||
import { cursorPosition } from '@tauri-apps/api/window'
|
||||
|
||||
import { INVOKE_KEY, LISTEN_KEY } from '../constants'
|
||||
|
||||
import { useModel } from './useModel'
|
||||
import { useTauriListen } from './useTauriListen'
|
||||
|
||||
import { useCatStore } from '@/stores/cat'
|
||||
import { useModelStore } from '@/stores/model'
|
||||
import { inBetween } from '@/utils/is'
|
||||
import { isWindows } from '@/utils/platform'
|
||||
|
||||
interface MouseButtonEvent {
|
||||
kind: 'MousePress' | 'MouseRelease'
|
||||
value: string
|
||||
}
|
||||
|
||||
export interface CursorPoint {
|
||||
x: number
|
||||
y: number
|
||||
}
|
||||
|
||||
interface MouseMoveEvent {
|
||||
kind: 'MouseMove'
|
||||
value: CursorPoint
|
||||
@@ -31,15 +36,14 @@ type DeviceEvent = MouseButtonEvent | MouseMoveEvent | KeyboardEvent
|
||||
|
||||
export function useDevice() {
|
||||
const modelStore = useModelStore()
|
||||
const lastCursorPoint = ref<CursorPoint>({ x: 0, y: 0 })
|
||||
const releaseTimers = new Map<string, NodeJS.Timeout>()
|
||||
const catStore = useCatStore()
|
||||
const { handlePress, handleRelease, handleMouseChange, handleMouseMove } = useModel()
|
||||
|
||||
const startListening = () => {
|
||||
invoke(INVOKE_KEY.START_DEVICE_LISTENING)
|
||||
}
|
||||
|
||||
const debouncedRelease = useDebounceFn(handleRelease, 100)
|
||||
|
||||
const getSupportedKey = (key: string) => {
|
||||
let nextKey = key
|
||||
|
||||
@@ -59,14 +63,41 @@ export function useDevice() {
|
||||
return nextKey
|
||||
}
|
||||
|
||||
const processMouseMove = (point: CursorPoint) => {
|
||||
const roundedValue = mapValues(point, Math.round)
|
||||
const handleCursorMove = async () => {
|
||||
const cursorPoint = await cursorPosition()
|
||||
|
||||
if (isEqual(lastCursorPoint.value, roundedValue)) return
|
||||
handleMouseMove(cursorPoint)
|
||||
|
||||
lastCursorPoint.value = roundedValue
|
||||
if (catStore.window.hideOnHover) {
|
||||
const appWindow = getCurrentWebviewWindow()
|
||||
const position = await appWindow.outerPosition()
|
||||
const { width, height } = await appWindow.innerSize()
|
||||
|
||||
return handleMouseMove(point)
|
||||
const isInWindow = inBetween(cursorPoint.x, position.x, position.x + width)
|
||||
&& inBetween(cursorPoint.y, position.y, position.y + height)
|
||||
|
||||
document.body.style.setProperty('opacity', isInWindow ? '0' : 'unset')
|
||||
|
||||
if (!catStore.window.passThrough) {
|
||||
appWindow.setIgnoreCursorEvents(isInWindow)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const handleAutoRelease = (key: string, delay = 100) => {
|
||||
handlePress(key)
|
||||
|
||||
if (releaseTimers.has(key)) {
|
||||
clearTimeout(releaseTimers.get(key))
|
||||
}
|
||||
|
||||
const timer = setTimeout(() => {
|
||||
handleRelease(key)
|
||||
|
||||
releaseTimers.delete(key)
|
||||
}, delay)
|
||||
|
||||
releaseTimers.set(key, timer)
|
||||
}
|
||||
|
||||
useTauriListen<DeviceEvent>(LISTEN_KEY.DEVICE_CHANGED, ({ payload }) => {
|
||||
@@ -78,12 +109,16 @@ export function useDevice() {
|
||||
if (!nextValue) return
|
||||
|
||||
if (nextValue === 'CapsLock') {
|
||||
handlePress(nextValue)
|
||||
|
||||
return debouncedRelease(nextValue)
|
||||
return handleAutoRelease(nextValue)
|
||||
}
|
||||
|
||||
if (kind === 'KeyboardPress') {
|
||||
if (isWindows) {
|
||||
const delay = catStore.model.autoReleaseDelay * 1000
|
||||
|
||||
return handleAutoRelease(nextValue, delay)
|
||||
}
|
||||
|
||||
return handlePress(nextValue)
|
||||
}
|
||||
|
||||
@@ -96,7 +131,7 @@ export function useDevice() {
|
||||
case 'MouseRelease':
|
||||
return handleMouseChange(value, false)
|
||||
case 'MouseMove':
|
||||
return processMouseMove(value)
|
||||
return handleCursorMove()
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { CursorPoint } from '@/utils/monitor'
|
||||
import type { PhysicalPosition } from '@tauri-apps/api/dpi'
|
||||
|
||||
import { LogicalSize } from '@tauri-apps/api/dpi'
|
||||
import { resolveResource, sep } from '@tauri-apps/api/path'
|
||||
@@ -68,7 +68,7 @@ export function useModel() {
|
||||
|
||||
const size = await appWindow.size()
|
||||
|
||||
catStore.scale = round((size.width / width) * 100)
|
||||
catStore.window.scale = round((size.width / width) * 100)
|
||||
}
|
||||
|
||||
const handlePress = (key: string) => {
|
||||
@@ -76,7 +76,7 @@ export function useModel() {
|
||||
|
||||
if (!path) return
|
||||
|
||||
if (catStore.singleMode) {
|
||||
if (catStore.model.single) {
|
||||
const dirName = nth(path.split(sep()), -2)!
|
||||
|
||||
const filterKeys = Object.entries(modelStore.pressedKeys).filter(([, value]) => {
|
||||
@@ -107,12 +107,12 @@ export function useModel() {
|
||||
live2d.setParameterValue(id, pressed)
|
||||
}
|
||||
|
||||
async function handleMouseMove(point: CursorPoint) {
|
||||
const monitor = await getCursorMonitor(point)
|
||||
async function handleMouseMove(cursorPoint: PhysicalPosition) {
|
||||
const monitor = await getCursorMonitor(cursorPoint)
|
||||
|
||||
if (!monitor) return
|
||||
|
||||
const { size, position, cursorPoint } = monitor
|
||||
const { size, position } = monitor
|
||||
|
||||
const xRatio = (cursorPoint.x - position.x) / size.width
|
||||
const yRatio = (cursorPoint.y - position.y) / size.height
|
||||
@@ -127,7 +127,7 @@ export function useModel() {
|
||||
const ratio = isXAxis ? xRatio : yRatio
|
||||
let value = max - (ratio * (max - min))
|
||||
|
||||
if (isXAxis && catStore.mouseMirror) {
|
||||
if (isXAxis && catStore.model.mouseMirror) {
|
||||
value *= -1
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { CheckMenuItem, MenuItem, PredefinedMenuItem, Submenu } from '@tauri-apps/api/menu'
|
||||
import { range } from 'es-toolkit'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
import { showWindow } from '@/plugins/window'
|
||||
import { useCatStore } from '@/stores/cat'
|
||||
@@ -7,23 +8,24 @@ import { isMac } from '@/utils/platform'
|
||||
|
||||
export function useSharedMenu() {
|
||||
const catStore = useCatStore()
|
||||
const { t } = useI18n()
|
||||
|
||||
const getScaleMenuItems = async () => {
|
||||
const options = range(50, 151, 25)
|
||||
|
||||
const items = options.map((item) => {
|
||||
return CheckMenuItem.new({
|
||||
text: item === 100 ? '默认' : `${item}%`,
|
||||
checked: catStore.scale === item,
|
||||
text: `${item}%`,
|
||||
checked: catStore.window.scale === item,
|
||||
action: () => {
|
||||
catStore.scale = item
|
||||
catStore.window.scale = item
|
||||
},
|
||||
})
|
||||
})
|
||||
|
||||
if (!options.includes(catStore.scale)) {
|
||||
if (!options.includes(catStore.window.scale)) {
|
||||
items.unshift(CheckMenuItem.new({
|
||||
text: `${catStore.scale}%`,
|
||||
text: `${catStore.window.scale}%`,
|
||||
checked: true,
|
||||
enabled: false,
|
||||
}))
|
||||
@@ -38,16 +40,16 @@ export function useSharedMenu() {
|
||||
const items = options.map((item) => {
|
||||
return CheckMenuItem.new({
|
||||
text: `${item}%`,
|
||||
checked: catStore.opacity === item,
|
||||
checked: catStore.window.opacity === item,
|
||||
action: () => {
|
||||
catStore.opacity = item
|
||||
catStore.window.opacity = item
|
||||
},
|
||||
})
|
||||
})
|
||||
|
||||
if (!options.includes(catStore.opacity)) {
|
||||
if (!options.includes(catStore.window.opacity)) {
|
||||
items.unshift(CheckMenuItem.new({
|
||||
text: `${catStore.opacity}%`,
|
||||
text: `${catStore.window.opacity}%`,
|
||||
checked: true,
|
||||
enabled: false,
|
||||
}))
|
||||
@@ -59,30 +61,30 @@ export function useSharedMenu() {
|
||||
const getSharedMenu = async () => {
|
||||
return await Promise.all([
|
||||
MenuItem.new({
|
||||
text: '偏好设置...',
|
||||
text: t('composables.useSharedMenu.labels.preference'),
|
||||
accelerator: isMac ? 'Cmd+,' : '',
|
||||
action: () => showWindow('preference'),
|
||||
}),
|
||||
MenuItem.new({
|
||||
text: catStore.visible ? '隐藏猫咪' : '显示猫咪',
|
||||
text: catStore.window.visible ? t('composables.useSharedMenu.labels.hideCat') : t('composables.useSharedMenu.labels.showCat'),
|
||||
action: () => {
|
||||
catStore.visible = !catStore.visible
|
||||
catStore.window.visible = !catStore.window.visible
|
||||
},
|
||||
}),
|
||||
PredefinedMenuItem.new({ item: 'Separator' }),
|
||||
CheckMenuItem.new({
|
||||
text: '窗口穿透',
|
||||
checked: catStore.penetrable,
|
||||
text: t('composables.useSharedMenu.labels.passThrough'),
|
||||
checked: catStore.window.passThrough,
|
||||
action: () => {
|
||||
catStore.penetrable = !catStore.penetrable
|
||||
catStore.window.passThrough = !catStore.window.passThrough
|
||||
},
|
||||
}),
|
||||
Submenu.new({
|
||||
text: '窗口尺寸',
|
||||
text: t('composables.useSharedMenu.labels.windowSize'),
|
||||
items: await getScaleMenuItems(),
|
||||
}),
|
||||
Submenu.new({
|
||||
text: '不透明度',
|
||||
text: t('composables.useSharedMenu.labels.opacity'),
|
||||
items: await getOpacityMenuItems(),
|
||||
}),
|
||||
])
|
||||
|
||||
@@ -9,6 +9,7 @@ import { openUrl } from '@tauri-apps/plugin-opener'
|
||||
import { exit, relaunch } from '@tauri-apps/plugin-process'
|
||||
import { watchDebounced } from '@vueuse/core'
|
||||
import { watch } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
import { GITHUB_LINK, LISTEN_KEY } from '../constants'
|
||||
import { showWindow } from '../plugins/window'
|
||||
@@ -17,18 +18,21 @@ import { isMac } from '../utils/platform'
|
||||
import { useSharedMenu } from './useSharedMenu'
|
||||
|
||||
import { useCatStore } from '@/stores/cat'
|
||||
import { useGeneralStore } from '@/stores/general'
|
||||
|
||||
const TRAY_ID = 'BONGO_CAT_TRAY'
|
||||
|
||||
export function useTray() {
|
||||
const catStore = useCatStore()
|
||||
const generalStore = useGeneralStore()
|
||||
const { getSharedMenu } = useSharedMenu()
|
||||
const { t } = useI18n()
|
||||
|
||||
watch([() => catStore.visible, () => catStore.penetrable], () => {
|
||||
watch([() => catStore.window.visible, () => catStore.window.passThrough, () => generalStore.appearance.language], () => {
|
||||
updateTrayMenu()
|
||||
})
|
||||
|
||||
watchDebounced([() => catStore.scale, () => catStore.opacity], () => {
|
||||
watchDebounced([() => catStore.window.scale, () => catStore.window.opacity], () => {
|
||||
updateTrayMenu()
|
||||
}, { debounce: 200 })
|
||||
|
||||
@@ -68,7 +72,7 @@ export function useTray() {
|
||||
...await getSharedMenu(),
|
||||
PredefinedMenuItem.new({ item: 'Separator' }),
|
||||
MenuItem.new({
|
||||
text: '检查更新',
|
||||
text: t('composables.useTray.checkUpdate'),
|
||||
action: () => {
|
||||
showWindow()
|
||||
|
||||
@@ -76,20 +80,20 @@ export function useTray() {
|
||||
},
|
||||
}),
|
||||
MenuItem.new({
|
||||
text: '开源地址',
|
||||
text: t('composables.useTray.openSource'),
|
||||
action: () => openUrl(GITHUB_LINK),
|
||||
}),
|
||||
PredefinedMenuItem.new({ item: 'Separator' }),
|
||||
MenuItem.new({
|
||||
text: `版本 ${appVersion}`,
|
||||
text: `v${appVersion}`,
|
||||
enabled: false,
|
||||
}),
|
||||
MenuItem.new({
|
||||
text: '重启应用',
|
||||
text: t('composables.useTray.restartApp'),
|
||||
action: relaunch,
|
||||
}),
|
||||
MenuItem.new({
|
||||
text: '退出应用',
|
||||
text: t('composables.useTray.quitApp'),
|
||||
accelerator: isMac ? 'Cmd+Q' : '',
|
||||
action: () => exit(0),
|
||||
}),
|
||||
|
||||
47
src/composables/useWindowPosition.ts
Normal file
47
src/composables/useWindowPosition.ts
Normal file
@@ -0,0 +1,47 @@
|
||||
import { PhysicalPosition } from '@tauri-apps/api/dpi'
|
||||
import { getCurrentWebviewWindow } from '@tauri-apps/api/webviewWindow'
|
||||
import { onMounted, ref, watch } from 'vue'
|
||||
|
||||
import { useCatStore } from '@/stores/cat'
|
||||
import { getCursorMonitor } from '@/utils/monitor'
|
||||
|
||||
const appWindow = getCurrentWebviewWindow()
|
||||
|
||||
export function useWindowPosition() {
|
||||
const catStore = useCatStore()
|
||||
const isMounted = ref(false)
|
||||
|
||||
const setWindowPosition = async () => {
|
||||
const monitor = await getCursorMonitor()
|
||||
|
||||
if (!monitor) return
|
||||
|
||||
const windowSize = await appWindow.outerSize()
|
||||
|
||||
switch (catStore.window.position) {
|
||||
case 'topLeft':
|
||||
return appWindow.setPosition(new PhysicalPosition(0, 0))
|
||||
case 'topRight':
|
||||
return appWindow.setPosition(new PhysicalPosition(monitor.size.width - windowSize.width, 0))
|
||||
case 'bottomLeft':
|
||||
return appWindow.setPosition(new PhysicalPosition(0, monitor.size.height - windowSize.height))
|
||||
default:
|
||||
return appWindow.setPosition(new PhysicalPosition(monitor.size.width - windowSize.width, monitor.size.height - windowSize.height))
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await setWindowPosition()
|
||||
|
||||
isMounted.value = true
|
||||
|
||||
appWindow.onScaleChanged(setWindowPosition)
|
||||
})
|
||||
|
||||
watch(() => catStore.window.position, setWindowPosition)
|
||||
|
||||
return {
|
||||
isMounted,
|
||||
setWindowPosition,
|
||||
}
|
||||
}
|
||||
@@ -16,3 +16,10 @@ export const INVOKE_KEY = {
|
||||
START_GAMEPAD_LISTING: 'start_gamepad_listing',
|
||||
STOP_GAMEPAD_LISTING: 'stop_gamepad_listing',
|
||||
}
|
||||
|
||||
export const LANGUAGE = {
|
||||
ZH_CN: 'zh-CN',
|
||||
EN_US: 'en-US',
|
||||
VI_VN: 'vi-VN',
|
||||
PT_BR: 'pt-BR',
|
||||
} as const
|
||||
|
||||
182
src/locales/en-US.json
Normal file
182
src/locales/en-US.json
Normal file
@@ -0,0 +1,182 @@
|
||||
{
|
||||
"pages": {
|
||||
"main": {
|
||||
"hints": {
|
||||
"redrawing": "Redrawing..."
|
||||
}
|
||||
},
|
||||
"preference": {
|
||||
"title": "Preferences",
|
||||
"cat": {
|
||||
"title": "Cat",
|
||||
"labels": {
|
||||
"modelSettings": "Model Settings",
|
||||
"mirrorMode": "Mirror Mode",
|
||||
"singleMode": "Single Key Mode",
|
||||
"mouseMirror": "Mouse Mirror",
|
||||
"windowSettings": "Window Settings",
|
||||
"passThrough": "Pass Through",
|
||||
"alwaysOnTop": "Always on Top",
|
||||
"windowSize": "Window Size",
|
||||
"windowRadius": "Window Radius",
|
||||
"opacity": "Opacity",
|
||||
"autoReleaseDelay": "Auto Release Delay",
|
||||
"hideOnHover": "Hide on Hover",
|
||||
"position": "Window Position"
|
||||
},
|
||||
"hints": {
|
||||
"mirrorMode": "When enabled, the model will be mirrored horizontally.",
|
||||
"singleMode": "When enabled, only the last pressed key is displayed for each hand.",
|
||||
"mouseMirror": "When enabled, the mouse will mirror the hand movement.",
|
||||
"passThrough": "When enabled, clicks pass through the window without affecting it.",
|
||||
"alwaysOnTop": "When enabled, the window stays above all other windows.",
|
||||
"windowSize": "Move mouse to window edge, or hold Shift and right-drag to resize.",
|
||||
"autoReleaseDelay": "On Windows, some system keys cannot capture release events and will auto-release after timeout.",
|
||||
"hideOnHover": "When enabled, the window hides when mouse hovers over it.",
|
||||
"position": "Takes effect after the app starts, or when this parameter, window size, model, or screen resolution changes."
|
||||
},
|
||||
"options": {
|
||||
"topLeft": "Top Left",
|
||||
"topRight": "Top Right",
|
||||
"bottomLeft": "Bottom Left",
|
||||
"bottomRight": "Bottom Right"
|
||||
}
|
||||
},
|
||||
"general": {
|
||||
"title": "General",
|
||||
"labels": {
|
||||
"appSettings": "Application Settings",
|
||||
"launchOnStartup": "Launch on Startup",
|
||||
"showTaskbarIcon": "Show Taskbar Icon",
|
||||
"appearanceSettings": "Appearance Settings",
|
||||
"themeMode": "Theme Mode",
|
||||
"language": "Language",
|
||||
"updateSettings": "Update Settings",
|
||||
"autoCheckUpdate": "Auto Check for Updates",
|
||||
"permissionsSettings": "Permissions Settings",
|
||||
"inputMonitoringPermission": "Input Monitoring Permission"
|
||||
},
|
||||
"options": {
|
||||
"auto": "System",
|
||||
"lightMode": "Light",
|
||||
"darkMode": "Dark"
|
||||
},
|
||||
"hints": {
|
||||
"showTaskbarIcon": "When enabled, the window can be captured via OBS Studio.",
|
||||
"inputMonitoringPermission": "Enable input monitoring to receive keyboard and mouse events from the system.",
|
||||
"inputMonitoringPermissionGuide": "If the permission is already enabled, select it and click the \"-\" button to remove it, then manually add it again and restart the app."
|
||||
},
|
||||
"status": {
|
||||
"authorized": "Authorized",
|
||||
"authorize": "Go to Enable"
|
||||
},
|
||||
"buttons": {
|
||||
"openNow": "Open Now",
|
||||
"openLater": "Open Later"
|
||||
}
|
||||
},
|
||||
"model": {
|
||||
"title": "Model",
|
||||
"labels": {
|
||||
"deleteModel": "Delete Model"
|
||||
},
|
||||
"hints": {
|
||||
"deleteSuccess": "Deleted Successfully",
|
||||
"deleteModel": "Are you sure you want to delete this model?",
|
||||
"importSuccess": "Imported Successfully",
|
||||
"clickOrDragToImport": "Click or drag here to import"
|
||||
},
|
||||
"tooltips": {
|
||||
"createModel": "Create Model",
|
||||
"convertModel": "Convert Model",
|
||||
"moreModels": "More Models"
|
||||
}
|
||||
},
|
||||
"shortcut": {
|
||||
"title": "Shortcuts",
|
||||
"labels": {
|
||||
"toggleCat": "Toggle Cat",
|
||||
"togglePreferences": "Toggle Preferences",
|
||||
"mirrorMode": "Mirror Mode",
|
||||
"passThrough": "Pass Through",
|
||||
"alwaysOnTop": "Always on Top"
|
||||
},
|
||||
"hints": {
|
||||
"toggleCat": "Toggle the visibility of the cat window.",
|
||||
"togglePreferences": "Toggle the visibility of the preferences window.",
|
||||
"mirrorMode": "Toggle the cat's mirror mode.",
|
||||
"passThrough": "Toggle whether the cat window is pass-through.",
|
||||
"alwaysOnTop": "Toggle whether the cat window stays on top."
|
||||
}
|
||||
},
|
||||
"about": {
|
||||
"title": "About",
|
||||
"labels": {
|
||||
"aboutApp": "About App",
|
||||
"appLog": "App Logs",
|
||||
"appInfo": "App Info",
|
||||
"openSource": "Open Source"
|
||||
},
|
||||
"hints": {
|
||||
"appInfo": "Copy app information and provide it to bug issue.",
|
||||
"copySuccess": "Copied Successfully"
|
||||
},
|
||||
"buttons": {
|
||||
"checkUpdate": "Check for Updates",
|
||||
"copy": "Copy",
|
||||
"feedbackIssues": "Feedback Issues",
|
||||
"viewLog": "View Logs"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"components": {
|
||||
"proShortcut": {
|
||||
"hints": {
|
||||
"pressRecordShortcut": "Press to record shortcut",
|
||||
"clickRecordShortcut": "Click to record shortcut"
|
||||
}
|
||||
},
|
||||
"updateApp": {
|
||||
"title": "New Version Found 🥳",
|
||||
"labels": {
|
||||
"updateVersion": "Update Version: ",
|
||||
"updateTime": "Update Time: ",
|
||||
"changelog": "Changelog: "
|
||||
},
|
||||
"hints": {
|
||||
"checkingUpdates": "Checking for updates...",
|
||||
"alreadyLatest": "Already on the latest version 🎉"
|
||||
},
|
||||
"buttons": {
|
||||
"updateNow": "Update Now",
|
||||
"updateLater": "Update Later"
|
||||
}
|
||||
}
|
||||
},
|
||||
"composables": {
|
||||
"useSharedMenu": {
|
||||
"labels": {
|
||||
"preference": "Preferences...",
|
||||
"hideCat": "Hide Cat",
|
||||
"showCat": "Show Cat",
|
||||
"passThrough": "Pass Through",
|
||||
"windowSize": "Window Size",
|
||||
"opacity": "Opacity"
|
||||
}
|
||||
},
|
||||
"useTray": {
|
||||
"checkUpdate": "Check for Updates",
|
||||
"openSource": "Open Source",
|
||||
"restartApp": "Restart App",
|
||||
"quitApp": "Quit App"
|
||||
}
|
||||
},
|
||||
"utils": {
|
||||
"live2d": {
|
||||
"hints": {
|
||||
"notFound": "Model master configuration file not found, please ensure the model files are complete."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
38
src/locales/index.ts
Normal file
38
src/locales/index.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import type { Language } from '@/stores/general'
|
||||
import type { Locale as AntdLocale } from 'ant-design-vue/es/locale'
|
||||
|
||||
import antdEnUS from 'ant-design-vue/locale/en_US'
|
||||
import antdPtBR from 'ant-design-vue/locale/pt_BR'
|
||||
import antdViVN from 'ant-design-vue/locale/vi_VN'
|
||||
import antdZhCN from 'ant-design-vue/locale/zh_CN'
|
||||
import { createI18n } from 'vue-i18n'
|
||||
|
||||
import enUS from './en-US.json'
|
||||
import ptBR from './pt-BR.json'
|
||||
import viVN from './vi-VN.json'
|
||||
import zhCN from './zh-CN.json'
|
||||
|
||||
import { LANGUAGE } from '@/constants'
|
||||
|
||||
export const i18n = createI18n({
|
||||
legacy: false,
|
||||
locale: LANGUAGE.EN_US,
|
||||
fallbackLocale: LANGUAGE.EN_US,
|
||||
messages: {
|
||||
[LANGUAGE.ZH_CN]: zhCN,
|
||||
[LANGUAGE.EN_US]: enUS,
|
||||
[LANGUAGE.VI_VN]: viVN,
|
||||
[LANGUAGE.PT_BR]: ptBR,
|
||||
},
|
||||
})
|
||||
|
||||
export function getAntdLocale(language: Language = LANGUAGE.EN_US) {
|
||||
const antdLanguage: Record<Language, AntdLocale> = {
|
||||
[LANGUAGE.ZH_CN]: antdZhCN,
|
||||
[LANGUAGE.EN_US]: antdEnUS,
|
||||
[LANGUAGE.VI_VN]: antdViVN,
|
||||
[LANGUAGE.PT_BR]: antdPtBR,
|
||||
}
|
||||
|
||||
return antdLanguage[language]
|
||||
}
|
||||
182
src/locales/pt-BR.json
Normal file
182
src/locales/pt-BR.json
Normal file
@@ -0,0 +1,182 @@
|
||||
{
|
||||
"pages": {
|
||||
"main": {
|
||||
"hints": {
|
||||
"redrawing": "Redimensionando..."
|
||||
}
|
||||
},
|
||||
"preference": {
|
||||
"title": "Preferências",
|
||||
"cat": {
|
||||
"title": "Gato",
|
||||
"labels": {
|
||||
"modelSettings": "Configurações do Modelo",
|
||||
"mirrorMode": "Modo Espelho",
|
||||
"singleMode": "Mostrar Apenas Última Tecla",
|
||||
"mouseMirror": "Espelho do Mouse",
|
||||
"windowSettings": "Configurações da Janela",
|
||||
"passThrough": "Janela Transparente",
|
||||
"alwaysOnTop": "Sempre no Topo",
|
||||
"windowSize": "Tamanho da Janela",
|
||||
"windowRadius": "Raio da Janela",
|
||||
"opacity": "Opacidade",
|
||||
"autoReleaseDelay": "Atraso de Liberação Automática",
|
||||
"hideOnHover": "Ocultar ao Passar o Mouse",
|
||||
"position": "Posição da Janela"
|
||||
},
|
||||
"hints": {
|
||||
"mirrorMode": "Quando ativado, o modelo será invertido horizontalmente.",
|
||||
"singleMode": "Quando ativado, apenas a última tecla pressionada em cada mão é exibida (evita mostrar múltiplas mãos ao pressionar várias teclas ao mesmo tempo).",
|
||||
"mouseMirror": "Quando ativado, o mouse espelhará o movimento da mão.",
|
||||
"passThrough": "Quando ativado, a janela não afetará operações em outros aplicativos.",
|
||||
"alwaysOnTop": "Quando ativado, a janela sempre ficará acima de outros aplicativos.",
|
||||
"windowSize": "Mova o mouse para a borda da janela ou segure Shift e arraste com o botão direito para redimensionar.",
|
||||
"autoReleaseDelay": "Devido ao Windows não capturar eventos de liberação de certas teclas de nível do sistema, elas serão automaticamente tratadas como liberadas após um tempo limite.",
|
||||
"hideOnHover": "Quando ativado, a janela será ocultada quando o mouse passar sobre ela.",
|
||||
"position": "Entra em vigor após inicializar o aplicativo ou quando este parâmetro, o tamanho da janela, o modelo ou a resolução de tela é alterado."
|
||||
},
|
||||
"options": {
|
||||
"topLeft": "Canto Superior Esquerdo",
|
||||
"topRight": "Canto Superior Direito",
|
||||
"bottomLeft": "Canto Inferior Esquerdo",
|
||||
"bottomRight": "Canto Inferior Direito"
|
||||
}
|
||||
},
|
||||
"general": {
|
||||
"title": "Geral",
|
||||
"labels": {
|
||||
"appSettings": "Configurações do aplicativo",
|
||||
"launchOnStartup": "Iniciar na inicialização",
|
||||
"showTaskbarIcon": "Mostrar ícone na barra de tarefas",
|
||||
"appearanceSettings": "Configurações de aparência",
|
||||
"themeMode": "Tema",
|
||||
"language": "Idiomas",
|
||||
"updateSettings": "Configurações de atualização",
|
||||
"autoCheckUpdate": "Verificar atualizações automaticamente",
|
||||
"permissionsSettings": "Configurações de Permissões",
|
||||
"inputMonitoringPermission": "Permissão de Monitoramento de Entrada"
|
||||
},
|
||||
"options": {
|
||||
"auto": "Sistema",
|
||||
"lightMode": "Claro",
|
||||
"darkMode": "Escuro"
|
||||
},
|
||||
"hints": {
|
||||
"showTaskbarIcon": "Uma vez ativado, você pode capturar a janela via OBS Studio.",
|
||||
"inputMonitoringPermission": "Ative a permissão de monitoramento de entrada para receber eventos de teclado e mouse do sistema para responder às suas ações.",
|
||||
"inputMonitoringPermissionGuide": "Se a permissão já estiver ativada, primeiro selecione-a e clique no botão \"-\" para removê-la. Em seguida, adicione-a novamente manualmente e reinicie o aplicativo para garantir que a permissão entre em vigor."
|
||||
},
|
||||
"status": {
|
||||
"authorized": "Autorizado",
|
||||
"authorize": "Ir para Ativar"
|
||||
},
|
||||
"buttons": {
|
||||
"openNow": "Abrir Agora",
|
||||
"openLater": "Abrir Mais Tarde"
|
||||
}
|
||||
},
|
||||
"model": {
|
||||
"title": "Modelo",
|
||||
"labels": {
|
||||
"deleteModel": "Excluir modelo"
|
||||
},
|
||||
"hints": {
|
||||
"deleteSuccess": "Excluído com sucesso",
|
||||
"deleteModel": "Tem certeza de que deseja excluir este modelo?",
|
||||
"importSuccess": "Importação bem-sucedida",
|
||||
"clickOrDragToImport": "Clique ou arraste para importar"
|
||||
},
|
||||
"tooltips": {
|
||||
"createModel": "Criar modelo",
|
||||
"convertModel": "Converter modelo",
|
||||
"moreModels": "Mais modelos"
|
||||
}
|
||||
},
|
||||
"shortcut": {
|
||||
"title": "Atalhos",
|
||||
"labels": {
|
||||
"toggleCat": "Mostrar/Ocultar Gato",
|
||||
"togglePreferences": "Abrir Preferências",
|
||||
"mirrorMode": "Modo Espelho",
|
||||
"passThrough": "Janela Transparente",
|
||||
"alwaysOnTop": "Sempre no Topo"
|
||||
},
|
||||
"hints": {
|
||||
"toggleCat": "Alternar a visibilidade da janela do gato.",
|
||||
"togglePreferences": "Alternar a visibilidade da janela de preferências.",
|
||||
"mirrorMode": "Alternar o modo espelho do gato.",
|
||||
"passThrough": "Alternar se a janela do gato é clicável.",
|
||||
"alwaysOnTop": "Alternar se a janela do gato permanece no topo."
|
||||
}
|
||||
},
|
||||
"about": {
|
||||
"title": "Sobre",
|
||||
"labels": {
|
||||
"aboutApp": "Sobre o Aplicativo",
|
||||
"appLog": "Logs do Aplicativo",
|
||||
"appInfo": "Informações do Aplicativo",
|
||||
"openSource": "Código Aberto"
|
||||
},
|
||||
"hints": {
|
||||
"appInfo": "Copiar informações do aplicativo para incluir em relatórios de bugs.",
|
||||
"copySuccess": "Copiado com sucesso"
|
||||
},
|
||||
"buttons": {
|
||||
"checkUpdate": "Verificar atualizações",
|
||||
"copy": "Copiar",
|
||||
"feedbackIssues": "Reportar Problema",
|
||||
"viewLog": "Ver Logs"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"components": {
|
||||
"proShortcut": {
|
||||
"hints": {
|
||||
"pressRecordShortcut": "Pressione as teclas para gravar atalho",
|
||||
"clickRecordShortcut": "Clique para gravar atalho"
|
||||
}
|
||||
},
|
||||
"updateApp": {
|
||||
"title": "Nova versão encontrada 🥳",
|
||||
"labels": {
|
||||
"updateVersion": "Versão: ",
|
||||
"updateTime": "Hora da atualização: ",
|
||||
"changelog": "Registro de alterações: "
|
||||
},
|
||||
"hints": {
|
||||
"checkingUpdates": "Verificando atualizações...",
|
||||
"alreadyLatest": "Você já está na versão mais recente 🎉"
|
||||
},
|
||||
"buttons": {
|
||||
"updateNow": "Atualizar Agora",
|
||||
"updateLater": "Atualizar mais tarde"
|
||||
}
|
||||
}
|
||||
},
|
||||
"composables": {
|
||||
"useSharedMenu": {
|
||||
"labels": {
|
||||
"preference": "Preferências...",
|
||||
"hideCat": "Ocultar Gato",
|
||||
"showCat": "Mostrar Gato",
|
||||
"passThrough": "Janela Transparente",
|
||||
"windowSize": "Tamanho da Janela",
|
||||
"opacity": "Opacidade"
|
||||
}
|
||||
},
|
||||
"useTray": {
|
||||
"checkUpdate": "Verificar atualizações",
|
||||
"openSource": "Código Fonte",
|
||||
"restartApp": "Reiniciar",
|
||||
"quitApp": "Sair"
|
||||
}
|
||||
},
|
||||
"utils": {
|
||||
"live2d": {
|
||||
"hints": {
|
||||
"notFound": "Arquivo de configuração principal do modelo não encontrado. Verifique se os arquivos do modelo estão completos."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
182
src/locales/vi-VN.json
Normal file
182
src/locales/vi-VN.json
Normal file
@@ -0,0 +1,182 @@
|
||||
{
|
||||
"pages": {
|
||||
"main": {
|
||||
"hints": {
|
||||
"redrawing": "Đang đổi kích thước..."
|
||||
}
|
||||
},
|
||||
"preference": {
|
||||
"title": "Tùy chỉnh",
|
||||
"cat": {
|
||||
"title": "Mèo",
|
||||
"labels": {
|
||||
"modelSettings": "Cài đặt Mô hình",
|
||||
"mirrorMode": "Chế độ gương",
|
||||
"singleMode": "Chỉ hiển thị phím cuối cùng",
|
||||
"mouseMirror": "Phản chiếu chuột",
|
||||
"windowSettings": "Cài đặt Cửa sổ",
|
||||
"passThrough": "Click xuyên",
|
||||
"alwaysOnTop": "Luôn trên cùng",
|
||||
"windowSize": "Kích thước",
|
||||
"windowRadius": "Độ bo tròn cửa sổ",
|
||||
"opacity": "Độ mờ",
|
||||
"autoReleaseDelay": "Độ trễ tự động nhả phím",
|
||||
"hideOnHover": "Ẩn khi di chuột",
|
||||
"position": "Vị trí cửa sổ"
|
||||
},
|
||||
"hints": {
|
||||
"mirrorMode": "Bật để lật ngang mô hình.",
|
||||
"singleMode": "Khi bật, mỗi tay mèo chỉ hiển thị phím vừa nhấn cuối cùng (tránh hiện nhiều tay khi nhấn nhiều phím cùng lúc).",
|
||||
"mouseMirror": "Khi bật, chuột của mô hình sẽ phản chiếu theo chuyển động chuột thực tế.",
|
||||
"passThrough": "Bật để cửa sổ không ảnh hưởng đến thao tác trên ứng dụng khác.",
|
||||
"alwaysOnTop": "Bật để cửa sổ luôn nằm trên ứng dụng khác.",
|
||||
"windowSize": "Di chuyển chuột đến mép cửa sổ hoặc giữ Shift và kéo chuột phải để thay đổi kích thước.",
|
||||
"autoReleaseDelay": "Do Windows không bắt được sự kiện nhả của một số phím hệ thống, các phím đó sẽ được tự động xem như đã nhả sau khi hết thời gian chờ.",
|
||||
"hideOnHover": "Khi bật, cửa sổ sẽ ẩn khi chuột di chuyển vào.",
|
||||
"position": "Có hiệu lực sau khi khởi động ứng dụng hoặc khi tham số này, kích thước cửa sổ, mô hình hoặc độ phân giải màn hình thay đổi."
|
||||
},
|
||||
"options": {
|
||||
"topLeft": "Góc trên cùng bên trái",
|
||||
"topRight": "Góc trên cùng bên phải",
|
||||
"bottomLeft": "Góc dưới cùng bên trái",
|
||||
"bottomRight": "Góc dưới cùng bên phải"
|
||||
}
|
||||
},
|
||||
"general": {
|
||||
"title": "Chung",
|
||||
"labels": {
|
||||
"appSettings": "Cài đặt ứng dụng",
|
||||
"launchOnStartup": "Khởi động cùng hệ thống",
|
||||
"showTaskbarIcon": "Hiện biểu tượng trên thanh tác vụ (icon taskbar)",
|
||||
"appearanceSettings": "Cài đặt giao diện",
|
||||
"themeMode": "Giao diện",
|
||||
"language": "Ngôn ngữ",
|
||||
"updateSettings": "Cài đặt cập nhật",
|
||||
"autoCheckUpdate": "Tự động kiểm tra cập nhật",
|
||||
"permissionsSettings": "Cài đặt quyền",
|
||||
"inputMonitoringPermission": "Quyền giám sát đầu vào"
|
||||
},
|
||||
"options": {
|
||||
"auto": "Theo hệ thống",
|
||||
"lightMode": "Sáng",
|
||||
"darkMode": "Tối"
|
||||
},
|
||||
"hints": {
|
||||
"showTaskbarIcon": "Bật để có thể quay cửa sổ qua OBS.",
|
||||
"inputMonitoringPermission": "Bật quyền giám sát để nhận sự kiện bàn phím và chuột từ hệ thống nhằm phản hồi thao tác của bạn.",
|
||||
"inputMonitoringPermissionGuide": "Nếu quyền đã được bật, hãy chọn nó và nhấn nút \"-\" để xóa. Sau đó thêm lại thủ công và khởi động lại ứng dụng để đảm bảo quyền được áp dụng."
|
||||
},
|
||||
"status": {
|
||||
"authorized": "Đã cấp quyền",
|
||||
"authorize": "Đi đến Bật"
|
||||
},
|
||||
"buttons": {
|
||||
"openNow": "Mở ngay",
|
||||
"openLater": "Mở sau"
|
||||
}
|
||||
},
|
||||
"model": {
|
||||
"title": "Mô hình",
|
||||
"labels": {
|
||||
"deleteModel": "Xóa mô hình"
|
||||
},
|
||||
"hints": {
|
||||
"deleteSuccess": "Xóa thành công",
|
||||
"deleteModel": "Bạn chắc muốn xóa mô hình này?",
|
||||
"importSuccess": "Nhập thành công",
|
||||
"clickOrDragToImport": "Nhấp hoặc kéo tệp vào đây"
|
||||
},
|
||||
"tooltips": {
|
||||
"createModel": "Tạo mô hình",
|
||||
"convertModel": "Chuyển đổi mô hình",
|
||||
"moreModels": "Khám phá mô hình khác"
|
||||
}
|
||||
},
|
||||
"shortcut": {
|
||||
"title": "Phím tắt",
|
||||
"labels": {
|
||||
"toggleCat": "Ẩn/Hiện Mèo",
|
||||
"togglePreferences": "Mở Tùy chỉnh",
|
||||
"mirrorMode": "Chế độ gương",
|
||||
"passThrough": "Click xuyên",
|
||||
"alwaysOnTop": "Luôn trên cùng"
|
||||
},
|
||||
"hints": {
|
||||
"toggleCat": "Bật/Tắt cửa sổ mèo.",
|
||||
"togglePreferences": "Bật/Tắt cửa sổ tùy chỉnh.",
|
||||
"mirrorMode": "Bật/Tắt chế độ gương.",
|
||||
"passThrough": "Bật/Tắt cho phép click xuyên cửa sổ mèo.",
|
||||
"alwaysOnTop": "Bật/Tắt luôn giữ cửa sổ mèo trên cùng."
|
||||
}
|
||||
},
|
||||
"about": {
|
||||
"title": "Giới thiệu",
|
||||
"labels": {
|
||||
"aboutApp": "Thông tin ứng dụng",
|
||||
"appLog": "Nhật ký ứng dụng",
|
||||
"appInfo": "Thông tin ứng dụng",
|
||||
"openSource": "Mã nguồn"
|
||||
},
|
||||
"hints": {
|
||||
"appInfo": "Sao chép thông tin để gửi bug.",
|
||||
"copySuccess": "Đã sao chép"
|
||||
},
|
||||
"buttons": {
|
||||
"checkUpdate": "Kiểm tra cập nhật",
|
||||
"copy": "Sao chép",
|
||||
"feedbackIssues": "Báo lỗi",
|
||||
"viewLog": "Xem nhật ký"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"components": {
|
||||
"proShortcut": {
|
||||
"hints": {
|
||||
"pressRecordShortcut": "Nhấn phím/tổ hợp phím để ghi",
|
||||
"clickRecordShortcut": "Click để ghi phím tắt"
|
||||
}
|
||||
},
|
||||
"updateApp": {
|
||||
"title": "Đã tìm thấy phiên bản mới 🥳",
|
||||
"labels": {
|
||||
"updateVersion": "Phiên bản: ",
|
||||
"updateTime": "Thời gian cập nhật: ",
|
||||
"changelog": "Nhật ký thay đổi: "
|
||||
},
|
||||
"hints": {
|
||||
"checkingUpdates": "Đang kiểm tra cập nhật...",
|
||||
"alreadyLatest": "Bạn đang dùng phiên bản mới nhất 🎉"
|
||||
},
|
||||
"buttons": {
|
||||
"updateNow": "Cập nhật ngay",
|
||||
"updateLater": "Để sau"
|
||||
}
|
||||
}
|
||||
},
|
||||
"composables": {
|
||||
"useSharedMenu": {
|
||||
"labels": {
|
||||
"preference": "Tùy chỉnh...",
|
||||
"hideCat": "Ẩn Mèo",
|
||||
"showCat": "Hiện Mèo",
|
||||
"passThrough": "Click xuyên",
|
||||
"windowSize": "Kích thước",
|
||||
"opacity": "Độ mờ"
|
||||
}
|
||||
},
|
||||
"useTray": {
|
||||
"checkUpdate": "Kiểm tra cập nhật",
|
||||
"openSource": "Mã nguồn",
|
||||
"restartApp": "Khởi động lại",
|
||||
"quitApp": "Thoát"
|
||||
}
|
||||
},
|
||||
"utils": {
|
||||
"live2d": {
|
||||
"hints": {
|
||||
"notFound": "Không tìm thấy tệp cấu hình chính của mô hình, vui lòng xác nhận các tệp mô hình có đầy đủ không."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
182
src/locales/zh-CN.json
Normal file
182
src/locales/zh-CN.json
Normal file
@@ -0,0 +1,182 @@
|
||||
{
|
||||
"pages": {
|
||||
"main": {
|
||||
"hints": {
|
||||
"redrawing": "重绘中..."
|
||||
}
|
||||
},
|
||||
"preference": {
|
||||
"title": "偏好设置",
|
||||
"cat": {
|
||||
"title": "猫咪设置",
|
||||
"labels": {
|
||||
"modelSettings": "模型设置",
|
||||
"mirrorMode": "镜像模式",
|
||||
"singleMode": "单键模式",
|
||||
"mouseMirror": "鼠标镜像",
|
||||
"windowSettings": "窗口设置",
|
||||
"passThrough": "窗口穿透",
|
||||
"alwaysOnTop": "窗口置顶",
|
||||
"windowSize": "窗口尺寸",
|
||||
"windowRadius": "窗口圆角",
|
||||
"opacity": "不透明度",
|
||||
"autoReleaseDelay": "按键自动释放延迟",
|
||||
"hideOnHover": "鼠标移入隐藏",
|
||||
"position": "窗口位置"
|
||||
},
|
||||
"hints": {
|
||||
"mirrorMode": "启用后,模型将水平镜像翻转。",
|
||||
"singleMode": "启用后,每只手只显示最后按下的一个按键。",
|
||||
"mouseMirror": "启用后,鼠标将镜像跟随手部移动。",
|
||||
"passThrough": "启用后,窗口不影响对其他应用程序的操作。",
|
||||
"alwaysOnTop": "启用后,窗口始终显示在其他应用程序上方。",
|
||||
"windowSize": "将鼠标移至窗口边缘,或按住 Shift 并右键拖动,也可以调整窗口大小。",
|
||||
"autoReleaseDelay": "由于 Windows 下部分系统级按键无法捕获释放事件,超时后将自动视为已释放。",
|
||||
"hideOnHover": "启用后,鼠标悬停在窗口上时,窗口会隐藏。",
|
||||
"position": "应用启动后,或当此参数、窗口尺寸、模型、电脑分辨率发生变化时生效。"
|
||||
},
|
||||
"options": {
|
||||
"topLeft": "左上角",
|
||||
"topRight": "右上角",
|
||||
"bottomLeft": "左下角",
|
||||
"bottomRight": "右下角"
|
||||
}
|
||||
},
|
||||
"general": {
|
||||
"title": "通用设置",
|
||||
"labels": {
|
||||
"appSettings": "应用设置",
|
||||
"launchOnStartup": "开机自启动",
|
||||
"showTaskbarIcon": "显示任务栏图标",
|
||||
"appearanceSettings": "外观设置",
|
||||
"themeMode": "主题模式",
|
||||
"language": "语言",
|
||||
"updateSettings": "更新设置",
|
||||
"autoCheckUpdate": "自动检查更新",
|
||||
"permissionsSettings": "权限设置",
|
||||
"inputMonitoringPermission": "输入监控权限"
|
||||
},
|
||||
"options": {
|
||||
"auto": "跟随系统",
|
||||
"lightMode": "亮色模式",
|
||||
"darkMode": "暗色模式"
|
||||
},
|
||||
"hints": {
|
||||
"showTaskbarIcon": "启用后,即可通过 OBS Studio 捕获窗口。",
|
||||
"inputMonitoringPermission": "开启输入监控权限,以便接收系统的键盘和鼠标事件来响应你的操作。",
|
||||
"inputMonitoringPermissionGuide": "如果权限已开启,请先选中并点击“-”按钮将其删除,然后重新手动添加,最后重启应用以确保权限生效。"
|
||||
},
|
||||
"status": {
|
||||
"authorized": "已授权",
|
||||
"authorize": "去授权"
|
||||
},
|
||||
"buttons": {
|
||||
"openNow": "前往开启",
|
||||
"openLater": "稍后开启"
|
||||
}
|
||||
},
|
||||
"model": {
|
||||
"title": "模型管理",
|
||||
"labels": {
|
||||
"deleteModel": "删除模型"
|
||||
},
|
||||
"hints": {
|
||||
"deleteSuccess": "删除成功",
|
||||
"deleteModel": "你确定要删除此模型吗?",
|
||||
"importSuccess": "导入成功",
|
||||
"clickOrDragToImport": "点击或拖动至此区域导入"
|
||||
},
|
||||
"tooltips": {
|
||||
"createModel": "制作模型",
|
||||
"convertModel": "转换模型",
|
||||
"moreModels": "更多模型"
|
||||
}
|
||||
},
|
||||
"shortcut": {
|
||||
"title": "快捷键",
|
||||
"labels": {
|
||||
"toggleCat": "打开猫咪",
|
||||
"togglePreferences": "打开偏好设置",
|
||||
"mirrorMode": "镜像模式",
|
||||
"passThrough": "窗口穿透",
|
||||
"alwaysOnTop": "窗口置顶"
|
||||
},
|
||||
"hints": {
|
||||
"toggleCat": "切换猫咪窗口的显示与隐藏。",
|
||||
"togglePreferences": "切换偏好设置窗口的显示与隐藏。",
|
||||
"mirrorMode": "切换猫咪的镜像模式。",
|
||||
"passThrough": "切换猫咪窗口是否可穿透。",
|
||||
"alwaysOnTop": "切换猫咪窗口是否置顶。"
|
||||
}
|
||||
},
|
||||
"about": {
|
||||
"title": "关于",
|
||||
"labels": {
|
||||
"aboutApp": "关于软件",
|
||||
"appLog": "软件日志",
|
||||
"appInfo": "软件信息",
|
||||
"openSource": "开源地址"
|
||||
},
|
||||
"hints": {
|
||||
"appInfo": "复制软件信息并提供给 Bug Issue。",
|
||||
"copySuccess": "复制成功"
|
||||
},
|
||||
"buttons": {
|
||||
"checkUpdate": "检查更新",
|
||||
"copy": "复制",
|
||||
"feedbackIssues": "反馈问题",
|
||||
"viewLog": "查看日志"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"components": {
|
||||
"proShortcut": {
|
||||
"hints": {
|
||||
"pressRecordShortcut": "按下录制快捷键",
|
||||
"clickRecordShortcut": "点击录制快捷键"
|
||||
}
|
||||
},
|
||||
"updateApp": {
|
||||
"title": "发现新版本🥳",
|
||||
"labels": {
|
||||
"updateVersion": "更新版本:",
|
||||
"updateTime": "更新时间:",
|
||||
"changelog": "更新日志:"
|
||||
},
|
||||
"hints": {
|
||||
"checkingUpdates": "正在检查更新...",
|
||||
"alreadyLatest": "当前已是最新版本🎉"
|
||||
},
|
||||
"buttons": {
|
||||
"updateNow": "立即更新",
|
||||
"updateLater": "稍后更新"
|
||||
}
|
||||
}
|
||||
},
|
||||
"composables": {
|
||||
"useSharedMenu": {
|
||||
"labels": {
|
||||
"preference": "偏好设置...",
|
||||
"hideCat": "隐藏猫咪",
|
||||
"showCat": "显示猫咪",
|
||||
"passThrough": "窗口穿透",
|
||||
"windowSize": "窗口尺寸",
|
||||
"opacity": "不透明度"
|
||||
}
|
||||
},
|
||||
"useTray": {
|
||||
"checkUpdate": "检查更新",
|
||||
"openSource": "开源地址",
|
||||
"restartApp": "重启应用",
|
||||
"quitApp": "退出应用"
|
||||
}
|
||||
},
|
||||
"utils": {
|
||||
"live2d": {
|
||||
"hints": {
|
||||
"notFound": "未找到模型主配置文件,请确认模型文件是否完整。"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,9 @@ import { createPinia } from 'pinia'
|
||||
import { createApp } from 'vue'
|
||||
|
||||
import App from './App.vue'
|
||||
import { i18n } from './locales'
|
||||
import router from './router'
|
||||
|
||||
import 'virtual:uno.css'
|
||||
import 'ant-design-vue/dist/reset.css'
|
||||
import './assets/css/global.scss'
|
||||
@@ -11,4 +13,4 @@ import './assets/css/global.scss'
|
||||
const pinia = createPinia()
|
||||
pinia.use(createPlugin({ saveOnChange: true }))
|
||||
|
||||
createApp(App).use(router).use(pinia).mount('#app')
|
||||
createApp(App).use(router).use(pinia).use(i18n).mount('#app')
|
||||
|
||||
@@ -14,6 +14,7 @@ import { useDevice } from '@/composables/useDevice'
|
||||
import { useGamepad } from '@/composables/useGamepad'
|
||||
import { useModel } from '@/composables/useModel'
|
||||
import { useSharedMenu } from '@/composables/useSharedMenu'
|
||||
import { useWindowPosition } from '@/composables/useWindowPosition'
|
||||
import { hideWindow, setAlwaysOnTop, setTaskbarVisibility, showWindow } from '@/plugins/window'
|
||||
import { useCatStore } from '@/stores/cat'
|
||||
import { useGeneralStore } from '@/stores/general.ts'
|
||||
@@ -32,6 +33,7 @@ const generalStore = useGeneralStore()
|
||||
const resizing = ref(false)
|
||||
const backgroundImagePath = ref<string>()
|
||||
const { stickActive } = useGamepad()
|
||||
const { isMounted, setWindowPosition } = useWindowPosition()
|
||||
|
||||
onMounted(startListening)
|
||||
|
||||
@@ -40,6 +42,8 @@ onUnmounted(handleDestroy)
|
||||
const debouncedResize = useDebounceFn(async () => {
|
||||
await handleResize()
|
||||
|
||||
await setWindowPosition()
|
||||
|
||||
resizing.value = false
|
||||
}, 100)
|
||||
|
||||
@@ -52,7 +56,7 @@ useEventListener('resize', () => {
|
||||
watch(() => modelStore.currentModel, async (model) => {
|
||||
if (!model) return
|
||||
|
||||
handleLoad()
|
||||
await handleLoad()
|
||||
|
||||
const path = join(model.path, 'resources', 'background.png')
|
||||
|
||||
@@ -76,17 +80,19 @@ watch(() => modelStore.currentModel, async (model) => {
|
||||
modelStore.supportKeys[fileName] = join(groupDir, file.name)
|
||||
}
|
||||
}
|
||||
|
||||
setWindowPosition()
|
||||
}, { deep: true, immediate: true })
|
||||
|
||||
watch([() => catStore.scale, modelSize], async () => {
|
||||
if (!modelSize.value) return
|
||||
watch([() => catStore.window.scale, modelSize], async ([scale, modelSize]) => {
|
||||
if (!modelSize) return
|
||||
|
||||
const { width, height } = modelSize.value
|
||||
const { width, height } = modelSize
|
||||
|
||||
appWindow.setSize(
|
||||
new PhysicalSize({
|
||||
width: Math.round(width * (catStore.scale / 100)),
|
||||
height: Math.round(height * (catStore.scale / 100)),
|
||||
width: Math.round(width * (scale / 100)),
|
||||
height: Math.round(height * (scale / 100)),
|
||||
}),
|
||||
)
|
||||
}, { immediate: true })
|
||||
@@ -103,17 +109,17 @@ watch([modelStore.pressedKeys, stickActive], ([keys, stickActive]) => {
|
||||
handleKeyChange(false, stickActive.right || hasRight)
|
||||
}, { deep: true })
|
||||
|
||||
watch(() => catStore.visible, async (value) => {
|
||||
watch(() => catStore.window.visible, async (value) => {
|
||||
value ? showWindow() : hideWindow()
|
||||
})
|
||||
|
||||
watch(() => catStore.penetrable, (value) => {
|
||||
watch(() => catStore.window.passThrough, (value) => {
|
||||
appWindow.setIgnoreCursorEvents(value)
|
||||
}, { immediate: true })
|
||||
|
||||
watch(() => catStore.alwaysOnTop, setAlwaysOnTop, { immediate: true })
|
||||
watch(() => catStore.window.alwaysOnTop, setAlwaysOnTop, { immediate: true })
|
||||
|
||||
watch(() => generalStore.taskbarVisibility, setTaskbarVisibility, { immediate: true })
|
||||
watch(() => generalStore.app.taskbarVisible, setTaskbarVisibility, { immediate: true })
|
||||
|
||||
function handleMouseDown() {
|
||||
appWindow.startDragging()
|
||||
@@ -137,23 +143,28 @@ function handleMouseMove(event: MouseEvent) {
|
||||
if (buttons !== 2 || !shiftKey) return
|
||||
|
||||
const delta = (movementX + movementY) * 0.5
|
||||
const nextScale = Math.max(10, Math.min(catStore.scale + delta, 500))
|
||||
const nextScale = Math.max(10, Math.min(catStore.window.scale + delta, 500))
|
||||
|
||||
catStore.scale = round(nextScale)
|
||||
catStore.window.scale = round(nextScale)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
v-show="isMounted"
|
||||
class="relative size-screen overflow-hidden children:(absolute size-full)"
|
||||
:class="{ '-scale-x-100': catStore.mirrorMode }"
|
||||
:style="{ opacity: catStore.opacity / 100 }"
|
||||
:class="{ '-scale-x-100': catStore.model.mirror }"
|
||||
:style="{
|
||||
opacity: catStore.window.opacity / 100,
|
||||
borderRadius: `${catStore.window.radius}%`,
|
||||
}"
|
||||
@contextmenu="handleContextmenu"
|
||||
@mousedown="handleMouseDown"
|
||||
@mousemove="handleMouseMove"
|
||||
>
|
||||
<img
|
||||
v-if="backgroundImagePath"
|
||||
class="object-cover"
|
||||
:src="backgroundImagePath"
|
||||
>
|
||||
|
||||
@@ -162,6 +173,7 @@ function handleMouseMove(event: MouseEvent) {
|
||||
<img
|
||||
v-for="path in modelStore.pressedKeys"
|
||||
:key="path"
|
||||
class="object-cover"
|
||||
:src="convertFileSrc(path)"
|
||||
>
|
||||
|
||||
@@ -169,8 +181,8 @@ function handleMouseMove(event: MouseEvent) {
|
||||
v-show="resizing"
|
||||
class="flex items-center justify-center bg-black"
|
||||
>
|
||||
<span class="text-center text-5xl text-white">
|
||||
重绘中...
|
||||
<span class="text-center text-[10vw] text-white">
|
||||
{{ $t('pages.main.hints.redrawing') }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -7,6 +7,7 @@ import { openPath, openUrl } from '@tauri-apps/plugin-opener'
|
||||
import { arch, platform, version } from '@tauri-apps/plugin-os'
|
||||
import { Button, message } from 'ant-design-vue'
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
import ProList from '@/components/pro-list/index.vue'
|
||||
import ProListItem from '@/components/pro-list-item/index.vue'
|
||||
@@ -15,6 +16,7 @@ import { useAppStore } from '@/stores/app'
|
||||
|
||||
const appStore = useAppStore()
|
||||
const logDir = ref('')
|
||||
const { t } = useI18n()
|
||||
|
||||
onMounted(async () => {
|
||||
logDir.value = await appLogDir()
|
||||
@@ -36,7 +38,7 @@ async function copyInfo() {
|
||||
|
||||
await writeText(JSON.stringify(info, null, 2))
|
||||
|
||||
message.success('复制成功')
|
||||
message.success(t('pages.preference.about.hints.copySuccess'))
|
||||
}
|
||||
|
||||
function feedbackIssue() {
|
||||
@@ -45,16 +47,16 @@ function feedbackIssue() {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ProList title="关于软件">
|
||||
<ProList :title="$t('pages.preference.about.labels.aboutApp')">
|
||||
<ProListItem
|
||||
:description="`版本:v${appStore.version}`"
|
||||
:description="`v${appStore.version}`"
|
||||
:title="appStore.name"
|
||||
>
|
||||
<Button
|
||||
type="primary"
|
||||
@click="handleUpdate"
|
||||
>
|
||||
检查更新
|
||||
{{ $t('pages.preference.about.buttons.checkUpdate') }}
|
||||
</Button>
|
||||
|
||||
<template #icon>
|
||||
@@ -68,20 +70,20 @@ function feedbackIssue() {
|
||||
</ProListItem>
|
||||
|
||||
<ProListItem
|
||||
description="复制软件信息并提供给 Bug Issue。"
|
||||
title="软件信息"
|
||||
:description="$t('pages.preference.about.hints.appInfo')"
|
||||
:title="$t('pages.preference.about.labels.appInfo')"
|
||||
>
|
||||
<Button @click="copyInfo">
|
||||
复制
|
||||
{{ $t('pages.preference.about.buttons.copy') }}
|
||||
</Button>
|
||||
</ProListItem>
|
||||
|
||||
<ProListItem title="开源地址">
|
||||
<ProListItem :title="$t('pages.preference.about.labels.openSource')">
|
||||
<Button
|
||||
danger
|
||||
@click="feedbackIssue"
|
||||
>
|
||||
反馈问题
|
||||
{{ $t('pages.preference.about.buttons.feedbackIssues') }}
|
||||
</Button>
|
||||
|
||||
<template #description>
|
||||
@@ -93,10 +95,10 @@ function feedbackIssue() {
|
||||
|
||||
<ProListItem
|
||||
:description="logDir"
|
||||
title="软件日志"
|
||||
:title="$t('pages.preference.about.labels.appLog')"
|
||||
>
|
||||
<Button @click="openPath(logDir)">
|
||||
查看日志
|
||||
{{ $t('pages.preference.about.buttons.viewLog') }}
|
||||
</Button>
|
||||
</ProListItem>
|
||||
</ProList>
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
<script setup lang="ts">
|
||||
import { Select, SelectOption } from 'ant-design-vue'
|
||||
|
||||
import ProListItem from '@/components/pro-list-item/index.vue'
|
||||
import { useCatStore } from '@/stores/cat'
|
||||
|
||||
const catStore = useCatStore()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ProListItem
|
||||
:description="$t('pages.preference.cat.hints.position')"
|
||||
:title="$t('pages.preference.cat.labels.position')"
|
||||
>
|
||||
<Select v-model:value="catStore.window.position">
|
||||
<SelectOption value="bottomRight">
|
||||
{{ $t('pages.preference.cat.options.bottomRight') }}
|
||||
</SelectOption>
|
||||
<SelectOption value="bottomLeft">
|
||||
{{ $t('pages.preference.cat.options.bottomLeft') }}
|
||||
</SelectOption>
|
||||
<SelectOption value="topLeft">
|
||||
{{ $t('pages.preference.cat.options.topLeft') }}
|
||||
</SelectOption>
|
||||
<SelectOption value="topRight">
|
||||
{{ $t('pages.preference.cat.options.topRight') }}
|
||||
</SelectOption>
|
||||
</Select>
|
||||
</ProListItem>
|
||||
</template>
|
||||
@@ -1,74 +1,105 @@
|
||||
<script setup lang="ts">
|
||||
import { InputNumber, Slider, Switch } from 'ant-design-vue'
|
||||
|
||||
import Position from './components/position/index.vue'
|
||||
|
||||
import ProList from '@/components/pro-list/index.vue'
|
||||
import ProListItem from '@/components/pro-list-item/index.vue'
|
||||
import { useCatStore } from '@/stores/cat'
|
||||
import { isWindows } from '@/utils/platform'
|
||||
|
||||
const catStore = useCatStore()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ProList title="模型设置">
|
||||
<ProList :title="$t('pages.preference.cat.labels.modelSettings')">
|
||||
<ProListItem
|
||||
description="启用后,模型将水平镜像翻转。"
|
||||
title="镜像模式"
|
||||
:description="$t('pages.preference.cat.hints.mirrorMode')"
|
||||
:title="$t('pages.preference.cat.labels.mirrorMode')"
|
||||
>
|
||||
<Switch v-model:checked="catStore.mirrorMode" />
|
||||
<Switch v-model:checked="catStore.model.mirror" />
|
||||
</ProListItem>
|
||||
|
||||
<ProListItem
|
||||
description="启用后,每只手只显示最后按下的一个按键。"
|
||||
title="单键模式"
|
||||
:description="$t('pages.preference.cat.hints.singleMode')"
|
||||
:title="$t('pages.preference.cat.labels.singleMode')"
|
||||
>
|
||||
<Switch v-model:checked="catStore.singleMode" />
|
||||
<Switch v-model:checked="catStore.model.single" />
|
||||
</ProListItem>
|
||||
|
||||
<ProListItem
|
||||
description="启用后,鼠标将镜像跟随手部移动。"
|
||||
title="鼠标镜像"
|
||||
:description="$t('pages.preference.cat.hints.mouseMirror')"
|
||||
:title="$t('pages.preference.cat.labels.mouseMirror')"
|
||||
>
|
||||
<Switch v-model:checked="catStore.mouseMirror" />
|
||||
<Switch v-model:checked="catStore.model.mouseMirror" />
|
||||
</ProListItem>
|
||||
|
||||
<ProListItem
|
||||
v-if="isWindows"
|
||||
:description="$t('pages.preference.cat.hints.autoReleaseDelay')"
|
||||
:title="$t('pages.preference.cat.labels.autoReleaseDelay')"
|
||||
>
|
||||
<InputNumber
|
||||
v-model:value="catStore.model.autoReleaseDelay"
|
||||
addon-after="s"
|
||||
class="w-28"
|
||||
/>
|
||||
</ProListItem>
|
||||
</ProList>
|
||||
|
||||
<ProList title="窗口设置">
|
||||
<ProList :title="$t('pages.preference.cat.labels.windowSettings')">
|
||||
<Position />
|
||||
|
||||
<ProListItem
|
||||
description="启用后,窗口不影响对其他应用程序的操作。"
|
||||
title="窗口穿透"
|
||||
:description="$t('pages.preference.cat.hints.passThrough')"
|
||||
:title="$t('pages.preference.cat.labels.passThrough')"
|
||||
>
|
||||
<Switch v-model:checked="catStore.penetrable" />
|
||||
<Switch v-model:checked="catStore.window.passThrough" />
|
||||
</ProListItem>
|
||||
|
||||
<ProListItem
|
||||
description="启用后,窗口始终显示在其他应用程序上方。"
|
||||
title="窗口置顶"
|
||||
:description="$t('pages.preference.cat.hints.alwaysOnTop')"
|
||||
:title="$t('pages.preference.cat.labels.alwaysOnTop')"
|
||||
>
|
||||
<Switch v-model:checked="catStore.alwaysOnTop" />
|
||||
<Switch v-model:checked="catStore.window.alwaysOnTop" />
|
||||
</ProListItem>
|
||||
|
||||
<ProListItem
|
||||
description="将鼠标移至窗口边缘,或按住 Shift 并右键拖动,也可已调整窗口大小。"
|
||||
title="窗口尺寸"
|
||||
:description="$t('pages.preference.cat.hints.hideOnHover')"
|
||||
:title="$t('pages.preference.cat.labels.hideOnHover')"
|
||||
>
|
||||
<Switch v-model:checked="catStore.window.hideOnHover" />
|
||||
</ProListItem>
|
||||
|
||||
<ProListItem
|
||||
:description="$t('pages.preference.cat.hints.windowSize')"
|
||||
:title="$t('pages.preference.cat.labels.windowSize')"
|
||||
>
|
||||
<InputNumber
|
||||
v-model:value="catStore.scale"
|
||||
v-model:value="catStore.window.scale"
|
||||
addon-after="%"
|
||||
class="w-28"
|
||||
:max="500"
|
||||
:min="1"
|
||||
>
|
||||
<template #addonAfter>
|
||||
%
|
||||
</template>
|
||||
</InputNumber>
|
||||
/>
|
||||
</ProListItem>
|
||||
|
||||
<ProListItem :title="$t('pages.preference.cat.labels.windowRadius')">
|
||||
<InputNumber
|
||||
v-model:value="catStore.window.radius"
|
||||
addon-after="%"
|
||||
class="w-28"
|
||||
:min="0"
|
||||
/>
|
||||
</ProListItem>
|
||||
|
||||
<ProListItem
|
||||
title="不透明度"
|
||||
:title="$t('pages.preference.cat.labels.opacity')"
|
||||
vertical
|
||||
>
|
||||
<Slider
|
||||
v-model:value="catStore.opacity"
|
||||
class="m-0!"
|
||||
v-model:value="catStore.window.opacity"
|
||||
class="m-[0]!"
|
||||
:max="100"
|
||||
:min="10"
|
||||
:tip-formatter="(value) => `${value}%`"
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
<script setup lang="ts">
|
||||
import { getCurrentWebviewWindow } from '@tauri-apps/api/webviewWindow'
|
||||
import { message } from '@tauri-apps/plugin-dialog'
|
||||
import { confirm } from '@tauri-apps/plugin-dialog'
|
||||
import { Space } from 'ant-design-vue'
|
||||
import { checkInputMonitoringPermission, requestInputMonitoringPermission } from 'tauri-plugin-macos-permissions-api'
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
import ProList from '@/components/pro-list/index.vue'
|
||||
import ProListItem from '@/components/pro-list-item/index.vue'
|
||||
import { isMac } from '@/utils/platform'
|
||||
|
||||
const authorized = ref(false)
|
||||
const { t } = useI18n()
|
||||
|
||||
onMounted(async () => {
|
||||
authorized.value = await checkInputMonitoringPermission()
|
||||
@@ -20,12 +22,15 @@ onMounted(async () => {
|
||||
|
||||
await appWindow.setAlwaysOnTop(true)
|
||||
|
||||
await message('如果权限已开启,先选中后点击“-”按钮将其删除,再重新手动添加,并重启应用以确保权限生效。', {
|
||||
title: '输入监控权限',
|
||||
okLabel: '前往开启',
|
||||
const confirmed = await confirm(t('pages.preference.general.hints.inputMonitoringPermissionGuide'), {
|
||||
title: t('pages.preference.general.labels.inputMonitoringPermission'),
|
||||
okLabel: t('pages.preference.general.buttons.openNow'),
|
||||
cancelLabel: t('pages.preference.general.buttons.openLater'),
|
||||
kind: 'warning',
|
||||
})
|
||||
|
||||
if (!confirmed) return
|
||||
|
||||
await appWindow.setAlwaysOnTop(false)
|
||||
|
||||
requestInputMonitoringPermission()
|
||||
@@ -35,11 +40,11 @@ onMounted(async () => {
|
||||
<template>
|
||||
<ProList
|
||||
v-if="isMac"
|
||||
title="权限设置"
|
||||
:title="$t('pages.preference.general.labels.permissionsSettings')"
|
||||
>
|
||||
<ProListItem
|
||||
description="开启输入监控权限,以便接收系统的键盘和鼠标事件来响应你的操作。"
|
||||
title="输入监控权限"
|
||||
:description="$t('pages.preference.general.hints.inputMonitoringPermission')"
|
||||
:title="$t('pages.preference.general.labels.inputMonitoringPermission')"
|
||||
>
|
||||
<Space
|
||||
v-if="authorized"
|
||||
@@ -48,7 +53,7 @@ onMounted(async () => {
|
||||
>
|
||||
<div class="i-solar:verified-check-bold text-4.5" />
|
||||
|
||||
<span>已授权</span>
|
||||
<span class="whitespace-nowrap">{{ $t('pages.preference.general.status.authorized') }}</span>
|
||||
</Space>
|
||||
|
||||
<Space
|
||||
@@ -59,7 +64,7 @@ onMounted(async () => {
|
||||
>
|
||||
<div class="i-solar:round-arrow-right-bold text-4.5" />
|
||||
|
||||
<span>去授权</span>
|
||||
<span class="whitespace-nowrap">{{ $t('pages.preference.general.status.authorize') }}</span>
|
||||
</Space>
|
||||
</ProListItem>
|
||||
</ProList>
|
||||
|
||||
@@ -11,23 +11,23 @@ const appWindow = getCurrentWebviewWindow()
|
||||
|
||||
onMounted(() => {
|
||||
appWindow.onThemeChanged(async ({ payload }) => {
|
||||
if (generalStore.theme !== 'auto') return
|
||||
if (generalStore.appearance.theme !== 'auto') return
|
||||
|
||||
generalStore.isDark = payload === 'dark'
|
||||
generalStore.appearance.isDark = payload === 'dark'
|
||||
})
|
||||
})
|
||||
|
||||
watch(() => generalStore.theme, async (value) => {
|
||||
watch(() => generalStore.appearance.theme, async (value) => {
|
||||
let nextTheme = value === 'auto' ? null : value
|
||||
|
||||
await appWindow.setTheme(nextTheme)
|
||||
|
||||
nextTheme = nextTheme ?? (await appWindow.theme())
|
||||
|
||||
generalStore.isDark = nextTheme === 'dark'
|
||||
generalStore.appearance.isDark = nextTheme === 'dark'
|
||||
}, { immediate: true })
|
||||
|
||||
watch(() => generalStore.isDark, (value) => {
|
||||
watch(() => generalStore.appearance.isDark, (value) => {
|
||||
if (value) {
|
||||
document.documentElement.classList.add('dark')
|
||||
} else {
|
||||
@@ -37,16 +37,16 @@ watch(() => generalStore.isDark, (value) => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ProListItem title="主题模式">
|
||||
<Select v-model:value="generalStore.theme">
|
||||
<ProListItem :title="$t('pages.preference.general.labels.themeMode')">
|
||||
<Select v-model:value="generalStore.appearance.theme">
|
||||
<SelectOption value="auto">
|
||||
跟随系统
|
||||
{{ $t('pages.preference.general.options.auto') }}
|
||||
</SelectOption>
|
||||
<SelectOption value="light">
|
||||
亮色模式
|
||||
{{ $t('pages.preference.general.options.lightMode') }}
|
||||
</SelectOption>
|
||||
<SelectOption value="dark">
|
||||
暗色模式
|
||||
{{ $t('pages.preference.general.options.darkMode') }}
|
||||
</SelectOption>
|
||||
</Select>
|
||||
</ProListItem>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { disable, enable, isEnabled } from '@tauri-apps/plugin-autostart'
|
||||
import { Switch } from 'ant-design-vue'
|
||||
import { Select, Switch } from 'ant-design-vue'
|
||||
import { watch } from 'vue'
|
||||
|
||||
import MacosPermissions from './components/macos-permissions/index.vue'
|
||||
@@ -12,7 +12,7 @@ import { useGeneralStore } from '@/stores/general'
|
||||
|
||||
const generalStore = useGeneralStore()
|
||||
|
||||
watch(() => generalStore.autostart, async (value) => {
|
||||
watch(() => generalStore.app.autostart, async (value) => {
|
||||
const enabled = await isEnabled()
|
||||
|
||||
if (value && !enabled) {
|
||||
@@ -28,26 +28,43 @@ watch(() => generalStore.autostart, async (value) => {
|
||||
<template>
|
||||
<MacosPermissions />
|
||||
|
||||
<ProList title="应用设置">
|
||||
<ProListItem title="开机自启动">
|
||||
<Switch v-model:checked="generalStore.autostart" />
|
||||
<ProList :title="$t('pages.preference.general.labels.appSettings')">
|
||||
<ProListItem :title="$t('pages.preference.general.labels.launchOnStartup')">
|
||||
<Switch v-model:checked="generalStore.app.autostart" />
|
||||
</ProListItem>
|
||||
|
||||
<ProListItem
|
||||
description="启用后,即可通过 OBS Studio 捕获窗口。"
|
||||
title="显示任务栏图标"
|
||||
:description="$t('pages.preference.general.hints.showTaskbarIcon')"
|
||||
:title="$t('pages.preference.general.labels.showTaskbarIcon')"
|
||||
>
|
||||
<Switch v-model:checked="generalStore.taskbarVisibility" />
|
||||
<Switch v-model:checked="generalStore.app.taskbarVisible" />
|
||||
</ProListItem>
|
||||
</ProList>
|
||||
|
||||
<ProList title="外观设置">
|
||||
<ProList :title="$t('pages.preference.general.labels.appearanceSettings')">
|
||||
<ThemeMode />
|
||||
|
||||
<ProListItem :title="$t('pages.preference.general.labels.language')">
|
||||
<Select v-model:value="generalStore.appearance.language">
|
||||
<Select.Option value="zh-CN">
|
||||
简体中文
|
||||
</Select.Option>
|
||||
<Select.Option value="en-US">
|
||||
English
|
||||
</Select.Option>
|
||||
<Select.Option value="vi-VN">
|
||||
Tiếng Việt
|
||||
</Select.Option>
|
||||
<Select.Option value="pt-BR">
|
||||
Português
|
||||
</Select.Option>
|
||||
</Select>
|
||||
</ProListItem>
|
||||
</ProList>
|
||||
|
||||
<ProList title="更新设置">
|
||||
<ProListItem title="自动检查更新">
|
||||
<Switch v-model:checked="generalStore.autoCheckUpdate" />
|
||||
<ProList :title="$t('pages.preference.general.labels.updateSettings')">
|
||||
<ProListItem :title="$t('pages.preference.general.labels.autoCheckUpdate')">
|
||||
<Switch v-model:checked="generalStore.update.autoCheck" />
|
||||
</ProListItem>
|
||||
</ProList>
|
||||
</template>
|
||||
|
||||
@@ -15,7 +15,7 @@ import { FloatButton, FloatButtonGroup } from 'ant-design-vue'
|
||||
</template>
|
||||
|
||||
<FloatButton
|
||||
tooltip="制作模型"
|
||||
:tooltip="$t('pages.preference.model.tooltips.createModel')"
|
||||
@click="openUrl('https://juejin.cn/post/7509872655802269731')"
|
||||
>
|
||||
<template #icon>
|
||||
@@ -24,7 +24,7 @@ import { FloatButton, FloatButtonGroup } from 'ant-design-vue'
|
||||
</FloatButton>
|
||||
|
||||
<FloatButton
|
||||
tooltip="转换模型"
|
||||
:tooltip="$t('pages.preference.model.tooltips.convertModel')"
|
||||
@click="openUrl('https://bongocat.vteamer.cc')"
|
||||
>
|
||||
<template #icon>
|
||||
@@ -33,7 +33,7 @@ import { FloatButton, FloatButtonGroup } from 'ant-design-vue'
|
||||
</FloatButton>
|
||||
|
||||
<FloatButton
|
||||
tooltip="更多模型"
|
||||
:tooltip="$t('pages.preference.model.tooltips.moreModels')"
|
||||
@click="openUrl('https://github.com/ayangweb/Awesome-BongoCat')"
|
||||
>
|
||||
<template #icon>
|
||||
|
||||
@@ -9,6 +9,7 @@ import { readDir } from '@tauri-apps/plugin-fs'
|
||||
import { message } from 'ant-design-vue'
|
||||
import { nanoid } from 'nanoid'
|
||||
import { onMounted, ref, useTemplateRef, watch } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
import { INVOKE_KEY } from '@/constants'
|
||||
import { useModelStore } from '@/stores/model'
|
||||
@@ -18,6 +19,7 @@ const dropRef = useTemplateRef('drop')
|
||||
const dragenter = ref(false)
|
||||
const selectPaths = ref<string[]>([])
|
||||
const modelStore = useModelStore()
|
||||
const { t } = useI18n()
|
||||
|
||||
onMounted(() => {
|
||||
const appWindow = getCurrentWebviewWindow()
|
||||
@@ -87,7 +89,7 @@ watch(selectPaths, async (paths) => {
|
||||
isPreset: false,
|
||||
})
|
||||
|
||||
message.success('导入成功')
|
||||
message.success(t('pages.preference.model.hints.importSuccess'))
|
||||
} catch (error) {
|
||||
message.error(String(error))
|
||||
}
|
||||
@@ -104,6 +106,6 @@ watch(selectPaths, async (paths) => {
|
||||
>
|
||||
<div class="i-solar:upload-square-outline text-12 text-primary" />
|
||||
|
||||
<span>点击或拖动至此区域导入</span>
|
||||
<span>{{ $t('pages.preference.model.hints.clickOrDragToImport') }}</span>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -8,6 +8,7 @@ import { revealItemInDir } from '@tauri-apps/plugin-opener'
|
||||
import { useElementSize } from '@vueuse/core'
|
||||
import { Card, message, Popconfirm } from 'ant-design-vue'
|
||||
import { ref } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { MasonryGrid, MasonryGridItem } from 'vue3-masonry-css'
|
||||
|
||||
import FloatMenu from './components/float-menu/index.vue'
|
||||
@@ -18,8 +19,8 @@ import { join } from '@/utils/path'
|
||||
|
||||
const modelStore = useModelStore()
|
||||
const firstItemRef = ref<HTMLElement>()
|
||||
|
||||
const { height } = useElementSize(firstItemRef)
|
||||
const { t } = useI18n()
|
||||
|
||||
function setFirstItemRef(el: Element | ComponentPublicInstance | null, index: number) {
|
||||
if (!el || index > 0) return
|
||||
@@ -39,7 +40,7 @@ async function handleDelete(item: Model) {
|
||||
try {
|
||||
await remove(path, { recursive: true })
|
||||
|
||||
message.success('删除成功')
|
||||
message.success(t('pages.preference.model.hints.deleteSuccess'))
|
||||
} catch (error) {
|
||||
message.error(String(error))
|
||||
} finally {
|
||||
@@ -91,9 +92,9 @@ async function handleDelete(item: Model) {
|
||||
|
||||
<template v-if="!item.isPreset">
|
||||
<Popconfirm
|
||||
description="你确定要删除此模型吗?"
|
||||
:description="$t('pages.preference.model.hints.deleteModel')"
|
||||
placement="topRight"
|
||||
title="删除模型"
|
||||
:title="$t('pages.preference.model.labels.deleteModel')"
|
||||
@confirm="handleDelete(item)"
|
||||
>
|
||||
<i
|
||||
|
||||
@@ -13,7 +13,7 @@ const { visibleCat, visiblePreference, mirrorMode, penetrable, alwaysOnTop } = s
|
||||
const catStore = useCatStore()
|
||||
|
||||
useTauriShortcut(visibleCat, () => {
|
||||
catStore.visible = !catStore.visible
|
||||
catStore.window.visible = !catStore.window.visible
|
||||
})
|
||||
|
||||
useTauriShortcut(visiblePreference, () => {
|
||||
@@ -21,48 +21,48 @@ useTauriShortcut(visiblePreference, () => {
|
||||
})
|
||||
|
||||
useTauriShortcut(mirrorMode, () => {
|
||||
catStore.mirrorMode = !catStore.mirrorMode
|
||||
catStore.model.mirror = !catStore.model.mirror
|
||||
})
|
||||
|
||||
useTauriShortcut(penetrable, () => {
|
||||
catStore.penetrable = !catStore.penetrable
|
||||
catStore.window.passThrough = !catStore.window.passThrough
|
||||
})
|
||||
|
||||
useTauriShortcut(alwaysOnTop, () => {
|
||||
catStore.alwaysOnTop = !catStore.alwaysOnTop
|
||||
catStore.window.alwaysOnTop = !catStore.window.alwaysOnTop
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ProList title="快捷键">
|
||||
<ProList :title="$t('pages.preference.shortcut.title')">
|
||||
<ProShortcut
|
||||
v-model="shortcutStore.visibleCat"
|
||||
description="切换猫咪窗口的显示与隐藏。"
|
||||
title="打开猫咪"
|
||||
:description="$t('pages.preference.shortcut.hints.toggleCat')"
|
||||
:title="$t('pages.preference.shortcut.labels.toggleCat')"
|
||||
/>
|
||||
|
||||
<ProShortcut
|
||||
v-model="shortcutStore.visiblePreference"
|
||||
description="切换偏好设置窗口的显示与隐藏。"
|
||||
title="打开偏好设置"
|
||||
:description="$t('pages.preference.shortcut.hints.togglePreferences')"
|
||||
:title="$t('pages.preference.shortcut.labels.togglePreferences')"
|
||||
/>
|
||||
|
||||
<ProShortcut
|
||||
v-model="shortcutStore.mirrorMode"
|
||||
description="切换猫咪的镜像模式。"
|
||||
title="镜像模式"
|
||||
:description="$t('pages.preference.shortcut.hints.mirrorMode')"
|
||||
:title="$t('pages.preference.shortcut.labels.mirrorMode')"
|
||||
/>
|
||||
|
||||
<ProShortcut
|
||||
v-model="shortcutStore.penetrable"
|
||||
description="切换猫咪窗口是否可穿透。"
|
||||
title="窗口穿透"
|
||||
:description="$t('pages.preference.shortcut.hints.passThrough')"
|
||||
:title="$t('pages.preference.shortcut.labels.passThrough')"
|
||||
/>
|
||||
|
||||
<ProShortcut
|
||||
v-model="shortcutStore.alwaysOnTop"
|
||||
description="切换猫咪窗口是否置顶。"
|
||||
title="窗口置顶"
|
||||
:description="$t('pages.preference.shortcut.hints.alwaysOnTop')"
|
||||
:title="$t('pages.preference.shortcut.labels.alwaysOnTop')"
|
||||
/>
|
||||
</ProList>
|
||||
</template>
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
<script setup lang="ts">
|
||||
import { getCurrentWebviewWindow } from '@tauri-apps/api/webviewWindow'
|
||||
import { Flex } from 'ant-design-vue'
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { computed, onMounted, ref, watch } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
import About from './components/about/index.vue'
|
||||
import Cat from './components/cat/index.vue'
|
||||
@@ -11,43 +13,51 @@ import Shortcut from './components/shortcut/index.vue'
|
||||
import UpdateApp from '@/components/update-app/index.vue'
|
||||
import { useTray } from '@/composables/useTray'
|
||||
import { useAppStore } from '@/stores/app'
|
||||
import { useGeneralStore } from '@/stores/general'
|
||||
import { isMac } from '@/utils/platform'
|
||||
|
||||
const { createTray } = useTray()
|
||||
const appStore = useAppStore()
|
||||
const current = ref(0)
|
||||
const { t } = useI18n()
|
||||
const generalStore = useGeneralStore()
|
||||
const appWindow = getCurrentWebviewWindow()
|
||||
|
||||
onMounted(async () => {
|
||||
createTray()
|
||||
})
|
||||
|
||||
const menus = [
|
||||
watch(() => generalStore.appearance.language, () => {
|
||||
appWindow.setTitle(t('pages.preference.title'))
|
||||
}, { immediate: true })
|
||||
|
||||
const menus = computed(() => [
|
||||
{
|
||||
label: '猫咪设置',
|
||||
label: t('pages.preference.cat.title'),
|
||||
icon: 'i-solar:cat-bold',
|
||||
component: Cat,
|
||||
},
|
||||
{
|
||||
label: '通用设置',
|
||||
label: t('pages.preference.general.title'),
|
||||
icon: 'i-solar:settings-minimalistic-bold',
|
||||
component: General,
|
||||
},
|
||||
{
|
||||
label: '模型管理',
|
||||
label: t('pages.preference.model.title'),
|
||||
icon: 'i-solar:magic-stick-3-bold',
|
||||
component: Model,
|
||||
},
|
||||
{
|
||||
label: '快捷键',
|
||||
label: t('pages.preference.shortcut.title'),
|
||||
icon: 'i-solar:keyboard-bold',
|
||||
component: Shortcut,
|
||||
},
|
||||
{
|
||||
label: '关于',
|
||||
label: t('pages.preference.about.title'),
|
||||
icon: 'i-solar:info-circle-bold',
|
||||
component: About,
|
||||
},
|
||||
]
|
||||
])
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -2,21 +2,22 @@ import type { WindowState } from '@/composables/useWindowState'
|
||||
|
||||
import { getName, getVersion } from '@tauri-apps/api/app'
|
||||
import { defineStore } from 'pinia'
|
||||
import { onMounted, reactive, ref } from 'vue'
|
||||
import { reactive, ref } from 'vue'
|
||||
|
||||
export const useAppStore = defineStore('app', () => {
|
||||
const name = ref('')
|
||||
const version = ref('')
|
||||
const windowState = reactive<WindowState>({})
|
||||
|
||||
onMounted(async () => {
|
||||
const init = async () => {
|
||||
name.value = await getName()
|
||||
version.value = await getVersion()
|
||||
})
|
||||
}
|
||||
|
||||
return {
|
||||
name,
|
||||
version,
|
||||
windowState,
|
||||
init,
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,29 +1,90 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { ref } from 'vue'
|
||||
import { reactive, ref } from 'vue'
|
||||
|
||||
export interface CatStore {
|
||||
model: {
|
||||
mirror: boolean
|
||||
single: boolean
|
||||
mouseMirror: boolean
|
||||
autoReleaseDelay: number
|
||||
}
|
||||
window: {
|
||||
visible: boolean
|
||||
passThrough: boolean
|
||||
alwaysOnTop: boolean
|
||||
scale: number
|
||||
opacity: number
|
||||
radius: number
|
||||
hideOnHover: boolean
|
||||
position: 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight'
|
||||
}
|
||||
}
|
||||
|
||||
export const useCatStore = defineStore('cat', () => {
|
||||
const visible = ref(false)
|
||||
/* ------------ 废弃字段(后续删除) ------------ */
|
||||
|
||||
/** @deprecated 请使用 `model.mirror` */
|
||||
const mirrorMode = ref(false)
|
||||
|
||||
/** @deprecated 请使用 `model.single` */
|
||||
const singleMode = ref(false)
|
||||
|
||||
/** @deprecated 请使用 `model.mouseMirror` */
|
||||
const mouseMirror = ref(false)
|
||||
|
||||
/** @deprecated 请使用 `window.passThrough` */
|
||||
const penetrable = ref(false)
|
||||
|
||||
/** @deprecated 请使用 `window.alwaysOnTop` */
|
||||
const alwaysOnTop = ref(true)
|
||||
|
||||
/** @deprecated 请使用 `window.scale` */
|
||||
const scale = ref(100)
|
||||
|
||||
/** @deprecated 请使用 `window.opacity` */
|
||||
const opacity = ref(100)
|
||||
|
||||
/** @deprecated 用于标识数据是否已迁移,后续版本将删除 */
|
||||
const migrated = ref(false)
|
||||
|
||||
const model = reactive<CatStore['model']>({
|
||||
mirror: false,
|
||||
single: false,
|
||||
mouseMirror: false,
|
||||
autoReleaseDelay: 3,
|
||||
})
|
||||
|
||||
const window = reactive<CatStore['window']>({
|
||||
visible: true,
|
||||
passThrough: false,
|
||||
alwaysOnTop: false,
|
||||
scale: 100,
|
||||
opacity: 100,
|
||||
radius: 0,
|
||||
hideOnHover: false,
|
||||
position: 'bottomRight',
|
||||
})
|
||||
|
||||
const init = () => {
|
||||
visible.value = true
|
||||
if (migrated.value) return
|
||||
|
||||
model.mirror = mirrorMode.value
|
||||
model.single = singleMode.value
|
||||
model.mouseMirror = mouseMirror.value
|
||||
|
||||
window.visible = true
|
||||
window.passThrough = penetrable.value
|
||||
window.alwaysOnTop = alwaysOnTop.value
|
||||
window.scale = scale.value
|
||||
window.opacity = opacity.value
|
||||
|
||||
migrated.value = true
|
||||
}
|
||||
|
||||
return {
|
||||
visible,
|
||||
mirrorMode,
|
||||
singleMode,
|
||||
mouseMirror,
|
||||
penetrable,
|
||||
alwaysOnTop,
|
||||
scale,
|
||||
opacity,
|
||||
migrated,
|
||||
model,
|
||||
window,
|
||||
init,
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,20 +1,94 @@
|
||||
import type { Theme } from '@tauri-apps/api/window'
|
||||
|
||||
import { defineStore } from 'pinia'
|
||||
import { ref } from 'vue'
|
||||
import { getLocale } from 'tauri-plugin-locale-api'
|
||||
import { reactive, ref } from 'vue'
|
||||
|
||||
import { LANGUAGE } from '@/constants'
|
||||
|
||||
export type Language = typeof LANGUAGE[keyof typeof LANGUAGE]
|
||||
|
||||
export interface GeneralStore {
|
||||
app: {
|
||||
autostart: boolean
|
||||
taskbarVisible: boolean
|
||||
}
|
||||
appearance: {
|
||||
theme: 'auto' | Theme
|
||||
isDark: boolean
|
||||
language?: Language
|
||||
}
|
||||
update: {
|
||||
autoCheck: boolean
|
||||
}
|
||||
}
|
||||
|
||||
export const useGeneralStore = defineStore('general', () => {
|
||||
/* ------------ 废弃字段(后续删除) ------------ */
|
||||
|
||||
/** @deprecated 请使用 `update.autoCheck` */
|
||||
const autoCheckUpdate = ref(false)
|
||||
|
||||
/** @deprecated 请使用 `app.autostart` */
|
||||
const autostart = ref(false)
|
||||
|
||||
/** @deprecated 请使用 `app.taskbarVisible` */
|
||||
const taskbarVisibility = ref(false)
|
||||
|
||||
/** @deprecated 请使用 `appearance.theme` */
|
||||
const theme = ref<'auto' | Theme>('auto')
|
||||
|
||||
/** @deprecated 请使用 `appearance.isDark` */
|
||||
const isDark = ref(false)
|
||||
|
||||
/** @deprecated 用于标识数据是否已迁移,后续版本将删除 */
|
||||
const migrated = ref(false)
|
||||
|
||||
const app = reactive<GeneralStore['app']>({
|
||||
autostart: false,
|
||||
taskbarVisible: false,
|
||||
})
|
||||
|
||||
const appearance = reactive<GeneralStore['appearance']>({
|
||||
theme: 'auto',
|
||||
isDark: false,
|
||||
})
|
||||
|
||||
const update = reactive<GeneralStore['update']>({
|
||||
autoCheck: false,
|
||||
})
|
||||
|
||||
const getLanguage = async () => {
|
||||
const locale = await getLocale<Language>()
|
||||
|
||||
if (Object.values(LANGUAGE).includes(locale)) {
|
||||
return locale
|
||||
}
|
||||
|
||||
return LANGUAGE.EN_US
|
||||
}
|
||||
|
||||
const init = async () => {
|
||||
appearance.language ??= await getLanguage()
|
||||
|
||||
if (migrated.value) return
|
||||
|
||||
app.autostart = autostart.value
|
||||
app.taskbarVisible = taskbarVisibility.value
|
||||
|
||||
appearance.theme = theme.value
|
||||
appearance.isDark = isDark.value
|
||||
|
||||
update.autoCheck = autoCheckUpdate.value
|
||||
|
||||
migrated.value = true
|
||||
}
|
||||
|
||||
return {
|
||||
autoCheckUpdate,
|
||||
autostart,
|
||||
taskbarVisibility,
|
||||
theme,
|
||||
isDark,
|
||||
migrated,
|
||||
app,
|
||||
appearance,
|
||||
update,
|
||||
init,
|
||||
}
|
||||
})
|
||||
|
||||
@@ -3,3 +3,7 @@ export function isImage(value: string) {
|
||||
|
||||
return regex.test(value)
|
||||
}
|
||||
|
||||
export function inBetween(value: number, minimum: number, maximum: number) {
|
||||
return value >= minimum && value <= maximum
|
||||
}
|
||||
|
||||
@@ -3,11 +3,14 @@ import type { Cubism4InternalModel } from 'pixi-live2d-display'
|
||||
|
||||
import { convertFileSrc } from '@tauri-apps/api/core'
|
||||
import { readDir, readTextFile } from '@tauri-apps/plugin-fs'
|
||||
import JSON5 from 'json5'
|
||||
import { Cubism4ModelSettings, Live2DModel } from 'pixi-live2d-display'
|
||||
import { Application, Ticker } from 'pixi.js'
|
||||
|
||||
import { join } from './path'
|
||||
|
||||
import { i18n } from '@/locales'
|
||||
|
||||
Live2DModel.registerTicker(Ticker)
|
||||
|
||||
class Live2d {
|
||||
@@ -39,12 +42,12 @@ class Live2d {
|
||||
const modelFile = files.find(file => file.name.endsWith('.model3.json'))
|
||||
|
||||
if (!modelFile) {
|
||||
throw new Error('未找到模型主配置文件,请确认模型文件是否完整。')
|
||||
throw new Error(i18n.global.t('utils.live2d.hints.notFound'))
|
||||
}
|
||||
|
||||
const modelPath = join(path, modelFile.name)
|
||||
|
||||
const modelJSON = JSON.parse(await readTextFile(modelPath))
|
||||
const modelJSON = JSON5.parse(await readTextFile(modelPath))
|
||||
|
||||
const modelSettings = new Cubism4ModelSettings({
|
||||
...modelJSON,
|
||||
@@ -71,7 +74,11 @@ class Live2d {
|
||||
}
|
||||
|
||||
public destroy() {
|
||||
if (!this.model) return
|
||||
|
||||
this.model?.destroy()
|
||||
|
||||
this.model = null
|
||||
}
|
||||
|
||||
public resizeModel(modelSize: ModelSize) {
|
||||
|
||||
@@ -1,33 +1,20 @@
|
||||
import type { PhysicalPosition } from '@tauri-apps/api/window'
|
||||
|
||||
import { getCurrentWebviewWindow } from '@tauri-apps/api/webviewWindow'
|
||||
import { monitorFromPoint } from '@tauri-apps/api/window'
|
||||
import { mapValues } from 'es-toolkit'
|
||||
import { cursorPosition, monitorFromPoint } from '@tauri-apps/api/window'
|
||||
|
||||
import { isMac } from './platform'
|
||||
export async function getCursorMonitor(cursorPoint?: PhysicalPosition) {
|
||||
cursorPoint ??= await cursorPosition()
|
||||
|
||||
export interface CursorPoint {
|
||||
x: number
|
||||
y: number
|
||||
}
|
||||
const appWindow = getCurrentWebviewWindow()
|
||||
|
||||
export async function getCursorMonitor(point: CursorPoint) {
|
||||
let cursorPoint = point
|
||||
const scaleFactor = await appWindow.scaleFactor()
|
||||
|
||||
if (isMac) {
|
||||
const appWindow = getCurrentWebviewWindow()
|
||||
|
||||
const scaleFactor = await appWindow.scaleFactor()
|
||||
|
||||
cursorPoint = mapValues(cursorPoint, value => value * scaleFactor)
|
||||
}
|
||||
|
||||
const { x, y } = point
|
||||
const { x, y } = cursorPoint.toLogical(scaleFactor)
|
||||
|
||||
const monitor = await monitorFromPoint(x, y)
|
||||
|
||||
if (!monitor) return
|
||||
|
||||
return {
|
||||
...monitor,
|
||||
cursorPoint,
|
||||
}
|
||||
return monitor
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user