feat: 屏幕跟随改为多线程执行。

性能没有提升。
This commit is contained in:
Ivan Li 2022-11-26 10:17:25 +08:00
parent 56edd8ac77
commit 7e1c4dd245
4 changed files with 177 additions and 167 deletions

View File

@ -1,12 +1,12 @@
lockfileVersion: 5.4 lockfileVersion: 5.4
specifiers: specifiers:
'@tauri-apps/api': ^1.1.0 '@tauri-apps/api': ^1.2.0
'@tauri-apps/cli': ^1.1.0 '@tauri-apps/cli': ^1.2.1
'@types/node': ^18.7.10 '@types/node': ^18.11.9
'@types/react': ^18.0.15 '@types/react': ^18.0.25
'@types/react-dom': ^18.0.6 '@types/react-dom': ^18.0.9
'@vitejs/plugin-react': ^2.0.0 '@vitejs/plugin-react': ^2.2.0
autoprefixer: ^10.4.13 autoprefixer: ^10.4.13
clsx: ^1.2.1 clsx: ^1.2.1
eslint-config-prettier: ^8.5.0 eslint-config-prettier: ^8.5.0
@ -15,12 +15,12 @@ specifiers:
eslint-plugin-prettier: ^4.2.1 eslint-plugin-prettier: ^4.2.1
eslint-plugin-simple-import-sort: ^8.0.0 eslint-plugin-simple-import-sort: ^8.0.0
postcss: ^8.4.19 postcss: ^8.4.19
prettier: ^2.7.1 prettier: ^2.8.0
react: ^18.2.0 react: ^18.2.0
react-dom: ^18.2.0 react-dom: ^18.2.0
tailwindcss: ^3.2.4 tailwindcss: ^3.2.4
typescript: ^4.6.4 typescript: ^4.9.3
vite: ^3.0.2 vite: ^3.2.4
dependencies: dependencies:
'@tauri-apps/api': 1.2.0 '@tauri-apps/api': 1.2.0
@ -29,22 +29,22 @@ dependencies:
react-dom: 18.2.0_react@18.2.0 react-dom: 18.2.0_react@18.2.0
devDependencies: devDependencies:
'@tauri-apps/cli': 1.2.0 '@tauri-apps/cli': 1.2.1
'@types/node': 18.11.9 '@types/node': 18.11.9
'@types/react': 18.0.25 '@types/react': 18.0.25
'@types/react-dom': 18.0.8 '@types/react-dom': 18.0.9
'@vitejs/plugin-react': 2.2.0_vite@3.2.3 '@vitejs/plugin-react': 2.2.0_vite@3.2.4
autoprefixer: 10.4.13_postcss@8.4.19 autoprefixer: 10.4.13_postcss@8.4.19
eslint-config-prettier: 8.5.0 eslint-config-prettier: 8.5.0
eslint-plugin-import: 2.26.0 eslint-plugin-import: 2.26.0
eslint-plugin-jsx-a11y: 6.6.1 eslint-plugin-jsx-a11y: 6.6.1
eslint-plugin-prettier: 4.2.1_5ipovlnpea62s4232hvmwuqmsm eslint-plugin-prettier: 4.2.1_woggxqa3l645ufel4grhxgids4
eslint-plugin-simple-import-sort: 8.0.0 eslint-plugin-simple-import-sort: 8.0.0
postcss: 8.4.19 postcss: 8.4.19
prettier: 2.7.1 prettier: 2.8.0
tailwindcss: 3.2.4_postcss@8.4.19 tailwindcss: 3.2.4_postcss@8.4.19
typescript: 4.8.4 typescript: 4.9.3
vite: 3.2.3_@types+node@18.11.9 vite: 3.2.4_@types+node@18.11.9
packages: packages:
@ -330,8 +330,8 @@ packages:
to-fast-properties: 2.0.0 to-fast-properties: 2.0.0
dev: true dev: true
/@esbuild/android-arm/0.15.13: /@esbuild/android-arm/0.15.15:
resolution: {integrity: sha512-RY2fVI8O0iFUNvZirXaQ1vMvK0xhCcl0gqRj74Z6yEiO1zAUa7hbsdwZM1kzqbxHK7LFyMizipfXT3JME+12Hw==} resolution: {integrity: sha512-JJjZjJi2eBL01QJuWjfCdZxcIgot+VoK6Fq7eKF9w4YHm9hwl7nhBR1o2Wnt/WcANk5l9SkpvrldW1PLuXxcbw==}
engines: {node: '>=12'} engines: {node: '>=12'}
cpu: [arm] cpu: [arm]
os: [android] os: [android]
@ -339,8 +339,8 @@ packages:
dev: true dev: true
optional: true optional: true
/@esbuild/linux-loong64/0.15.13: /@esbuild/linux-loong64/0.15.15:
resolution: {integrity: sha512-+BoyIm4I8uJmH/QDIH0fu7MG0AEx9OXEDXnqptXCwKOlOqZiS4iraH1Nr7/ObLMokW3sOCeBNyD68ATcV9b9Ag==} resolution: {integrity: sha512-lhz6UNPMDXUhtXSulw8XlFAtSYO26WmHQnCi2Lg2p+/TMiJKNLtZCYUxV4wG6rZMzXmr8InGpNwk+DLT2Hm0PA==}
engines: {node: '>=12'} engines: {node: '>=12'}
cpu: [loong64] cpu: [loong64]
os: [linux] os: [linux]
@ -412,8 +412,8 @@ packages:
engines: {node: '>= 14.6.0', npm: '>= 6.6.0', yarn: '>= 1.19.1'} engines: {node: '>= 14.6.0', npm: '>= 6.6.0', yarn: '>= 1.19.1'}
dev: false dev: false
/@tauri-apps/cli-darwin-arm64/1.2.0: /@tauri-apps/cli-darwin-arm64/1.2.1:
resolution: {integrity: sha512-f3LR2RvTU2ulxYdK9Nc3vKaSpDChu52pz0BMWNrSs3dxs4WTVioie98Ufz+GorifkUp3sYXcJte3HzX6wH/QxQ==} resolution: {integrity: sha512-WiAxSON52owFI65Whd3NjcKjXdO1zJfafBVZ3v+Y3F2zlXhRPiirXbtefAc3mvN56zDz/pfi018Qb4XesuVzHA==}
engines: {node: '>= 10'} engines: {node: '>= 10'}
cpu: [arm64] cpu: [arm64]
os: [darwin] os: [darwin]
@ -421,8 +421,8 @@ packages:
dev: true dev: true
optional: true optional: true
/@tauri-apps/cli-darwin-x64/1.2.0: /@tauri-apps/cli-darwin-x64/1.2.1:
resolution: {integrity: sha512-m07QZaAZCtyobrjddfz/Rxf9GGutnBOpRMbNqVqCk0qKRJzHG1fIsLqkgZh6+qPv0zHpu7xi/FPcqTec72Cp8w==} resolution: {integrity: sha512-jfumnrn7RYKVtDmHgrQhImoxpqT51bDrO4KxgpIXaYSaf6MdG2JT72dwUovPrURw0JX2Z/Elihq+dYbrsKoV/w==}
engines: {node: '>= 10'} engines: {node: '>= 10'}
cpu: [x64] cpu: [x64]
os: [darwin] os: [darwin]
@ -430,8 +430,8 @@ packages:
dev: true dev: true
optional: true optional: true
/@tauri-apps/cli-linux-arm-gnueabihf/1.2.0: /@tauri-apps/cli-linux-arm-gnueabihf/1.2.1:
resolution: {integrity: sha512-Id9eF1JtthZRFVtXAAVtSlI3uMT8cJ7LYmCSIl3mAXEUeaPBxnUs1i9X6/J+2Ho3yLEuuOxJ7PaJd+4v8wnEeg==} resolution: {integrity: sha512-n4p6Ekn6Wa9X/klUGevEGgoWAGApGGsLrJYE4c8bKTbAUfQ9Nyzjh8gK/GDii1dg9oRW0FdXDa6BJa7aEEj9sA==}
engines: {node: '>= 10'} engines: {node: '>= 10'}
cpu: [arm] cpu: [arm]
os: [linux] os: [linux]
@ -439,8 +439,8 @@ packages:
dev: true dev: true
optional: true optional: true
/@tauri-apps/cli-linux-arm64-gnu/1.2.0: /@tauri-apps/cli-linux-arm64-gnu/1.2.1:
resolution: {integrity: sha512-NtfPkkpeMPl+i/tB/Fc8ST2rKO2vV8int/RkOvNGLCkhWcl4sbzKBol7tc4q8c8h0X7FXDcF1l/EOuGsZUAA5Q==} resolution: {integrity: sha512-oAHkQQGfNCh8pQQHuDzzqt+S5sOj3tiUkySaquR2z/AQEHeDGAMrRGLZwOiDw9Xvu7qxFiF9H0e5OMK7BkncDw==}
engines: {node: '>= 10'} engines: {node: '>= 10'}
cpu: [arm64] cpu: [arm64]
os: [linux] os: [linux]
@ -448,8 +448,8 @@ packages:
dev: true dev: true
optional: true optional: true
/@tauri-apps/cli-linux-arm64-musl/1.2.0: /@tauri-apps/cli-linux-arm64-musl/1.2.1:
resolution: {integrity: sha512-tz+mOOVsy/TMdq2WJVIJl/iwW3OCWCyD5Fls3fhyJ4XpLfjn4G+C+oU0awXD/0se0ko81aq4D+r8eDx6oBRi0A==} resolution: {integrity: sha512-1dEZ5fdFYkMyB1U7ZkDJUlwYwCeqy9Y3vXmtZ6pCxrvgs844s8+RIFDuMU42pTN+lUxfFeQARmv0LpS4eF/QWQ==}
engines: {node: '>= 10'} engines: {node: '>= 10'}
cpu: [arm64] cpu: [arm64]
os: [linux] os: [linux]
@ -457,8 +457,8 @@ packages:
dev: true dev: true
optional: true optional: true
/@tauri-apps/cli-linux-x64-gnu/1.2.0: /@tauri-apps/cli-linux-x64-gnu/1.2.1:
resolution: {integrity: sha512-FH/wU+OWZjRQvrq/oequScr72I84XgOuRuMEpt/GqGD341cBJ8ithpoyzuiKsvjS6K0qMyRFzy3eyhQ7gwX+4Q==} resolution: {integrity: sha512-wkgCD3s5P6tgBPnn0/gDx7MXMx2Hx+jdA+JP8zdCq4cIeYXlxdZG/zXbHb5ldPadNh582lzHiGg+Pmc+wDg2fA==}
engines: {node: '>= 10'} engines: {node: '>= 10'}
cpu: [x64] cpu: [x64]
os: [linux] os: [linux]
@ -466,8 +466,8 @@ packages:
dev: true dev: true
optional: true optional: true
/@tauri-apps/cli-linux-x64-musl/1.2.0: /@tauri-apps/cli-linux-x64-musl/1.2.1:
resolution: {integrity: sha512-nLg30aBT9fI83sjIqaGPN7twbtE5LJy2DbKzxIlw59F+GT8HBdiM/2mZdTLB3AQb52yVHuGB1TVtWDsl0JHqCA==} resolution: {integrity: sha512-zD+a+5cSlYVU0ECOojWp71ok/9jE0DJufzb9oky17XIKV/oiOAG60z4OYRe+oqxYS1TcBt+pUa1/2zlu/6SRdA==}
engines: {node: '>= 10'} engines: {node: '>= 10'}
cpu: [x64] cpu: [x64]
os: [linux] os: [linux]
@ -475,8 +475,8 @@ packages:
dev: true dev: true
optional: true optional: true
/@tauri-apps/cli-win32-ia32-msvc/1.2.0: /@tauri-apps/cli-win32-ia32-msvc/1.2.1:
resolution: {integrity: sha512-eXtgIgY0fawgcOuUjH8Y6PxwPxbK87Zl9XmA7Q0m58T7pIz+gcbgvtH8Bb+liYHoRYItIhQxVm+ui7Y59rI7Cg==} resolution: {integrity: sha512-nEgdRd8czaKL1RQfj946dsfzlk6atmD95Fm7NVTVOe77PFHTS3ztHeWK7X6jirCaOF3h/F7qpJVCU6JMnq2tfA==}
engines: {node: '>= 10'} engines: {node: '>= 10'}
cpu: [ia32] cpu: [ia32]
os: [win32] os: [win32]
@ -484,8 +484,8 @@ packages:
dev: true dev: true
optional: true optional: true
/@tauri-apps/cli-win32-x64-msvc/1.2.0: /@tauri-apps/cli-win32-x64-msvc/1.2.1:
resolution: {integrity: sha512-egyM66R05AIbkaUDptpHurFTIYp3VM4H5OrRd3O2b0oXf8SoiXiyrHbQsHVHHDYyytKmwkdNqjdy+Vev/Vq25Q==} resolution: {integrity: sha512-ceWiQkmNNRrnfgbLMnndT4QF1IyLK7aOJsMqS/HueshAwmVQWnC1DUE0C58Taetgq38Cavc4gGnZOCHuH6ZuTw==}
engines: {node: '>= 10'} engines: {node: '>= 10'}
cpu: [x64] cpu: [x64]
os: [win32] os: [win32]
@ -493,20 +493,20 @@ packages:
dev: true dev: true
optional: true optional: true
/@tauri-apps/cli/1.2.0: /@tauri-apps/cli/1.2.1:
resolution: {integrity: sha512-DgUnk4p/atWHq2HUx9Vt+/LuRsx4iFlkzdZIUxtFWvpcZih2k0TzmHJbrhM1evh1/7a+SqiwDawmyf3Hz1HxXA==} resolution: {integrity: sha512-JrFFT1/4V+AGSRjKdgszZwOr+/a1519LDhNxBkbsIg6D/kFK+3kk1qImaQBY9DvvIWK6IV4whc8OAkgxm+Sl3w==}
engines: {node: '>= 10'} engines: {node: '>= 10'}
hasBin: true hasBin: true
optionalDependencies: optionalDependencies:
'@tauri-apps/cli-darwin-arm64': 1.2.0 '@tauri-apps/cli-darwin-arm64': 1.2.1
'@tauri-apps/cli-darwin-x64': 1.2.0 '@tauri-apps/cli-darwin-x64': 1.2.1
'@tauri-apps/cli-linux-arm-gnueabihf': 1.2.0 '@tauri-apps/cli-linux-arm-gnueabihf': 1.2.1
'@tauri-apps/cli-linux-arm64-gnu': 1.2.0 '@tauri-apps/cli-linux-arm64-gnu': 1.2.1
'@tauri-apps/cli-linux-arm64-musl': 1.2.0 '@tauri-apps/cli-linux-arm64-musl': 1.2.1
'@tauri-apps/cli-linux-x64-gnu': 1.2.0 '@tauri-apps/cli-linux-x64-gnu': 1.2.1
'@tauri-apps/cli-linux-x64-musl': 1.2.0 '@tauri-apps/cli-linux-x64-musl': 1.2.1
'@tauri-apps/cli-win32-ia32-msvc': 1.2.0 '@tauri-apps/cli-win32-ia32-msvc': 1.2.1
'@tauri-apps/cli-win32-x64-msvc': 1.2.0 '@tauri-apps/cli-win32-x64-msvc': 1.2.1
dev: true dev: true
/@types/json5/0.0.29: /@types/json5/0.0.29:
@ -521,8 +521,8 @@ packages:
resolution: {integrity: sha512-JCB8C6SnDoQf0cNycqd/35A7MjcnK+ZTqE7judS6o7utxUCg6imJg3QK2qzHKszlTjcj2cn+NwMB2i96ubpj7w==} resolution: {integrity: sha512-JCB8C6SnDoQf0cNycqd/35A7MjcnK+ZTqE7judS6o7utxUCg6imJg3QK2qzHKszlTjcj2cn+NwMB2i96ubpj7w==}
dev: true dev: true
/@types/react-dom/18.0.8: /@types/react-dom/18.0.9:
resolution: {integrity: sha512-C3GYO0HLaOkk9dDAz3Dl4sbe4AKUGTCfFIZsz3n/82dPNN8Du533HzKatDxeUYWu24wJgMP1xICqkWk1YOLOIw==} resolution: {integrity: sha512-qnVvHxASt/H7i+XG1U1xMiY5t+IHcPGUK7TDMDzom08xa7e86eCeKOiLZezwCKVxJn6NEiiy2ekgX8aQssjIKg==}
dependencies: dependencies:
'@types/react': 18.0.25 '@types/react': 18.0.25
dev: true dev: true
@ -539,7 +539,7 @@ packages:
resolution: {integrity: sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew==} resolution: {integrity: sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew==}
dev: true dev: true
/@vitejs/plugin-react/2.2.0_vite@3.2.3: /@vitejs/plugin-react/2.2.0_vite@3.2.4:
resolution: {integrity: sha512-FFpefhvExd1toVRlokZgxgy2JtnBOdp4ZDsq7ldCWaqGSGn9UhWMAVm/1lxPL14JfNS5yGz+s9yFrQY6shoStA==} resolution: {integrity: sha512-FFpefhvExd1toVRlokZgxgy2JtnBOdp4ZDsq7ldCWaqGSGn9UhWMAVm/1lxPL14JfNS5yGz+s9yFrQY6shoStA==}
engines: {node: ^14.18.0 || >=16.0.0} engines: {node: ^14.18.0 || >=16.0.0}
peerDependencies: peerDependencies:
@ -552,7 +552,7 @@ packages:
'@babel/plugin-transform-react-jsx-source': 7.19.6_@babel+core@7.20.2 '@babel/plugin-transform-react-jsx-source': 7.19.6_@babel+core@7.20.2
magic-string: 0.26.7 magic-string: 0.26.7
react-refresh: 0.14.0 react-refresh: 0.14.0
vite: 3.2.3_@types+node@18.11.9 vite: 3.2.4_@types+node@18.11.9
transitivePeerDependencies: transitivePeerDependencies:
- supports-color - supports-color
dev: true dev: true
@ -583,8 +583,8 @@ packages:
color-convert: 1.9.3 color-convert: 1.9.3
dev: true dev: true
/anymatch/3.1.2: /anymatch/3.1.3:
resolution: {integrity: sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==} resolution: {integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==}
engines: {node: '>= 8'} engines: {node: '>= 8'}
dependencies: dependencies:
normalize-path: 3.0.0 normalize-path: 3.0.0
@ -636,7 +636,7 @@ packages:
postcss: ^8.1.0 postcss: ^8.1.0
dependencies: dependencies:
browserslist: 4.21.4 browserslist: 4.21.4
caniuse-lite: 1.0.30001431 caniuse-lite: 1.0.30001434
fraction.js: 4.2.0 fraction.js: 4.2.0
normalize-range: 0.1.2 normalize-range: 0.1.2
picocolors: 1.0.0 picocolors: 1.0.0
@ -681,7 +681,7 @@ packages:
engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7}
hasBin: true hasBin: true
dependencies: dependencies:
caniuse-lite: 1.0.30001431 caniuse-lite: 1.0.30001434
electron-to-chromium: 1.4.284 electron-to-chromium: 1.4.284
node-releases: 2.0.6 node-releases: 2.0.6
update-browserslist-db: 1.0.10_browserslist@4.21.4 update-browserslist-db: 1.0.10_browserslist@4.21.4
@ -699,8 +699,8 @@ packages:
engines: {node: '>= 6'} engines: {node: '>= 6'}
dev: true dev: true
/caniuse-lite/1.0.30001431: /caniuse-lite/1.0.30001434:
resolution: {integrity: sha512-zBUoFU0ZcxpvSt9IU66dXVT/3ctO1cy4y9cscs1szkPlcWb6pasYM144GqrUygUbT+k7cmUCW61cvskjcv0enQ==} resolution: {integrity: sha512-aOBHrLmTQw//WFa2rcF1If9fa3ypkC1wzqqiKHgfdrXTWcU8C4gKVZT77eQAPWN1APys3+uQ0Df07rKauXGEYA==}
dev: true dev: true
/chalk/2.4.2: /chalk/2.4.2:
@ -716,7 +716,7 @@ packages:
resolution: {integrity: sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==} resolution: {integrity: sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==}
engines: {node: '>= 8.10.0'} engines: {node: '>= 8.10.0'}
dependencies: dependencies:
anymatch: 3.1.2 anymatch: 3.1.3
braces: 3.0.2 braces: 3.0.2
glob-parent: 5.1.2 glob-parent: 5.1.2
is-binary-path: 2.1.0 is-binary-path: 2.1.0
@ -792,7 +792,7 @@ packages:
supports-color: supports-color:
optional: true optional: true
dependencies: dependencies:
ms: 2.1.2 ms: 2.1.3
dev: true dev: true
/debug/4.3.4: /debug/4.3.4:
@ -897,8 +897,8 @@ packages:
is-symbol: 1.0.4 is-symbol: 1.0.4
dev: true dev: true
/esbuild-android-64/0.15.13: /esbuild-android-64/0.15.15:
resolution: {integrity: sha512-yRorukXBlokwTip+Sy4MYskLhJsO0Kn0/Fj43s1krVblfwP+hMD37a4Wmg139GEsMLl+vh8WXp2mq/cTA9J97g==} resolution: {integrity: sha512-F+WjjQxO+JQOva3tJWNdVjouFMLK6R6i5gjDvgUthLYJnIZJsp1HlF523k73hELY20WPyEO8xcz7aaYBVkeg5Q==}
engines: {node: '>=12'} engines: {node: '>=12'}
cpu: [x64] cpu: [x64]
os: [android] os: [android]
@ -906,8 +906,8 @@ packages:
dev: true dev: true
optional: true optional: true
/esbuild-android-arm64/0.15.13: /esbuild-android-arm64/0.15.15:
resolution: {integrity: sha512-TKzyymLD6PiVeyYa4c5wdPw87BeAiTXNtK6amWUcXZxkV51gOk5u5qzmDaYSwiWeecSNHamFsaFjLoi32QR5/w==} resolution: {integrity: sha512-attlyhD6Y22jNyQ0fIIQ7mnPvDWKw7k6FKnsXlBvQE6s3z6s6cuEHcSgoirquQc7TmZgVCK5fD/2uxmRN+ZpcQ==}
engines: {node: '>=12'} engines: {node: '>=12'}
cpu: [arm64] cpu: [arm64]
os: [android] os: [android]
@ -915,8 +915,8 @@ packages:
dev: true dev: true
optional: true optional: true
/esbuild-darwin-64/0.15.13: /esbuild-darwin-64/0.15.15:
resolution: {integrity: sha512-WAx7c2DaOS6CrRcoYCgXgkXDliLnFv3pQLV6GeW1YcGEZq2Gnl8s9Pg7ahValZkpOa0iE/ojRVQ87sbUhF1Cbg==} resolution: {integrity: sha512-ohZtF8W1SHJ4JWldsPVdk8st0r9ExbAOSrBOh5L+Mq47i696GVwv1ab/KlmbUoikSTNoXEhDzVpxUR/WIO19FQ==}
engines: {node: '>=12'} engines: {node: '>=12'}
cpu: [x64] cpu: [x64]
os: [darwin] os: [darwin]
@ -924,8 +924,8 @@ packages:
dev: true dev: true
optional: true optional: true
/esbuild-darwin-arm64/0.15.13: /esbuild-darwin-arm64/0.15.15:
resolution: {integrity: sha512-U6jFsPfSSxC3V1CLiQqwvDuj3GGrtQNB3P3nNC3+q99EKf94UGpsG9l4CQ83zBs1NHrk1rtCSYT0+KfK5LsD8A==} resolution: {integrity: sha512-P8jOZ5zshCNIuGn+9KehKs/cq5uIniC+BeCykvdVhx/rBXSxmtj3CUIKZz4sDCuESMbitK54drf/2QX9QHG5Ag==}
engines: {node: '>=12'} engines: {node: '>=12'}
cpu: [arm64] cpu: [arm64]
os: [darwin] os: [darwin]
@ -933,8 +933,8 @@ packages:
dev: true dev: true
optional: true optional: true
/esbuild-freebsd-64/0.15.13: /esbuild-freebsd-64/0.15.15:
resolution: {integrity: sha512-whItJgDiOXaDG/idy75qqevIpZjnReZkMGCgQaBWZuKHoElDJC1rh7MpoUgupMcdfOd+PgdEwNQW9DAE6i8wyA==} resolution: {integrity: sha512-KkTg+AmDXz1IvA9S1gt8dE24C8Thx0X5oM0KGF322DuP+P3evwTL9YyusHAWNsh4qLsR80nvBr/EIYs29VSwuA==}
engines: {node: '>=12'} engines: {node: '>=12'}
cpu: [x64] cpu: [x64]
os: [freebsd] os: [freebsd]
@ -942,8 +942,8 @@ packages:
dev: true dev: true
optional: true optional: true
/esbuild-freebsd-arm64/0.15.13: /esbuild-freebsd-arm64/0.15.15:
resolution: {integrity: sha512-6pCSWt8mLUbPtygv7cufV0sZLeylaMwS5Fznj6Rsx9G2AJJsAjQ9ifA+0rQEIg7DwJmi9it+WjzNTEAzzdoM3Q==} resolution: {integrity: sha512-FUcML0DRsuyqCMfAC+HoeAqvWxMeq0qXvclZZ/lt2kLU6XBnDA5uKTLUd379WYEyVD4KKFctqWd9tTuk8C/96g==}
engines: {node: '>=12'} engines: {node: '>=12'}
cpu: [arm64] cpu: [arm64]
os: [freebsd] os: [freebsd]
@ -951,8 +951,8 @@ packages:
dev: true dev: true
optional: true optional: true
/esbuild-linux-32/0.15.13: /esbuild-linux-32/0.15.15:
resolution: {integrity: sha512-VbZdWOEdrJiYApm2kkxoTOgsoCO1krBZ3quHdYk3g3ivWaMwNIVPIfEE0f0XQQ0u5pJtBsnk2/7OPiCFIPOe/w==} resolution: {integrity: sha512-q28Qn5pZgHNqug02aTkzw5sW9OklSo96b5nm17Mq0pDXrdTBcQ+M6Q9A1B+dalFeynunwh/pvfrNucjzwDXj+Q==}
engines: {node: '>=12'} engines: {node: '>=12'}
cpu: [ia32] cpu: [ia32]
os: [linux] os: [linux]
@ -960,8 +960,8 @@ packages:
dev: true dev: true
optional: true optional: true
/esbuild-linux-64/0.15.13: /esbuild-linux-64/0.15.15:
resolution: {integrity: sha512-rXmnArVNio6yANSqDQlIO4WiP+Cv7+9EuAHNnag7rByAqFVuRusLbGi2697A5dFPNXoO//IiogVwi3AdcfPC6A==} resolution: {integrity: sha512-217KPmWMirkf8liO+fj2qrPwbIbhNTGNVtvqI1TnOWJgcMjUWvd677Gq3fTzXEjilkx2yWypVnTswM2KbXgoAg==}
engines: {node: '>=12'} engines: {node: '>=12'}
cpu: [x64] cpu: [x64]
os: [linux] os: [linux]
@ -969,8 +969,8 @@ packages:
dev: true dev: true
optional: true optional: true
/esbuild-linux-arm/0.15.13: /esbuild-linux-arm/0.15.15:
resolution: {integrity: sha512-Ac6LpfmJO8WhCMQmO253xX2IU2B3wPDbl4IvR0hnqcPrdfCaUa2j/lLMGTjmQ4W5JsJIdHEdW12dG8lFS0MbxQ==} resolution: {integrity: sha512-RYVW9o2yN8yM7SB1yaWr378CwrjvGCyGybX3SdzPHpikUHkME2AP55Ma20uNwkNyY2eSYFX9D55kDrfQmQBR4w==}
engines: {node: '>=12'} engines: {node: '>=12'}
cpu: [arm] cpu: [arm]
os: [linux] os: [linux]
@ -978,8 +978,8 @@ packages:
dev: true dev: true
optional: true optional: true
/esbuild-linux-arm64/0.15.13: /esbuild-linux-arm64/0.15.15:
resolution: {integrity: sha512-alEMGU4Z+d17U7KQQw2IV8tQycO6T+rOrgW8OS22Ua25x6kHxoG6Ngry6Aq6uranC+pNWNMB6aHFPh7aTQdORQ==} resolution: {integrity: sha512-/ltmNFs0FivZkYsTzAsXIfLQX38lFnwJTWCJts0IbCqWZQe+jjj0vYBNbI0kmXLb3y5NljiM5USVAO1NVkdh2g==}
engines: {node: '>=12'} engines: {node: '>=12'}
cpu: [arm64] cpu: [arm64]
os: [linux] os: [linux]
@ -987,8 +987,8 @@ packages:
dev: true dev: true
optional: true optional: true
/esbuild-linux-mips64le/0.15.13: /esbuild-linux-mips64le/0.15.15:
resolution: {integrity: sha512-47PgmyYEu+yN5rD/MbwS6DxP2FSGPo4Uxg5LwIdxTiyGC2XKwHhHyW7YYEDlSuXLQXEdTO7mYe8zQ74czP7W8A==} resolution: {integrity: sha512-PksEPb321/28GFFxtvL33yVPfnMZihxkEv5zME2zapXGp7fA1X2jYeiTUK+9tJ/EGgcNWuwvtawPxJG7Mmn86A==}
engines: {node: '>=12'} engines: {node: '>=12'}
cpu: [mips64el] cpu: [mips64el]
os: [linux] os: [linux]
@ -996,8 +996,8 @@ packages:
dev: true dev: true
optional: true optional: true
/esbuild-linux-ppc64le/0.15.13: /esbuild-linux-ppc64le/0.15.15:
resolution: {integrity: sha512-z6n28h2+PC1Ayle9DjKoBRcx/4cxHoOa2e689e2aDJSaKug3jXcQw7mM+GLg+9ydYoNzj8QxNL8ihOv/OnezhA==} resolution: {integrity: sha512-ek8gJBEIhcpGI327eAZigBOHl58QqrJrYYIZBWQCnH3UnXoeWMrMZLeeZL8BI2XMBhP+sQ6ERctD5X+ajL/AIA==}
engines: {node: '>=12'} engines: {node: '>=12'}
cpu: [ppc64] cpu: [ppc64]
os: [linux] os: [linux]
@ -1005,8 +1005,8 @@ packages:
dev: true dev: true
optional: true optional: true
/esbuild-linux-riscv64/0.15.13: /esbuild-linux-riscv64/0.15.15:
resolution: {integrity: sha512-+Lu4zuuXuQhgLUGyZloWCqTslcCAjMZH1k3Xc9MSEJEpEFdpsSU0sRDXAnk18FKOfEjhu4YMGaykx9xjtpA6ow==} resolution: {integrity: sha512-H5ilTZb33/GnUBrZMNJtBk7/OXzDHDXjIzoLXHSutwwsLxSNaLxzAaMoDGDd/keZoS+GDBqNVxdCkpuiRW4OSw==}
engines: {node: '>=12'} engines: {node: '>=12'}
cpu: [riscv64] cpu: [riscv64]
os: [linux] os: [linux]
@ -1014,8 +1014,8 @@ packages:
dev: true dev: true
optional: true optional: true
/esbuild-linux-s390x/0.15.13: /esbuild-linux-s390x/0.15.15:
resolution: {integrity: sha512-BMeXRljruf7J0TMxD5CIXS65y7puiZkAh+s4XFV9qy16SxOuMhxhVIXYLnbdfLrsYGFzx7U9mcdpFWkkvy/Uag==} resolution: {integrity: sha512-jKaLUg78mua3rrtrkpv4Or2dNTJU7bgHN4bEjT4OX4GR7nLBSA9dfJezQouTxMmIW7opwEC5/iR9mpC18utnxQ==}
engines: {node: '>=12'} engines: {node: '>=12'}
cpu: [s390x] cpu: [s390x]
os: [linux] os: [linux]
@ -1023,8 +1023,8 @@ packages:
dev: true dev: true
optional: true optional: true
/esbuild-netbsd-64/0.15.13: /esbuild-netbsd-64/0.15.15:
resolution: {integrity: sha512-EHj9QZOTel581JPj7UO3xYbltFTYnHy+SIqJVq6yd3KkCrsHRbapiPb0Lx3EOOtybBEE9EyqbmfW1NlSDsSzvQ==} resolution: {integrity: sha512-aOvmF/UkjFuW6F36HbIlImJTTx45KUCHJndtKo+KdP8Dhq3mgLRKW9+6Ircpm8bX/RcS3zZMMmaBLkvGY06Gvw==}
engines: {node: '>=12'} engines: {node: '>=12'}
cpu: [x64] cpu: [x64]
os: [netbsd] os: [netbsd]
@ -1032,8 +1032,8 @@ packages:
dev: true dev: true
optional: true optional: true
/esbuild-openbsd-64/0.15.13: /esbuild-openbsd-64/0.15.15:
resolution: {integrity: sha512-nkuDlIjF/sfUhfx8SKq0+U+Fgx5K9JcPq1mUodnxI0x4kBdCv46rOGWbuJ6eof2n3wdoCLccOoJAbg9ba/bT2w==} resolution: {integrity: sha512-HFFX+WYedx1w2yJ1VyR1Dfo8zyYGQZf1cA69bLdrHzu9svj6KH6ZLK0k3A1/LFPhcEY9idSOhsB2UyU0tHPxgQ==}
engines: {node: '>=12'} engines: {node: '>=12'}
cpu: [x64] cpu: [x64]
os: [openbsd] os: [openbsd]
@ -1041,8 +1041,8 @@ packages:
dev: true dev: true
optional: true optional: true
/esbuild-sunos-64/0.15.13: /esbuild-sunos-64/0.15.15:
resolution: {integrity: sha512-jVeu2GfxZQ++6lRdY43CS0Tm/r4WuQQ0Pdsrxbw+aOrHQPHV0+LNOLnvbN28M7BSUGnJnHkHm2HozGgNGyeIRw==} resolution: {integrity: sha512-jOPBudffG4HN8yJXcK9rib/ZTFoTA5pvIKbRrt3IKAGMq1EpBi4xoVoSRrq/0d4OgZLaQbmkHp8RO9eZIn5atA==}
engines: {node: '>=12'} engines: {node: '>=12'}
cpu: [x64] cpu: [x64]
os: [sunos] os: [sunos]
@ -1050,8 +1050,8 @@ packages:
dev: true dev: true
optional: true optional: true
/esbuild-windows-32/0.15.13: /esbuild-windows-32/0.15.15:
resolution: {integrity: sha512-XoF2iBf0wnqo16SDq+aDGi/+QbaLFpkiRarPVssMh9KYbFNCqPLlGAWwDvxEVz+ywX6Si37J2AKm+AXq1kC0JA==} resolution: {integrity: sha512-MDkJ3QkjnCetKF0fKxCyYNBnOq6dmidcwstBVeMtXSgGYTy8XSwBeIE4+HuKiSsG6I/mXEb++px3IGSmTN0XiA==}
engines: {node: '>=12'} engines: {node: '>=12'}
cpu: [ia32] cpu: [ia32]
os: [win32] os: [win32]
@ -1059,8 +1059,8 @@ packages:
dev: true dev: true
optional: true optional: true
/esbuild-windows-64/0.15.13: /esbuild-windows-64/0.15.15:
resolution: {integrity: sha512-Et6htEfGycjDrtqb2ng6nT+baesZPYQIW+HUEHK4D1ncggNrDNk3yoboYQ5KtiVrw/JaDMNttz8rrPubV/fvPQ==} resolution: {integrity: sha512-xaAUIB2qllE888SsMU3j9nrqyLbkqqkpQyWVkfwSil6BBPgcPk3zOFitTTncEKCLTQy3XV9RuH7PDj3aJDljWA==}
engines: {node: '>=12'} engines: {node: '>=12'}
cpu: [x64] cpu: [x64]
os: [win32] os: [win32]
@ -1068,8 +1068,8 @@ packages:
dev: true dev: true
optional: true optional: true
/esbuild-windows-arm64/0.15.13: /esbuild-windows-arm64/0.15.15:
resolution: {integrity: sha512-3bv7tqntThQC9SWLRouMDmZnlOukBhOCTlkzNqzGCmrkCJI7io5LLjwJBOVY6kOUlIvdxbooNZwjtBvj+7uuVg==} resolution: {integrity: sha512-ttuoCYCIJAFx4UUKKWYnFdrVpoXa3+3WWkXVI6s09U+YjhnyM5h96ewTq/WgQj9LFSIlABQvadHSOQyAVjW5xQ==}
engines: {node: '>=12'} engines: {node: '>=12'}
cpu: [arm64] cpu: [arm64]
os: [win32] os: [win32]
@ -1077,34 +1077,34 @@ packages:
dev: true dev: true
optional: true optional: true
/esbuild/0.15.13: /esbuild/0.15.15:
resolution: {integrity: sha512-Cu3SC84oyzzhrK/YyN4iEVy2jZu5t2fz66HEOShHURcjSkOSAVL8C/gfUT+lDJxkVHpg8GZ10DD0rMHRPqMFaQ==} resolution: {integrity: sha512-TEw/lwK4Zzld9x3FedV6jy8onOUHqcEX3ADFk4k+gzPUwrxn8nWV62tH0udo8jOtjFodlEfc4ypsqX3e+WWO6w==}
engines: {node: '>=12'} engines: {node: '>=12'}
hasBin: true hasBin: true
requiresBuild: true requiresBuild: true
optionalDependencies: optionalDependencies:
'@esbuild/android-arm': 0.15.13 '@esbuild/android-arm': 0.15.15
'@esbuild/linux-loong64': 0.15.13 '@esbuild/linux-loong64': 0.15.15
esbuild-android-64: 0.15.13 esbuild-android-64: 0.15.15
esbuild-android-arm64: 0.15.13 esbuild-android-arm64: 0.15.15
esbuild-darwin-64: 0.15.13 esbuild-darwin-64: 0.15.15
esbuild-darwin-arm64: 0.15.13 esbuild-darwin-arm64: 0.15.15
esbuild-freebsd-64: 0.15.13 esbuild-freebsd-64: 0.15.15
esbuild-freebsd-arm64: 0.15.13 esbuild-freebsd-arm64: 0.15.15
esbuild-linux-32: 0.15.13 esbuild-linux-32: 0.15.15
esbuild-linux-64: 0.15.13 esbuild-linux-64: 0.15.15
esbuild-linux-arm: 0.15.13 esbuild-linux-arm: 0.15.15
esbuild-linux-arm64: 0.15.13 esbuild-linux-arm64: 0.15.15
esbuild-linux-mips64le: 0.15.13 esbuild-linux-mips64le: 0.15.15
esbuild-linux-ppc64le: 0.15.13 esbuild-linux-ppc64le: 0.15.15
esbuild-linux-riscv64: 0.15.13 esbuild-linux-riscv64: 0.15.15
esbuild-linux-s390x: 0.15.13 esbuild-linux-s390x: 0.15.15
esbuild-netbsd-64: 0.15.13 esbuild-netbsd-64: 0.15.15
esbuild-openbsd-64: 0.15.13 esbuild-openbsd-64: 0.15.15
esbuild-sunos-64: 0.15.13 esbuild-sunos-64: 0.15.15
esbuild-windows-32: 0.15.13 esbuild-windows-32: 0.15.15
esbuild-windows-64: 0.15.13 esbuild-windows-64: 0.15.15
esbuild-windows-arm64: 0.15.13 esbuild-windows-arm64: 0.15.15
dev: true dev: true
/escalade/3.1.1: /escalade/3.1.1:
@ -1210,7 +1210,7 @@ packages:
semver: 6.3.0 semver: 6.3.0
dev: true dev: true
/eslint-plugin-prettier/4.2.1_5ipovlnpea62s4232hvmwuqmsm: /eslint-plugin-prettier/4.2.1_woggxqa3l645ufel4grhxgids4:
resolution: {integrity: sha512-f/0rXLXUt0oFYs8ra4w49wYZBG5GKZpAYsJSm6rnYL5uVDjd+zowwMwVZHnAjf4edNrKpCDYfXDgmRE/Ak7QyQ==} resolution: {integrity: sha512-f/0rXLXUt0oFYs8ra4w49wYZBG5GKZpAYsJSm6rnYL5uVDjd+zowwMwVZHnAjf4edNrKpCDYfXDgmRE/Ak7QyQ==}
engines: {node: '>=12.0.0'} engines: {node: '>=12.0.0'}
peerDependencies: peerDependencies:
@ -1222,7 +1222,7 @@ packages:
optional: true optional: true
dependencies: dependencies:
eslint-config-prettier: 8.5.0 eslint-config-prettier: 8.5.0
prettier: 2.7.1 prettier: 2.8.0
prettier-linter-helpers: 1.0.0 prettier-linter-helpers: 1.0.0
dev: true dev: true
@ -1570,6 +1570,10 @@ packages:
resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==} resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==}
dev: true dev: true
/ms/2.1.3:
resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==}
dev: true
/nanoid/3.3.4: /nanoid/3.3.4:
resolution: {integrity: sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==} resolution: {integrity: sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==}
engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}
@ -1687,11 +1691,11 @@ packages:
postcss: ^8.2.14 postcss: ^8.2.14
dependencies: dependencies:
postcss: 8.4.19 postcss: 8.4.19
postcss-selector-parser: 6.0.10 postcss-selector-parser: 6.0.11
dev: true dev: true
/postcss-selector-parser/6.0.10: /postcss-selector-parser/6.0.11:
resolution: {integrity: sha512-IQ7TZdoaqbT+LCpShg46jnZVlhWD2w6iQYAcYXfHARZ7X1t/UGhhceQDs5X0cGqKvYlHNOuv7Oa1xmb0oQuA3w==} resolution: {integrity: sha512-zbARubNdogI9j7WY4nQJBiNqQf3sLS3wCP4WfOidu+p28LofJqDH1tcXypGrcmMHhDk2t9wGhCsYe/+szLTy1g==}
engines: {node: '>=4'} engines: {node: '>=4'}
dependencies: dependencies:
cssesc: 3.0.0 cssesc: 3.0.0
@ -1718,8 +1722,8 @@ packages:
fast-diff: 1.2.0 fast-diff: 1.2.0
dev: true dev: true
/prettier/2.7.1: /prettier/2.8.0:
resolution: {integrity: sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==} resolution: {integrity: sha512-9Lmg8hTFZKG0Asr/kW9Bp8tJjRVluO8EJQVfY2T7FMw9T5jy4I/Uvx0Rca/XWf50QQ1/SS48+6IJWnrb+2yemA==}
engines: {node: '>=10.13.0'} engines: {node: '>=10.13.0'}
hasBin: true hasBin: true
dev: true dev: true
@ -1904,7 +1908,7 @@ packages:
postcss-js: 4.0.0_postcss@8.4.19 postcss-js: 4.0.0_postcss@8.4.19
postcss-load-config: 3.1.4_postcss@8.4.19 postcss-load-config: 3.1.4_postcss@8.4.19
postcss-nested: 6.0.0_postcss@8.4.19 postcss-nested: 6.0.0_postcss@8.4.19
postcss-selector-parser: 6.0.10 postcss-selector-parser: 6.0.11
postcss-value-parser: 4.2.0 postcss-value-parser: 4.2.0
quick-lru: 5.1.1 quick-lru: 5.1.1
resolve: 1.22.1 resolve: 1.22.1
@ -1933,8 +1937,8 @@ packages:
strip-bom: 3.0.0 strip-bom: 3.0.0
dev: true dev: true
/typescript/4.8.4: /typescript/4.9.3:
resolution: {integrity: sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==} resolution: {integrity: sha512-CIfGzTelbKNEnLpLdGFgdyKhG23CKdKgQPOBc+OUNrkJ2vr+KSzsSV5kq5iWhEQbok+quxgGzrAtGWCyU7tHnA==}
engines: {node: '>=4.2.0'} engines: {node: '>=4.2.0'}
hasBin: true hasBin: true
dev: true dev: true
@ -1963,8 +1967,8 @@ packages:
resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==}
dev: true dev: true
/vite/3.2.3_@types+node@18.11.9: /vite/3.2.4_@types+node@18.11.9:
resolution: {integrity: sha512-h8jl1TZ76eGs3o2dIBSsvXDLb1m/Ec1iej8ZMdz+PsaFUsftZeWe2CZOI3qogEsMNaywc17gu0q6cQDzh/weCQ==} resolution: {integrity: sha512-Z2X6SRAffOUYTa+sLy3NQ7nlHFU100xwanq1WDwqaiFiCe+25zdxP1TfCS5ojPV2oDDcXudHIoPnI1Z/66B7Yw==}
engines: {node: ^14.18.0 || >=16.0.0} engines: {node: ^14.18.0 || >=16.0.0}
hasBin: true hasBin: true
peerDependencies: peerDependencies:
@ -1989,7 +1993,7 @@ packages:
optional: true optional: true
dependencies: dependencies:
'@types/node': 18.11.9 '@types/node': 18.11.9
esbuild: 0.15.13 esbuild: 0.15.15
postcss: 8.4.19 postcss: 8.4.19
resolve: 1.22.1 resolve: 1.22.1
rollup: 2.79.1 rollup: 2.79.1

