autostart & icon change & bug fixes
|
|
@ -6,12 +6,13 @@ playerInstance::playerInstance(const conFig& config) {
|
|||
this->hFfplay = NULL;
|
||||
}
|
||||
|
||||
HWND hWorkerw = NULL;
|
||||
|
||||
static BOOL CALLBACK EnumWindowsProc(_In_ HWND hwnd, _In_ LPARAM Lparam) {
|
||||
HWND hDefView = FindWindowEx(hwnd, 0, L"SHELLDLL_DefView", 0);
|
||||
if (hDefView != 0) {
|
||||
HWND hWorkerw = FindWindowEx(0, hwnd, L"WorkerW", 0);
|
||||
ShowWindow(hWorkerw, SW_HIDE);
|
||||
return FALSE;
|
||||
hWorkerw = FindWindowEx(0, hwnd, L"WorkerW", 0);
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
|
@ -77,15 +78,39 @@ void playerInstance::exit() {
|
|||
}
|
||||
}
|
||||
|
||||
BOOL try_find_worker(HWND hProgman,HWND hPlayer) {
|
||||
HWND hWorkerW = FindWindowEx(hProgman, 0, L"WorkerW", 0);
|
||||
if (hWorkerW != NULL) {
|
||||
SetParent(hPlayer, hWorkerW);
|
||||
return TRUE;
|
||||
}
|
||||
else return FALSE;
|
||||
}
|
||||
|
||||
BOOL shell_in_progman(HWND hProgman) {
|
||||
HWND hShell = FindWindowEx(hProgman, 0, L"SHELLDLL_DefView", 0);
|
||||
if (hShell) return TRUE;
|
||||
else return FALSE;
|
||||
}
|
||||
|
||||
BOOL set_as_wallpaper(const char* window_title) {
|
||||
HWND hProgman = FindWindow(L"Progman", 0);// ÕÒµ½PI´°¿Ú
|
||||
SendMessageTimeout(hProgman, 0x052c, 0, 0, 0, 100, 0);// 给它发特殊消息
|
||||
SendMessageTimeout(hProgman, 0x052c, 0, 0, SMTO_NORMAL, 0x3e8, 0);// 给它发特殊消息
|
||||
std::string tmp = window_title;
|
||||
HWND player = FindWindowW(0, std::wstring(tmp.begin(), tmp.end()).c_str());// 找到视频窗口
|
||||
if (player == NULL) return FALSE;
|
||||
SetParent(player, hProgman);// 将视频窗口设苦为PM的子窗口
|
||||
EnumWindows(EnumWindowsProc, 0);// 找到第二个workerw窗口并隐藏它
|
||||
return TRUE;
|
||||
HWND hPlayer = FindWindowW(0, std::wstring(tmp.begin(), tmp.end()).c_str());// 找到视频窗口
|
||||
if (hPlayer == NULL) return FALSE;
|
||||
if (shell_in_progman(hProgman)) {
|
||||
return try_find_worker(hProgman, hPlayer);
|
||||
}
|
||||
else {
|
||||
SetParent(hPlayer, hProgman);// 将视频窗口设苦为PM的子窗口
|
||||
EnumWindows(EnumWindowsProc, 0);// 找到第二个workerw窗口并隐藏它
|
||||
if (hWorkerw) {
|
||||
ShowWindow(hWorkerw, SW_HIDE);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static BOOL CALLBACK CheckMaximized(_In_ HWND hwnd, _In_ LPARAM Lparam) {
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@tauri-apps/api": "2.0.0-rc.0",
|
||||
"@tauri-apps/plugin-autostart": "^2.0.0",
|
||||
"@tauri-apps/plugin-dialog": "^2.0.0",
|
||||
"@tauri-apps/plugin-fs": "2.0.0-rc.2",
|
||||
"element-plus": "^2.8.5",
|
||||
|
|
|
|||
|
|
@ -11,6 +11,9 @@ importers:
|
|||
'@tauri-apps/api':
|
||||
specifier: 2.0.0-rc.0
|
||||
version: 2.0.0-rc.0
|
||||
'@tauri-apps/plugin-autostart':
|
||||
specifier: ^2.0.0
|
||||
version: 2.0.0
|
||||
'@tauri-apps/plugin-dialog':
|
||||
specifier: ^2.0.0
|
||||
version: 2.0.0
|
||||
|
|
@ -645,6 +648,9 @@ packages:
|
|||
engines: {node: '>= 10'}
|
||||
hasBin: true
|
||||
|
||||
'@tauri-apps/plugin-autostart@2.0.0':
|
||||
resolution: {integrity: sha512-NEwOQWVasZ8RczXkMLNJokRDujneuMH/UFA5t84DLkbNZUmiD3G7HZWhgSd1YQ0BFU9h9w+h2B/py3y6bzWg4Q==}
|
||||
|
||||
'@tauri-apps/plugin-dialog@2.0.0':
|
||||
resolution: {integrity: sha512-ApNkejXP2jpPBSifznPPcHTXxu9/YaRW+eJ+8+nYwqp0lLUtebFHG4QhxitM43wwReHE81WAV1DQ/b+2VBftOA==}
|
||||
|
||||
|
|
@ -3092,6 +3098,10 @@ snapshots:
|
|||
'@tauri-apps/cli-win32-ia32-msvc': 2.0.0-rc.16
|
||||
'@tauri-apps/cli-win32-x64-msvc': 2.0.0-rc.16
|
||||
|
||||
'@tauri-apps/plugin-autostart@2.0.0':
|
||||
dependencies:
|
||||
'@tauri-apps/api': 2.0.2
|
||||
|
||||
'@tauri-apps/plugin-dialog@2.0.0':
|
||||
dependencies:
|
||||
'@tauri-apps/api': 2.0.2
|
||||
|
|
|
|||
|
|
@ -6,4 +6,5 @@
|
|||
# will have schema files for capabilities auto-completion
|
||||
/gen/schemas
|
||||
resource/
|
||||
wallitor-core.dll
|
||||
wallitor-core.dll
|
||||
settings.json
|
||||
|
|
@ -227,6 +227,17 @@ version = "1.1.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
|
||||
|
||||
[[package]]
|
||||
name = "auto-launch"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1f012b8cc0c850f34117ec8252a44418f2e34a2cf501de89e29b241ae5f79471"
|
||||
dependencies = [
|
||||
"dirs 4.0.0",
|
||||
"thiserror",
|
||||
"winreg 0.10.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "1.4.0"
|
||||
|
|
@ -744,13 +755,33 @@ dependencies = [
|
|||
"crypto-common",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dirs"
|
||||
version = "4.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059"
|
||||
dependencies = [
|
||||
"dirs-sys 0.3.7",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dirs"
|
||||
version = "5.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225"
|
||||
dependencies = [
|
||||
"dirs-sys",
|
||||
"dirs-sys 0.4.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dirs-sys"
|
||||
version = "0.3.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"redox_users",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -841,7 +872,7 @@ dependencies = [
|
|||
"rustc_version",
|
||||
"toml 0.8.2",
|
||||
"vswhom",
|
||||
"winreg",
|
||||
"winreg 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -2052,7 +2083,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1"
|
||||
dependencies = [
|
||||
"malloc_buf",
|
||||
"objc_exception",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -2071,6 +2101,9 @@ name = "objc-sys"
|
|||
version = "0.3.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cdb91bdd390c7ce1a8607f35f3ca7151b65afc0ff5ff3b34fa350f7d7c7e4310"
|
||||
dependencies = [
|
||||
"cc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc2"
|
||||
|
|
@ -2098,6 +2131,30 @@ dependencies = [
|
|||
"objc2-quartz-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc2-cloud-kit"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "74dd3b56391c7a0596a295029734d3c1c5e7e510a4cb30245f8221ccea96b009"
|
||||
dependencies = [
|
||||
"bitflags 2.6.0",
|
||||
"block2",
|
||||
"objc2",
|
||||
"objc2-core-location",
|
||||
"objc2-foundation",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc2-contacts"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a5ff520e9c33812fd374d8deecef01d4a840e7b41862d849513de77e44aa4889"
|
||||
dependencies = [
|
||||
"block2",
|
||||
"objc2",
|
||||
"objc2-foundation",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc2-core-data"
|
||||
version = "0.2.2"
|
||||
|
|
@ -2122,6 +2179,18 @@ dependencies = [
|
|||
"objc2-metal",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc2-core-location"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "000cfee34e683244f284252ee206a27953279d370e309649dc3ee317b37e5781"
|
||||
dependencies = [
|
||||
"block2",
|
||||
"objc2",
|
||||
"objc2-contacts",
|
||||
"objc2-foundation",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc2-encode"
|
||||
version = "4.0.3"
|
||||
|
|
@ -2140,6 +2209,18 @@ dependencies = [
|
|||
"objc2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc2-link-presentation"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a1a1ae721c5e35be65f01a03b6d2ac13a54cb4fa70d8a5da293d7b0020261398"
|
||||
dependencies = [
|
||||
"block2",
|
||||
"objc2",
|
||||
"objc2-app-kit",
|
||||
"objc2-foundation",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc2-metal"
|
||||
version = "0.2.2"
|
||||
|
|
@ -2166,12 +2247,71 @@ dependencies = [
|
|||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc_exception"
|
||||
version = "0.1.2"
|
||||
name = "objc2-symbols"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ad970fb455818ad6cba4c122ad012fae53ae8b4795f86378bce65e4f6bab2ca4"
|
||||
checksum = "0a684efe3dec1b305badae1a28f6555f6ddd3bb2c2267896782858d5a78404dc"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"objc2",
|
||||
"objc2-foundation",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc2-ui-kit"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b8bb46798b20cd6b91cbd113524c490f1686f4c4e8f49502431415f3512e2b6f"
|
||||
dependencies = [
|
||||
"bitflags 2.6.0",
|
||||
"block2",
|
||||
"objc2",
|
||||
"objc2-cloud-kit",
|
||||
"objc2-core-data",
|
||||
"objc2-core-image",
|
||||
"objc2-core-location",
|
||||
"objc2-foundation",
|
||||
"objc2-link-presentation",
|
||||
"objc2-quartz-core",
|
||||
"objc2-symbols",
|
||||
"objc2-uniform-type-identifiers",
|
||||
"objc2-user-notifications",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc2-uniform-type-identifiers"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "44fa5f9748dbfe1ca6c0b79ad20725a11eca7c2218bceb4b005cb1be26273bfe"
|
||||
dependencies = [
|
||||
"block2",
|
||||
"objc2",
|
||||
"objc2-foundation",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc2-user-notifications"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "76cfcbf642358e8689af64cee815d139339f3ed8ad05103ed5eaf73db8d84cb3"
|
||||
dependencies = [
|
||||
"bitflags 2.6.0",
|
||||
"block2",
|
||||
"objc2",
|
||||
"objc2-core-location",
|
||||
"objc2-foundation",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc2-web-kit"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "68bc69301064cebefc6c4c90ce9cba69225239e4b8ff99d445a2b5563797da65"
|
||||
dependencies = [
|
||||
"bitflags 2.6.0",
|
||||
"block2",
|
||||
"objc2",
|
||||
"objc2-app-kit",
|
||||
"objc2-foundation",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -3342,13 +3482,13 @@ checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"
|
|||
|
||||
[[package]]
|
||||
name = "tauri"
|
||||
version = "2.0.0-rc.16"
|
||||
version = "2.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "246bd333561c5601241b7a09f19957d5f659667f3c1191c869a066fb309e1841"
|
||||
checksum = "44438500b50708bfc1e6083844e135d1b516325aae58710dcd8fb67e050ae87c"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bytes",
|
||||
"dirs",
|
||||
"dirs 5.0.1",
|
||||
"dunce",
|
||||
"embed_plist",
|
||||
"futures-util",
|
||||
|
|
@ -3392,13 +3532,13 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "tauri-build"
|
||||
version = "2.0.0-rc.13"
|
||||
version = "2.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e5bc30f14b3c1548d75dfdf3e40bffe20a53bc4e3381e9bacc21dc765d701d0a"
|
||||
checksum = "935f9b3c49b22b3e2e485a57f46d61cd1ae07b1cbb2ba87387a387caf2d8c4e7"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"cargo_toml",
|
||||
"dirs",
|
||||
"dirs 5.0.1",
|
||||
"glob",
|
||||
"heck 0.5.0",
|
||||
"json-patch",
|
||||
|
|
@ -3414,9 +3554,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "tauri-codegen"
|
||||
version = "2.0.0-rc.13"
|
||||
version = "2.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b1cfb6089cfc626b81bb8aa4692ede527732011dfd22486d8ac5bf299189841f"
|
||||
checksum = "95d7443dd4f0b597704b6a14b964ee2ed16e99928d8e6292ae9825f09fbcd30e"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"brotli",
|
||||
|
|
@ -3441,9 +3581,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "tauri-macros"
|
||||
version = "2.0.0-rc.12"
|
||||
version = "2.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1f04ed6fadd294ef8061137463fe31abccbb5fa61ff9946aab2896acd140cff1"
|
||||
checksum = "4d2c0963ccfc3f5194415f2cce7acc975942a8797fbabfb0aa1ed6f59326ae7f"
|
||||
dependencies = [
|
||||
"heck 0.5.0",
|
||||
"proc-macro2",
|
||||
|
|
@ -3455,9 +3595,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "tauri-plugin"
|
||||
version = "2.0.0-rc.13"
|
||||
version = "2.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6de7ffe64afa61c4cc13d450d64643b8db6cbb177a802beb88bf595594505ddf"
|
||||
checksum = "b2e6660a409963e4d57b9bfab4addd141eeff41bd3a7fb14e13004a832cf7ef6"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"glob",
|
||||
|
|
@ -3470,6 +3610,21 @@ dependencies = [
|
|||
"walkdir",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tauri-plugin-autostart"
|
||||
version = "2.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bba6bb936e0fd0a58ed958b49e2e423dd40949c9d9425cc991be996959e3838e"
|
||||
dependencies = [
|
||||
"auto-launch",
|
||||
"log",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tauri",
|
||||
"tauri-plugin",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tauri-plugin-dialog"
|
||||
version = "2.0.0-rc.7"
|
||||
|
|
@ -3532,9 +3687,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "tauri-runtime"
|
||||
version = "2.0.0-rc.13"
|
||||
version = "2.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8d9465366fd7f9e9c77385fa8b7cb583b060544e8800bd0309deb100008c312d"
|
||||
checksum = "c8f437293d6f5e5dce829250f4dbdce4e0b52905e297a6689cc2963eb53ac728"
|
||||
dependencies = [
|
||||
"dpi",
|
||||
"gtk",
|
||||
|
|
@ -3551,9 +3706,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "tauri-runtime-wry"
|
||||
version = "2.0.0-rc.14"
|
||||
version = "2.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a03a49d6bcc0e65d64ea4420e2097270a25a9e1ff0fb2ece75e54fbbd54e45f7"
|
||||
checksum = "1431602bcc71f2f840ad623915c9842ecc32999b867c4a787d975a17a9625cc6"
|
||||
dependencies = [
|
||||
"gtk",
|
||||
"http",
|
||||
|
|
@ -3577,9 +3732,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "tauri-utils"
|
||||
version = "2.0.0-rc.13"
|
||||
version = "2.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a271545e4c25b36b922d98cf7e0c1755f64e92355705f656893e352aef0331e3"
|
||||
checksum = "c38b0230d6880cf6dd07b6d7dd7789a0869f98ac12146e0d18d1c1049215a045"
|
||||
dependencies = [
|
||||
"brotli",
|
||||
"cargo_metadata",
|
||||
|
|
@ -3851,7 +4006,7 @@ checksum = "533fc2d4105e0e3d96ce1c71f2d308c9fbbe2ef9c587cab63dd627ab5bde218f"
|
|||
dependencies = [
|
||||
"core-graphics",
|
||||
"crossbeam-channel",
|
||||
"dirs",
|
||||
"dirs 5.0.1",
|
||||
"libappindicator",
|
||||
"muda",
|
||||
"objc2",
|
||||
|
|
@ -4054,6 +4209,7 @@ dependencies = [
|
|||
"serde_json",
|
||||
"tauri",
|
||||
"tauri-build",
|
||||
"tauri-plugin-autostart",
|
||||
"tauri-plugin-dialog",
|
||||
"tauri-plugin-fs",
|
||||
"tauri-plugin-shell",
|
||||
|
|
@ -4612,6 +4768,15 @@ dependencies = [
|
|||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winreg"
|
||||
version = "0.10.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d"
|
||||
dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winreg"
|
||||
version = "0.52.0"
|
||||
|
|
@ -4624,14 +4789,12 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wry"
|
||||
version = "0.44.1"
|
||||
version = "0.46.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "440600584cfbd8b0d28eace95c1f2c253db05dae43780b79380aa1e868f04c73"
|
||||
checksum = "6fa1c8c760041c64ce6be99f83d6cb55fe3fcd85a1ad46d32895f6e65cee87ba"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"block",
|
||||
"cocoa",
|
||||
"core-graphics",
|
||||
"block2",
|
||||
"crossbeam-channel",
|
||||
"dpi",
|
||||
"dunce",
|
||||
|
|
@ -4644,8 +4807,11 @@ dependencies = [
|
|||
"kuchikiki",
|
||||
"libc",
|
||||
"ndk",
|
||||
"objc",
|
||||
"objc_id",
|
||||
"objc2",
|
||||
"objc2-app-kit",
|
||||
"objc2-foundation",
|
||||
"objc2-ui-kit",
|
||||
"objc2-web-kit",
|
||||
"once_cell",
|
||||
"percent-encoding",
|
||||
"raw-window-handle",
|
||||
|
|
|
|||
|
|
@ -27,3 +27,6 @@ chrono = "0.4.38"
|
|||
libloading = "0.8.5"
|
||||
lazy_static = "1.5.0"
|
||||
|
||||
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
|
||||
tauri-plugin-autostart = "2.0.0-rc"
|
||||
|
||||
|
|
|
|||
|
|
@ -3,5 +3,15 @@
|
|||
"identifier": "default",
|
||||
"description": "Capability for the main window",
|
||||
"windows": ["main"],
|
||||
"permissions": ["core:default", "shell:allow-open", "dialog:allow-open", "dialog:default","core:webview:allow-create-webview-window","core:window:allow-destroy"]
|
||||
"permissions": [
|
||||
"core:default",
|
||||
"shell:allow-open",
|
||||
"dialog:allow-open",
|
||||
"dialog:default",
|
||||
"core:webview:allow-create-webview-window",
|
||||
"core:window:allow-destroy",
|
||||
"autostart:allow-enable",
|
||||
"autostart:allow-disable",
|
||||
"autostart:allow-is-enabled"
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
{"default":{"identifier":"default","description":"Capability for the main window","local":true,"windows":["main"],"permissions":["core:default","shell:allow-open","dialog:allow-open","dialog:default","core:webview:allow-create-webview-window","core:window:allow-destroy"]},"migrated":{"identifier":"migrated","description":"permissions that were migrated from v1","local":true,"windows":["main"],"permissions":["core:default","core:window:allow-maximize","core:window:allow-unmaximize","core:window:allow-toggle-maximize","core:window:allow-minimize","core:window:allow-unminimize","core:window:allow-show","core:window:allow-hide","core:window:allow-close","core:window:allow-start-dragging"]},"video":{"identifier":"video","description":"Capability for the main window","local":true,"windows":["wallitor_video_playback"],"permissions":["core:default","shell:allow-open","core:window:allow-destroy"]}}
|
||||
{"default":{"identifier":"default","description":"Capability for the main window","local":true,"windows":["main"],"permissions":["core:default","shell:allow-open","dialog:allow-open","dialog:default","core:webview:allow-create-webview-window","core:window:allow-destroy","autostart:allow-enable","autostart:allow-disable","autostart:allow-is-enabled"]},"migrated":{"identifier":"migrated","description":"permissions that were migrated from v1","local":true,"windows":["main"],"permissions":["core:default","core:window:allow-maximize","core:window:allow-unmaximize","core:window:allow-toggle-maximize","core:window:allow-minimize","core:window:allow-unminimize","core:window:allow-show","core:window:allow-hide","core:window:allow-close","core:window:allow-start-dragging"]},"video":{"identifier":"video","description":"Capability for the main window","local":true,"windows":["wallitor_video_playback"],"permissions":["core:default","shell:allow-open","core:window:allow-destroy"]}}
|
||||
|
|
@ -1827,6 +1827,41 @@
|
|||
"Identifier": {
|
||||
"description": "Permission identifier",
|
||||
"oneOf": [
|
||||
{
|
||||
"description": "This permission set configures if your\napplication can enable or disable auto\nstarting the application on boot.\n\n#### Granted Permissions\n\nIt allows all to check, enable and\ndisable the automatic start on boot.\n\n",
|
||||
"type": "string",
|
||||
"const": "autostart:default"
|
||||
},
|
||||
{
|
||||
"description": "Enables the disable command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "autostart:allow-disable"
|
||||
},
|
||||
{
|
||||
"description": "Enables the enable command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "autostart:allow-enable"
|
||||
},
|
||||
{
|
||||
"description": "Enables the is_enabled command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "autostart:allow-is-enabled"
|
||||
},
|
||||
{
|
||||
"description": "Denies the disable command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "autostart:deny-disable"
|
||||
},
|
||||
{
|
||||
"description": "Denies the enable command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "autostart:deny-enable"
|
||||
},
|
||||
{
|
||||
"description": "Denies the is_enabled command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "autostart:deny-is-enabled"
|
||||
},
|
||||
{
|
||||
"description": "Default core plugins set which includes:\n- 'core:path:default'\n- 'core:event:default'\n- 'core:window:default'\n- 'core:webview:default'\n- 'core:app:default'\n- 'core:image:default'\n- 'core:resources:default'\n- 'core:menu:default'\n- 'core:tray:default'\n",
|
||||
"type": "string",
|
||||
|
|
|
|||
|
|
@ -1827,6 +1827,41 @@
|
|||
"Identifier": {
|
||||
"description": "Permission identifier",
|
||||
"oneOf": [
|
||||
{
|
||||
"description": "This permission set configures if your\napplication can enable or disable auto\nstarting the application on boot.\n\n#### Granted Permissions\n\nIt allows all to check, enable and\ndisable the automatic start on boot.\n\n",
|
||||
"type": "string",
|
||||
"const": "autostart:default"
|
||||
},
|
||||
{
|
||||
"description": "Enables the disable command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "autostart:allow-disable"
|
||||
},
|
||||
{
|
||||
"description": "Enables the enable command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "autostart:allow-enable"
|
||||
},
|
||||
{
|
||||
"description": "Enables the is_enabled command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "autostart:allow-is-enabled"
|
||||
},
|
||||
{
|
||||
"description": "Denies the disable command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "autostart:deny-disable"
|
||||
},
|
||||
{
|
||||
"description": "Denies the enable command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "autostart:deny-enable"
|
||||
},
|
||||
{
|
||||
"description": "Denies the is_enabled command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "autostart:deny-is-enabled"
|
||||
},
|
||||
{
|
||||
"description": "Default core plugins set which includes:\n- 'core:path:default'\n- 'core:event:default'\n- 'core:window:default'\n- 'core:webview:default'\n- 'core:app:default'\n- 'core:image:default'\n- 'core:resources:default'\n- 'core:menu:default'\n- 'core:tray:default'\n",
|
||||
"type": "string",
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 5.8 KiB |
|
Before Width: | Height: | Size: 6.8 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 974 B After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 4.7 KiB |
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 6.6 KiB |
|
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 7.0 KiB |
|
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 903 B After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 85 KiB After Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 36 KiB |
|
|
@ -1,7 +1,8 @@
|
|||
use crate::reader;
|
||||
use std::path::Path;
|
||||
use std::fs;
|
||||
use crate::{reader, VERSION};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::json;
|
||||
use std::fs;
|
||||
use std::path::Path;
|
||||
use tauri::ipc::Response;
|
||||
|
||||
#[tauri::command]
|
||||
|
|
@ -42,15 +43,45 @@ pub async fn del_folder(path: String) -> bool {
|
|||
false
|
||||
}
|
||||
|
||||
#[derive(Serialize,Deserialize)]
|
||||
struct settings{
|
||||
title_bar:String,
|
||||
auto_start:bool,
|
||||
auto_pause:bool
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct Settings {
|
||||
title_bar: String,
|
||||
auto_start: bool,
|
||||
auto_pause: bool,
|
||||
version: String,
|
||||
}
|
||||
|
||||
impl Settings {
|
||||
fn new() -> Settings {
|
||||
Settings {
|
||||
title_bar: String::from("win"),
|
||||
auto_start: false,
|
||||
auto_pause: true,
|
||||
version: String::from(VERSION),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static SETTING_PATH: &str = "./settings.json";
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn get_config() -> String{
|
||||
if let Ok()
|
||||
}
|
||||
pub async fn get_settings() -> String {
|
||||
let setting_path = Path::new(SETTING_PATH);
|
||||
if let Ok(file) = fs::read(setting_path) {
|
||||
let mut settings: Settings = serde_json::from_slice(&file).unwrap();
|
||||
settings.version = String::from(VERSION);
|
||||
return json!(settings).to_string();
|
||||
} else {
|
||||
set_settings(Settings::new()).await;
|
||||
return json!(Settings::new()).to_string();
|
||||
}
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn set_settings(settings: Settings) -> bool {
|
||||
let setting_path = Path::new(SETTING_PATH);
|
||||
if fs::write(setting_path, json!(settings).to_string()).is_ok() {
|
||||
return true;
|
||||
}
|
||||
false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,10 @@
|
|||
mod setup;
|
||||
mod handler;
|
||||
mod reader;
|
||||
extern crate lazy_static;
|
||||
mod setup;
|
||||
extern crate lazy_static;
|
||||
use tauri_plugin_autostart::MacosLauncher;
|
||||
|
||||
static VERSION: &str = "1.0.0";
|
||||
|
||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||
pub fn run() {
|
||||
|
|
@ -9,6 +12,10 @@ pub fn run() {
|
|||
.setup(setup::init)
|
||||
.plugin(tauri_plugin_fs::init())
|
||||
.plugin(tauri_plugin_dialog::init())
|
||||
.plugin(tauri_plugin_autostart::init(
|
||||
MacosLauncher::LaunchAgent,
|
||||
Some(vec!["--flag1", "--flag2"]),
|
||||
))
|
||||
.invoke_handler(tauri::generate_handler![
|
||||
handler::file::get_file,
|
||||
handler::file::read_resource_dir,
|
||||
|
|
@ -16,7 +23,9 @@ pub fn run() {
|
|||
handler::wallpaper::new_wallpaper,
|
||||
handler::apply::set_wallpaper,
|
||||
handler::wallpaper::edit_wallpaper,
|
||||
handler::apply::any_zoomed
|
||||
handler::apply::any_zoomed,
|
||||
handler::file::get_settings,
|
||||
handler::file::set_settings,
|
||||
])
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
<script setup lang="ts">
|
||||
import { onBeforeMount } from 'vue';
|
||||
import TitleBar from './components/TitleBar.vue';
|
||||
import { RouterView } from 'vue-router'
|
||||
import { useStore } from 'vuex';
|
||||
|
||||
const isDarkTheme = window.matchMedia("(prefers-color-scheme: dark)");
|
||||
const html_node = document.getElementsByTagName("html")[0]
|
||||
|
|
@ -13,9 +15,13 @@ isDarkTheme.addEventListener('change', (event) => {
|
|||
}
|
||||
});
|
||||
|
||||
onBeforeMount(() => {
|
||||
useStore().dispatch("get_settings");
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<title-bar mode="mac"></title-bar>
|
||||
<title-bar></title-bar>
|
||||
<router-view></router-view>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -52,9 +52,9 @@
|
|||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { defineProps, defineExpose, defineEmits, defineModel, watch, ref, type PropType } from 'vue';
|
||||
import { defineProps, defineExpose, defineEmits, defineModel, watch, ref, type PropType, computed } from 'vue';
|
||||
type Position = "left" | "right";
|
||||
import type { Cell } from '@/ts/types'
|
||||
import type { Cell, Settings } from '@/ts/types'
|
||||
import { useStore } from 'vuex';
|
||||
import { getCurrentWebviewWindow } from '@tauri-apps/api/webviewWindow';
|
||||
const appWindow = getCurrentWebviewWindow();
|
||||
|
|
@ -66,6 +66,7 @@ const props = defineProps({
|
|||
|
||||
})
|
||||
const store = useStore();
|
||||
const settings = computed<Settings>(() => store.state.settings)
|
||||
const visible = defineModel<boolean>();
|
||||
defineEmits(["submit"]);
|
||||
const visible_ = ref(false);
|
||||
|
|
@ -87,7 +88,7 @@ const cell = ref<Cell>({
|
|||
})
|
||||
const bg = ref<HTMLDivElement | null>(null);
|
||||
defineExpose({ open })
|
||||
watch(() => visible.value, (val, _) => {
|
||||
watch(() => visible.value, (val) => {
|
||||
if (val) {
|
||||
visible_.value = true;
|
||||
}
|
||||
|
|
@ -107,10 +108,15 @@ function open(conFig: Cell) {
|
|||
}
|
||||
|
||||
function apply() {
|
||||
let params: { [key: string]: string } = {
|
||||
url: `${cell.value.path}\\res\\${cell.value.config.info.entry_point}`,
|
||||
mute: `${cell.value.config.option.mute}`,
|
||||
auto_pause: `${settings.value.auto_pause}`
|
||||
}
|
||||
store.dispatch("apply_wallpaper", {
|
||||
url: `/video/?url=${cell.value.path}\\res\\${cell.value.config.info.entry_point}&mute=${cell.value.config.option.mute}`,
|
||||
url: `/video/?${(new URLSearchParams(params)).toString()}`,
|
||||
title: "wallitor_video_playback"
|
||||
}).then(()=>appWindow.minimize())
|
||||
}).then(() => appWindow.minimize())
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,9 @@
|
|||
</div>
|
||||
|
||||
<div class="titlebar-button-wrapper colbox">
|
||||
<div class="titlebar-button" id="titlebar-settings" @click="openSettings">
|
||||
<div class="titlebar-button" id="titlebar-settings" :class="{
|
||||
'button-style-win': mode == 'win'
|
||||
}" @click="openSettings">
|
||||
<div class="titlebar-button-rect">
|
||||
<svg-icon name="setting" :size="button_size_default"></svg-icon>
|
||||
</div>
|
||||
|
|
@ -54,10 +56,11 @@
|
|||
|
||||
<script setup lang="ts">
|
||||
import SvgIcon from '@/components/SvgIcon.vue';
|
||||
import { ref, defineProps } from 'vue'
|
||||
import type { PropType } from 'vue'
|
||||
import { onMounted, ref, computed } from 'vue'
|
||||
import { getCurrentWebviewWindow } from '@tauri-apps/api/webviewWindow';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { useStore } from 'vuex';
|
||||
import type { Settings } from '@/ts/types';
|
||||
const appWindow = getCurrentWebviewWindow();
|
||||
const router = useRouter();
|
||||
|
||||
|
|
@ -67,12 +70,12 @@ const maximized = ref(false);
|
|||
const button_size_default = ref("18px");
|
||||
const button_size_alter = ref("15px")
|
||||
const button_size_mac = ref("11px")
|
||||
const store = useStore();
|
||||
const settings = computed<Settings>(() => store.state.settings);
|
||||
const mode = computed<Mode>(() => settings.value.title_bar);
|
||||
|
||||
const props = defineProps({
|
||||
mode: {
|
||||
type: String as PropType<Mode>,
|
||||
default: "win"
|
||||
}
|
||||
onMounted(() => {
|
||||
console.log(mode);
|
||||
})
|
||||
|
||||
function minimize() {
|
||||
|
|
|
|||
|
|
@ -1,14 +1,37 @@
|
|||
import { createStore } from 'vuex'
|
||||
import { invoke } from '@tauri-apps/api/core'
|
||||
import type { ResourceDir, wpConfig, Cell } from '@/ts/types'
|
||||
import type { ResourceDir, wpConfig, Cell, Settings } from '@/ts/types'
|
||||
import { WebviewWindow } from '@tauri-apps/api/webviewWindow'
|
||||
import { emit } from '@tauri-apps/api/event'
|
||||
import { enable, isEnabled, disable } from '@tauri-apps/plugin-autostart'
|
||||
import { ElMessage } from 'element-plus'
|
||||
|
||||
function arrayBufferToString(buffer: ArrayBuffer): string {
|
||||
const decoder = new TextDecoder('utf-8')
|
||||
return decoder.decode(buffer)
|
||||
}
|
||||
|
||||
function check_auto_start(settings: Settings) {
|
||||
const status = settings.auto_start
|
||||
isEnabled().then((current) => {
|
||||
if (current == true && status == false) {
|
||||
disable().then(() =>
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: '已经禁用开机自启'
|
||||
})
|
||||
)
|
||||
} else if (current == false && status == true) {
|
||||
enable().then(() =>
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: '已经启用开机自启'
|
||||
})
|
||||
)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const support_ext = ['.jpg', '.png', '.gif', '.webp']
|
||||
const support_ext_map: { [key in (typeof support_ext)[number]]: string } = {
|
||||
'.jpg': 'image/jpeg',
|
||||
|
|
@ -23,9 +46,12 @@ export const store = createStore({
|
|||
return {
|
||||
wpList: [] as Cell[],
|
||||
videoWindow: null as VideoWindow,
|
||||
settings:{
|
||||
|
||||
}
|
||||
settings: {
|
||||
title_bar: 'win',
|
||||
auto_pause: true,
|
||||
auto_start: false,
|
||||
version: '1.0.0'
|
||||
} as Settings
|
||||
}
|
||||
},
|
||||
mutations: {
|
||||
|
|
@ -92,29 +118,45 @@ export const store = createStore({
|
|||
decorations: false,
|
||||
transparent: true
|
||||
}
|
||||
state.videoWindow = new WebviewWindow(payload.title, window_options);
|
||||
state.videoWindow = new WebviewWindow(payload.title, window_options)
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async apply_wallpaper(
|
||||
{ state,commit },
|
||||
{ state, commit },
|
||||
payload: {
|
||||
title: string
|
||||
url: string
|
||||
}
|
||||
) {
|
||||
return new Promise<boolean>((resolve)=>{
|
||||
if (state.videoWindow){
|
||||
return new Promise<boolean>((resolve) => {
|
||||
if (state.videoWindow) {
|
||||
state.videoWindow.destroy().then(() => {
|
||||
commit('new_wallpaper_window', payload);
|
||||
commit('new_wallpaper_window', payload)
|
||||
resolve(true)
|
||||
})
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
commit('new_wallpaper_window', payload)
|
||||
resolve(true);
|
||||
resolve(true)
|
||||
}
|
||||
})
|
||||
},
|
||||
async get_settings({ state }) {
|
||||
const settings = await invoke('get_settings')
|
||||
state.settings = JSON.parse(settings as string) as Settings
|
||||
check_auto_start(state.settings)
|
||||
return
|
||||
},
|
||||
async set_settings({ state }, payload: Settings) {
|
||||
state.settings = payload
|
||||
const settings: boolean = await invoke('set_settings', {
|
||||
settings: state.settings
|
||||
})
|
||||
if (state.settings.auto_pause) {
|
||||
await emit('start_auto_pause')
|
||||
} else await emit('stop_auto_pause')
|
||||
check_auto_start(state.settings)
|
||||
return settings
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -45,8 +45,9 @@ interface EditInfo {
|
|||
mute: boolean
|
||||
}
|
||||
|
||||
export interface settings{
|
||||
title_bar:"win"|"mac",
|
||||
auto_start:boolean,
|
||||
auto_pause:boolean
|
||||
export interface Settings {
|
||||
title_bar: 'win' | 'mac'
|
||||
auto_start: boolean
|
||||
auto_pause: boolean
|
||||
version: string
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,12 @@
|
|||
<div class="settings-label-subtitle">选择选题栏关闭按钮样式</div>
|
||||
</div>
|
||||
</td>
|
||||
<td><el-switch></el-switch></td>
|
||||
<td>
|
||||
<el-select @change="save" v-model="settings.title_bar">
|
||||
<el-option label="Windows" value="win"></el-option>
|
||||
<el-option label="OSX" value="mac"></el-option>
|
||||
</el-select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
|
|
@ -22,7 +27,7 @@
|
|||
<div class="settings-label-subtitle">开机自启</div>
|
||||
</div>
|
||||
</td>
|
||||
<td><el-switch></el-switch></td>
|
||||
<td><el-switch @change="save" v-model="settings.auto_start"></el-switch></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
|
|
@ -31,7 +36,7 @@
|
|||
<div class="settings-label-subtitle">最大化自动暂停</div>
|
||||
</div>
|
||||
</td>
|
||||
<td><el-switch></el-switch></td>
|
||||
<td><el-switch @change="save" v-model="settings.auto_pause"></el-switch></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
@ -39,12 +44,16 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ElForm, ElFormItem, ElSwitch, ElOption } from 'element-plus';
|
||||
import { ElSelect, ElSwitch, ElOption, ElMessage } from 'element-plus';
|
||||
import { entry } from '@/ts/entry';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { onMounted } from 'vue';
|
||||
import { useStore } from 'vuex';
|
||||
import { onMounted, ref } from 'vue';
|
||||
import SvgIcon from '@/components/SvgIcon.vue';
|
||||
import type { Settings } from '@/ts/types';
|
||||
const router = useRouter();
|
||||
const store = useStore();
|
||||
const settings = ref<Settings>(store.state.settings);
|
||||
|
||||
onMounted(() => {
|
||||
const table_body = document.querySelector(".setting-table-body") as HTMLElement;
|
||||
|
|
@ -54,6 +63,21 @@ onMounted(() => {
|
|||
function back_home() {
|
||||
router.push("/")
|
||||
}
|
||||
|
||||
function save() {
|
||||
store.dispatch("set_settings", settings.value).then((status) => {
|
||||
if (status as boolean) {
|
||||
ElMessage({
|
||||
type: "success",
|
||||
message: "设置已更改"
|
||||
})
|
||||
}
|
||||
else ElMessage({
|
||||
type: "error",
|
||||
message: "设置更改失败"
|
||||
})
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import { getCurrentWindow } from '@tauri-apps/api/window'
|
|||
interface Params {
|
||||
url?: string
|
||||
mute?: string
|
||||
auto_pause?: string
|
||||
}
|
||||
function getSearchParamsAsObject() {
|
||||
const params = new URLSearchParams(window.location.search)
|
||||
|
|
@ -19,21 +20,21 @@ listen('video_pause', () => {
|
|||
if (player) player.pause()
|
||||
})
|
||||
|
||||
class player{
|
||||
playing:boolean
|
||||
params:Params
|
||||
interval:number
|
||||
constructor(params:Params) {
|
||||
this.params = params;
|
||||
this.playing = false;
|
||||
this.interval = 0;
|
||||
class player {
|
||||
playing: boolean
|
||||
params: Params
|
||||
interval: number
|
||||
constructor(params: Params) {
|
||||
this.params = params
|
||||
this.playing = false
|
||||
this.interval = 0
|
||||
}
|
||||
init_player(videoUrl:string){
|
||||
init_player(videoUrl: string) {
|
||||
const player = document.getElementById('player') as HTMLVideoElement
|
||||
if (player) {
|
||||
player.src = videoUrl
|
||||
player.play()
|
||||
this.playing = true;
|
||||
this.playing = true
|
||||
if (this.params.mute) {
|
||||
player.muted = JSON.parse(this.params.mute)
|
||||
}
|
||||
|
|
@ -42,35 +43,43 @@ class player{
|
|||
player.style.opacity = '1'
|
||||
}, 0)
|
||||
}
|
||||
this.detect_zoom();
|
||||
if (this.params.auto_pause && this.params.auto_pause === 'true') {
|
||||
this.detect_zoom()
|
||||
}
|
||||
}
|
||||
detect_zoom(){
|
||||
setInterval(() => {
|
||||
detect_zoom() {
|
||||
this.clear_detection()
|
||||
this.interval = window.setInterval(() => {
|
||||
invoke('any_zoomed').then((res) => {
|
||||
if (res as boolean) {
|
||||
if(this.playing) {
|
||||
if (this.playing) {
|
||||
const player = document.getElementById('player') as HTMLVideoElement
|
||||
if (player) {
|
||||
player.pause();
|
||||
this.playing = false;
|
||||
player.pause()
|
||||
this.playing = false
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(!this.playing) {
|
||||
} else {
|
||||
if (!this.playing) {
|
||||
const player = document.getElementById('player') as HTMLVideoElement
|
||||
if (player) {
|
||||
player.play();
|
||||
this.playing = true;
|
||||
player.play()
|
||||
this.playing = true
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}, 1000)
|
||||
}
|
||||
}
|
||||
clear_detection() {
|
||||
if (this.interval) {
|
||||
clearInterval(this.interval)
|
||||
this.interval = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let player_instance:player | null = null;
|
||||
let player_instance: player | null = null
|
||||
|
||||
window.onload = () => {
|
||||
invoke('set_wallpaper', {
|
||||
|
|
@ -90,9 +99,17 @@ window.onload = () => {
|
|||
const binary_data_arr = new Uint8Array(res as number[])
|
||||
const blob = new Blob([binary_data_arr], { type: 'video/mp4' })
|
||||
const videoUrl = URL.createObjectURL(blob)
|
||||
player_instance = new player(params);
|
||||
player_instance.init_player(videoUrl);
|
||||
player_instance = new player(params)
|
||||
player_instance.init_player(videoUrl)
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
listen('stop_auto_pause', () => {
|
||||
if (player_instance) player_instance.clear_detection()
|
||||
})
|
||||
|
||||
listen('start_auto_pause', () => {
|
||||
if (player_instance) player_instance.detect_zoom()
|
||||
})
|
||||
|
|
|
|||