View File

@ -3,7 +3,10 @@ use paris::info;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::{sync::Arc, time::Duration}; use std::{sync::Arc, time::Duration};
use tauri::async_runtime::RwLock; use tauri::async_runtime::RwLock;
use tokio::{sync::Mutex, time::sleep}; use tokio::{
task,
time::{sleep, Instant},
};
use tracing::warn; use tracing::warn;
use crate::{ use crate::{
@ -82,44 +85,50 @@ impl CoreManager {
pub async fn play_follow(&self) -> anyhow::Result<()> { pub async fn play_follow(&self) -> anyhow::Result<()> {
{ {
info!("Following A");
let lock = self.ambient_light_mode.read().await; let lock = self.ambient_light_mode.read().await;
if let AmbientLightMode::Follow = *lock { if let AmbientLightMode::Follow = *lock {
Picker::global().refresh_displays().await?; Picker::global().refresh_displays().await?;
info!("Following B");
} else { } else {
return Ok(()); return Ok(());
} }
} };
loop { loop {
let start = Instant::now();
let next_tick = start + Duration::from_millis(16);
info!("Following"); info!("Following");
let lock = self.ambient_light_mode.read().await; let lock = self.ambient_light_mode.read().await;
if let AmbientLightMode::Follow = *lock { if let AmbientLightMode::Follow = *lock {
match Picker::global().take_screenshots_for_all().await { task::spawn(async {
Ok(_) => { let start = Instant::now();
let colors = Picker::global().get_led_strip_colors().await; match Self::follow_once().await {
match colors { Ok(_) => {}
Ok(colors) => { Err(error) => {
let colors = colors.into_iter().rev().collect(); warn!("take screenshots failed. {}", error);
rpc::manager::Manager::global()
.publish_led_colors(&colors)
.await;
}
Err(error) => {
warn!("get strip colors failed. {}", error);
}
} }
} };
Err(error) => { println!(
warn!("take screenshots failed. {}", error); "Time elapsed in expensive_function() is: {:?}",
} start.elapsed()
} );
});
} else { } else {
break; break;
} }
tokio::time::sleep_until(next_tick).await;
} }
Ok(()) Ok(())
} }
async fn follow_once() -> anyhow::Result<()> {
Picker::global().take_screenshots_for_all().await?;
let colors = Picker::global().get_led_strip_colors().await?;
let colors = colors.into_iter().rev().collect();
rpc::manager::Manager::global()
.publish_led_colors(&colors)
.await?;
Ok(())
}
} }

View File

@ -6,10 +6,7 @@ use tokio::sync::Mutex;
use crate::picker::screen::Screen; use crate::picker::screen::Screen;
use super::{ use super::{led_color::LedColor, screenshot::Screenshot};
led_color::LedColor,
screenshot::{Screenshot},
};
pub struct Picker { pub struct Picker {
pub screens: Arc<Mutex<Vec<Screen>>>, pub screens: Arc<Mutex<Vec<Screen>>>,

View File

@ -53,11 +53,11 @@ impl Screenshot {
match bitmap.as_ref() { match bitmap.as_ref() {
Some(bitmap) => { Some(bitmap) => {
let cell_size_x = self.width / self.led_number_of_x; let cell_size_x = self.width / self.led_number_of_x;
let cell_size_y = self.height / 5; let cell_size_y = self.height / 8;
let cell_size = cell_size_x * cell_size_y; let cell_size = cell_size_x * cell_size_y;
let y_range = match position { let y_range = match position {
XPosition::Top => 0..cell_size_y, XPosition::Top => 20..cell_size_y + 20,
XPosition::Bottom => self.height - cell_size_y..self.height, XPosition::Bottom => self.height - 20 - cell_size_y..self.height - 20,
}; };
let mut colors = Vec::new(); let mut colors = Vec::new();