Update Window state manager (#291)

* Update Window state

* Add x/y state saving
This commit is contained in:
smartfridge 2022-12-10 18:01:47 +00:00 committed by GitHub
parent e2fc0c6401
commit 254ba93433
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 267 additions and 147 deletions

2
.vscode/settings.json vendored Normal file
View file

@ -0,0 +1,2 @@
{
}

View file

@ -29,7 +29,7 @@
"@types/ws": "^8.5.3", "@types/ws": "^8.5.3",
"chalk-cli": "^5.0.0", "chalk-cli": "^5.0.0",
"copyfiles": "^2.4.1", "copyfiles": "^2.4.1",
"electron": "^21.3.0", "electron": "^22.0.0",
"electron-builder": "^23.6.0", "electron-builder": "^23.6.0",
"prettier": "^2.7.1", "prettier": "^2.7.1",
"typescript": "^4.9.3" "typescript": "^4.9.3"

View file

@ -8,7 +8,7 @@ specifiers:
chalk-cli: ^5.0.0 chalk-cli: ^5.0.0
copyfiles: ^2.4.1 copyfiles: ^2.4.1
cross-fetch: ^3.1.5 cross-fetch: ^3.1.5
electron: ^21.3.0 electron: ^22.0.0
electron-builder: ^23.6.0 electron-builder: ^23.6.0
electron-context-menu: github:ArmCord/electron-context-menu electron-context-menu: github:ArmCord/electron-context-menu
extract-zip: ^2.0.1 extract-zip: ^2.0.1
@ -18,7 +18,7 @@ specifiers:
ws: ^8.11.0 ws: ^8.11.0
dependencies: dependencies:
'@pyke/vibe': github.com/pykeio/vibe/11984868ce9e007859ed91ff159c7f7f0a34e7ae_electron@21.3.0 '@pyke/vibe': github.com/pykeio/vibe/11984868ce9e007859ed91ff159c7f7f0a34e7ae_electron@22.0.0
arrpc: file:src/arrpc arrpc: file:src/arrpc
cross-fetch: 3.1.5 cross-fetch: 3.1.5
electron-context-menu: github.com/ArmCord/electron-context-menu/280c81398c02a063f46e3285a9708d8db1a7ce32 electron-context-menu: github.com/ArmCord/electron-context-menu/280c81398c02a063f46e3285a9708d8db1a7ce32
@ -31,7 +31,7 @@ devDependencies:
'@types/ws': 8.5.3 '@types/ws': 8.5.3
chalk-cli: 5.0.0 chalk-cli: 5.0.0
copyfiles: 2.4.1 copyfiles: 2.4.1
electron: 21.3.0 electron: 22.0.0
electron-builder: 23.6.0 electron-builder: 23.6.0
prettier: 2.7.1 prettier: 2.7.1
typescript: 4.9.3 typescript: 4.9.3
@ -71,20 +71,19 @@ packages:
ajv-keywords: 3.5.2_ajv@6.12.6 ajv-keywords: 3.5.2_ajv@6.12.6
dev: true dev: true
/@electron/get/1.14.1: /@electron/get/2.0.2:
resolution: {integrity: sha512-BrZYyL/6m0ZXz/lDxy/nlVhQz+WF+iPS6qXolEU8atw7h6v1aYkjwJZ63m+bJMBTxDE66X+r2tPS4a/8C82sZw==} resolution: {integrity: sha512-eFZVFoRXb3GFGd7Ak7W4+6jBl9wBtiZ4AaYOse97ej6mKj5tkyO0dUnUChs1IhJZtx1BENo4/p4WUTXpi6vT+g==}
engines: {node: '>=8.6'} engines: {node: '>=12'}
dependencies: dependencies:
debug: 4.3.4 debug: 4.3.4
env-paths: 2.2.1 env-paths: 2.2.1
fs-extra: 8.1.0 fs-extra: 8.1.0
got: 9.6.0 got: 11.8.6
progress: 2.0.3 progress: 2.0.3
semver: 6.3.0 semver: 6.3.0
sumchecker: 3.0.1 sumchecker: 3.0.1
optionalDependencies: optionalDependencies:
global-agent: 3.0.0 global-agent: 3.0.0
global-tunnel-ng: 2.7.1
transitivePeerDependencies: transitivePeerDependencies:
- supports-color - supports-color
@ -122,21 +121,29 @@ packages:
- supports-color - supports-color
dev: true dev: true
/@sindresorhus/is/0.14.0: /@sindresorhus/is/4.6.0:
resolution: {integrity: sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==} resolution: {integrity: sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw==}
engines: {node: '>=6'} engines: {node: '>=10'}
/@szmarczak/http-timer/1.1.2: /@szmarczak/http-timer/4.0.6:
resolution: {integrity: sha512-XIB2XbzHTN6ieIjfIMV9hlVcfPU26s2vafYWQcZHWXHOxiaRZYEDKEwdl129Zyg50+foYV2jCgtrqSA6qNuNSA==} resolution: {integrity: sha512-4BAffykYOgO+5nzBWYwE3W90sBgLJoUPRWWcL8wlyiM8IB8ipJz3UMJ9KXQd1RKQXpKp8Tutn80HZtWsu2u76w==}
engines: {node: '>=6'} engines: {node: '>=10'}
dependencies: dependencies:
defer-to-connect: 1.1.3 defer-to-connect: 2.0.1
/@tootallnate/once/2.0.0: /@tootallnate/once/2.0.0:
resolution: {integrity: sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==} resolution: {integrity: sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==}
engines: {node: '>= 10'} engines: {node: '>= 10'}
dev: true dev: true
/@types/cacheable-request/6.0.3:
resolution: {integrity: sha512-IQ3EbTzGxIigb1I3qPZc1rWJnH0BmSKv5QYTalEwweFvyBDLSAe24zP0le/hyi7ecGfZVlIVAg4BZqb8WBwKqw==}
dependencies:
'@types/http-cache-semantics': 4.0.1
'@types/keyv': 3.1.4
'@types/node': 18.11.9
'@types/responselike': 1.0.0
/@types/debug/4.1.7: /@types/debug/4.1.7:
resolution: {integrity: sha512-9AonUzyTjXXhEOa0DnqpzZi6VHlqKMswga9EXjpXnnqxwLtdvPPtlO8evrI5D9S6asFRCQ6v+wpiUKbw+vKqyg==} resolution: {integrity: sha512-9AonUzyTjXXhEOa0DnqpzZi6VHlqKMswga9EXjpXnnqxwLtdvPPtlO8evrI5D9S6asFRCQ6v+wpiUKbw+vKqyg==}
dependencies: dependencies:
@ -158,6 +165,9 @@ packages:
dev: true dev: true
optional: true optional: true
/@types/http-cache-semantics/4.0.1:
resolution: {integrity: sha512-SZs7ekbP8CN0txVG2xVRH6EgKmEm31BOxA07vkFaETzZz1xh+cbt8BcI0slpymvwhx5dlFnQG2rTlPVQn+iRPQ==}
/@types/keyv/3.1.4: /@types/keyv/3.1.4:
resolution: {integrity: sha512-BQ5aZNSCpj7D6K2ksrRCTmKRLEpnPvWDiLPfoGyhZ++8YtiK9d/3DBKPJgry359X/P1PfruyYwvnvwFjuEiEIg==} resolution: {integrity: sha512-BQ5aZNSCpj7D6K2ksrRCTmKRLEpnPvWDiLPfoGyhZ++8YtiK9d/3DBKPJgry359X/P1PfruyYwvnvwFjuEiEIg==}
dependencies: dependencies:
@ -473,17 +483,21 @@ packages:
- supports-color - supports-color
dev: true dev: true
/cacheable-request/6.1.0: /cacheable-lookup/5.0.4:
resolution: {integrity: sha512-Oj3cAGPCqOZX7Rz64Uny2GYAZNliQSqfbePrgAQ1wKAihYmCUnraBtJtKcGR4xz7wF+LoJC+ssFZvv5BgF9Igg==} resolution: {integrity: sha512-2/kNscPhpcxrOigMZzbiWF7dz8ilhb/nIHU3EyZiXWXpeq/au8qJ8VhdftMkty3n7Gj6HIGalQG8oiBNB3AJgA==}
engines: {node: '>=10.6.0'}
/cacheable-request/7.0.2:
resolution: {integrity: sha512-pouW8/FmiPQbuGpkXQ9BAPv/Mo5xDGANgSNXzTzJ8DrKGuXOssM4wIQRjfanNRh3Yu5cfYPvcorqbhg2KIJtew==}
engines: {node: '>=8'} engines: {node: '>=8'}
dependencies: dependencies:
clone-response: 1.0.3 clone-response: 1.0.3
get-stream: 5.2.0 get-stream: 5.2.0
http-cache-semantics: 4.1.0 http-cache-semantics: 4.1.0
keyv: 3.1.0 keyv: 4.5.2
lowercase-keys: 2.0.0 lowercase-keys: 2.0.0
normalize-url: 4.5.1 normalize-url: 6.1.0
responselike: 1.0.2 responselike: 2.0.1
/camelcase-keys/7.0.2: /camelcase-keys/7.0.2:
resolution: {integrity: sha512-Rjs1H+A9R+Ig+4E/9oyB66UC5Mj9Xq3N//vcLf2WzgdTi/3gUu3Z9KoqmlrEG4VuuLK8wJHofxzdQXz/knhiYg==} resolution: {integrity: sha512-Rjs1H+A9R+Ig+4E/9oyB66UC5Mj9Xq3N//vcLf2WzgdTi/3gUu3Z9KoqmlrEG4VuuLK8wJHofxzdQXz/knhiYg==}
@ -629,13 +643,6 @@ packages:
resolution: {integrity: sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=} resolution: {integrity: sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=}
dev: true dev: true
/config-chain/1.1.13:
resolution: {integrity: sha512-qj+f8APARXHrM0hraqXYb2/bOVSV4PvJQlNZ/DVj0QrmNM2q2euizkeuVckQ57J+W0mRH6Hvi+k50M4Jul2VRQ==}
dependencies:
ini: 1.3.8
proto-list: 1.2.4
optional: true
/copyfiles/2.4.1: /copyfiles/2.4.1:
resolution: {integrity: sha512-fereAvAvxDrQDOXybk3Qu3dPbOoKoysFMWtkY3mv5BsL8//OSZVL5DCLYqgRfY5cWirgRzlC+WSrxp6Bo3eNZg==} resolution: {integrity: sha512-fereAvAvxDrQDOXybk3Qu3dPbOoKoysFMWtkY3mv5BsL8//OSZVL5DCLYqgRfY5cWirgRzlC+WSrxp6Bo3eNZg==}
hasBin: true hasBin: true
@ -724,14 +731,15 @@ packages:
engines: {node: '>=10'} engines: {node: '>=10'}
dev: true dev: true
/decompress-response/3.3.0: /decompress-response/6.0.0:
resolution: {integrity: sha512-BzRPQuY1ip+qDonAOz42gRm/pg9F768C+npV/4JOsxRC2sq+Rlk+Q4ZCAsOhnIaMrgarILY+RMUIvMmmX1qAEA==} resolution: {integrity: sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==}
engines: {node: '>=4'} engines: {node: '>=10'}
dependencies: dependencies:
mimic-response: 1.0.1 mimic-response: 3.1.0
/defer-to-connect/1.1.3: /defer-to-connect/2.0.1:
resolution: {integrity: sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ==} resolution: {integrity: sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg==}
engines: {node: '>=10'}
/define-properties/1.1.4: /define-properties/1.1.4:
resolution: {integrity: sha512-uckOqKcfaVvtBdsVkdPv3XjveQJsNQqmhXgRi8uhvWWuPYZCNlzT8qAyblUgNoXdHdjMTzAqeGjAoli8f+bzPA==} resolution: {integrity: sha512-uckOqKcfaVvtBdsVkdPv3XjveQJsNQqmhXgRi8uhvWWuPYZCNlzT8qAyblUgNoXdHdjMTzAqeGjAoli8f+bzPA==}
@ -809,9 +817,6 @@ packages:
engines: {node: '>=10'} engines: {node: '>=10'}
dev: true dev: true
/duplexer3/0.1.5:
resolution: {integrity: sha512-1A8za6ws41LQgv9HrE/66jyC5yuSjQ3L/KOpFtoBilsAK2iA2wuS5rTt1OCzIvtS2V7nVmedsUU+DGRcjBmOYA==}
/ejs/3.1.8: /ejs/3.1.8:
resolution: {integrity: sha512-/sXZeMlhS0ArkfX2Aw780gJzXSMPnKjtspYZv+f3NiKLlubezAHDU5+9xz6gd3/NhG3txQCo6xlglmTS+oTGEQ==} resolution: {integrity: sha512-/sXZeMlhS0ArkfX2Aw780gJzXSMPnKjtspYZv+f3NiKLlubezAHDU5+9xz6gd3/NhG3txQCo6xlglmTS+oTGEQ==}
engines: {node: '>=0.10.0'} engines: {node: '>=0.10.0'}
@ -883,13 +888,13 @@ packages:
- supports-color - supports-color
dev: true dev: true
/electron/21.3.0: /electron/22.0.0:
resolution: {integrity: sha512-MGRpshN8fBcx4IRuBABIsGDv0tB/MclIFsyFHFFXsBCUc+vIXaE/E6vuWaniGIFSz5WyeuapfTH5IeRb+7yIfw==} resolution: {integrity: sha512-cgRc4wjyM+81A0E8UGv1HNJjL1HBI5cWNh/DUIjzYvoUuiEM0SS0hAH/zaFQ18xOz2ced6Yih8SybpOiOYJhdg==}
engines: {node: '>= 10.17.0'} engines: {node: '>= 12.20.55'}
hasBin: true hasBin: true
requiresBuild: true requiresBuild: true
dependencies: dependencies:
'@electron/get': 1.14.1 '@electron/get': 2.0.2
'@types/node': 16.18.3 '@types/node': 16.18.3
extract-zip: 2.0.1 extract-zip: 2.0.1
transitivePeerDependencies: transitivePeerDependencies:
@ -898,11 +903,6 @@ packages:
/emoji-regex/8.0.0: /emoji-regex/8.0.0:
resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==}
/encodeurl/1.0.2:
resolution: {integrity: sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==}
engines: {node: '>= 0.8'}
optional: true
/end-of-stream/1.4.4: /end-of-stream/1.4.4:
resolution: {integrity: sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==} resolution: {integrity: sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==}
dependencies: dependencies:
@ -1074,12 +1074,6 @@ packages:
engines: {node: '>=12'} engines: {node: '>=12'}
dev: true dev: true
/get-stream/4.1.0:
resolution: {integrity: sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==}
engines: {node: '>=6'}
dependencies:
pump: 3.0.0
/get-stream/5.2.0: /get-stream/5.2.0:
resolution: {integrity: sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==} resolution: {integrity: sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==}
engines: {node: '>=8'} engines: {node: '>=8'}
@ -1110,17 +1104,6 @@ packages:
serialize-error: 7.0.1 serialize-error: 7.0.1
optional: true optional: true
/global-tunnel-ng/2.7.1:
resolution: {integrity: sha512-4s+DyciWBV0eK148wqXxcmVAbFVPqtc3sEtUE/GTQfuU80rySLcMhUmHKSHI7/LDj8q0gDYI1lIhRRB7ieRAqg==}
engines: {node: '>=0.10'}
requiresBuild: true
dependencies:
encodeurl: 1.0.2
lodash: 4.17.21
npm-conf: 1.1.3
tunnel: 0.0.6
optional: true
/globalthis/1.0.3: /globalthis/1.0.3:
resolution: {integrity: sha512-sFdI5LyBiNTHjRd7cGPWapiHWMOXKyuBNX/cWJ3NfzrZQVa8GI/8cofCl74AOVqq9W5kNmguTIzJ/1s2gyI9wA==} resolution: {integrity: sha512-sFdI5LyBiNTHjRd7cGPWapiHWMOXKyuBNX/cWJ3NfzrZQVa8GI/8cofCl74AOVqq9W5kNmguTIzJ/1s2gyI9wA==}
engines: {node: '>= 0.4'} engines: {node: '>= 0.4'}
@ -1128,23 +1111,21 @@ packages:
define-properties: 1.1.4 define-properties: 1.1.4
optional: true optional: true
/got/9.6.0: /got/11.8.6:
resolution: {integrity: sha512-R7eWptXuGYxwijs0eV+v3o6+XH1IqVK8dJOEecQfTmkncw9AV4dcw/Dhxi8MdlqPthxxpZyizMzyg8RTmEsG+Q==} resolution: {integrity: sha512-6tfZ91bOr7bOXnK7PRDCGBLa1H4U080YHNaAQ2KsMGlLEzRbk44nsZF2E1IeRc3vtJHPVbKCYgdFbaGO2ljd8g==}
engines: {node: '>=8.6'} engines: {node: '>=10.19.0'}
dependencies: dependencies:
'@sindresorhus/is': 0.14.0 '@sindresorhus/is': 4.6.0
'@szmarczak/http-timer': 1.1.2 '@szmarczak/http-timer': 4.0.6
'@types/keyv': 3.1.4 '@types/cacheable-request': 6.0.3
'@types/responselike': 1.0.0 '@types/responselike': 1.0.0
cacheable-request: 6.1.0 cacheable-lookup: 5.0.4
decompress-response: 3.3.0 cacheable-request: 7.0.2
duplexer3: 0.1.5 decompress-response: 6.0.0
get-stream: 4.1.0 http2-wrapper: 1.0.3
lowercase-keys: 1.0.1 lowercase-keys: 2.0.0
mimic-response: 1.0.1 p-cancelable: 2.1.1
p-cancelable: 1.1.0 responselike: 2.0.1
to-readable-stream: 1.0.0
url-parse-lax: 3.0.0
/graceful-fs/4.2.10: /graceful-fs/4.2.10:
resolution: {integrity: sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==} resolution: {integrity: sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==}
@ -1206,6 +1187,13 @@ packages:
- supports-color - supports-color
dev: true dev: true
/http2-wrapper/1.0.3:
resolution: {integrity: sha512-V+23sDMr12Wnz7iTcDeJr3O6AIxlnvT/bmaAAAP/Xda35C90p9599p0F1eHR/N1KILWSoWVAiOMFjBBXaXSMxg==}
engines: {node: '>=10.19.0'}
dependencies:
quick-lru: 5.1.1
resolve-alpn: 1.2.1
/https-proxy-agent/5.0.1: /https-proxy-agent/5.0.1:
resolution: {integrity: sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==} resolution: {integrity: sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==}
engines: {node: '>= 6'} engines: {node: '>= 6'}
@ -1256,10 +1244,6 @@ packages:
resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==}
dev: true dev: true
/ini/1.3.8:
resolution: {integrity: sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==}
optional: true
/is-arrayish/0.2.1: /is-arrayish/0.2.1:
resolution: {integrity: sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==} resolution: {integrity: sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==}
dev: true dev: true
@ -1336,8 +1320,8 @@ packages:
argparse: 2.0.1 argparse: 2.0.1
dev: true dev: true
/json-buffer/3.0.0: /json-buffer/3.0.1:
resolution: {integrity: sha512-CuUqjv0FUZIdXkHPI8MezCnFCdaTAacej1TZYulLoAg1h/PhwkdXFN4V/gzY4g+fMBCOV2xF+rp7t2XD2ns/NQ==} resolution: {integrity: sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==}
/json-parse-even-better-errors/2.3.1: /json-parse-even-better-errors/2.3.1:
resolution: {integrity: sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==} resolution: {integrity: sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==}
@ -1371,10 +1355,10 @@ packages:
graceful-fs: 4.2.10 graceful-fs: 4.2.10
dev: true dev: true
/keyv/3.1.0: /keyv/4.5.2:
resolution: {integrity: sha512-9ykJ/46SN/9KPM/sichzQ7OvXyGDYKGTaDlKMGCAlg2UK8KRy4jb0d8sFc+0Tt0YYnThq8X2RZgCg74RPxgcVA==} resolution: {integrity: sha512-5MHbFaKn8cNSmVW7BYnijeAVlE4cYA/SVkifVgrh7yotnfhKmjuXpDKjrABLnT0SfHWV21P8ow07OGfRrNDg8g==}
dependencies: dependencies:
json-buffer: 3.0.0 json-buffer: 3.0.1
/kind-of/6.0.3: /kind-of/6.0.3:
resolution: {integrity: sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==} resolution: {integrity: sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==}
@ -1398,10 +1382,7 @@ packages:
/lodash/4.17.21: /lodash/4.17.21:
resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==} resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==}
dev: true
/lowercase-keys/1.0.1:
resolution: {integrity: sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==}
engines: {node: '>=0.10.0'}
/lowercase-keys/2.0.0: /lowercase-keys/2.0.0:
resolution: {integrity: sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==} resolution: {integrity: sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==}
@ -1469,6 +1450,10 @@ packages:
resolution: {integrity: sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==} resolution: {integrity: sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==}
engines: {node: '>=4'} engines: {node: '>=4'}
/mimic-response/3.1.0:
resolution: {integrity: sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==}
engines: {node: '>=10'}
/min-indent/1.0.1: /min-indent/1.0.1:
resolution: {integrity: sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==} resolution: {integrity: sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==}
engines: {node: '>=4'} engines: {node: '>=4'}
@ -1574,17 +1559,9 @@ packages:
validate-npm-package-license: 3.0.4 validate-npm-package-license: 3.0.4
dev: true dev: true
/normalize-url/4.5.1: /normalize-url/6.1.0:
resolution: {integrity: sha512-9UZCFRHQdNrfTpGg8+1INIg93B6zE0aXMVFkw1WFwvO4SlZywU6aLg5Of0Ap/PgcbSw4LNxvMWXMeugwMCX0AA==} resolution: {integrity: sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A==}
engines: {node: '>=8'} engines: {node: '>=10'}
/npm-conf/1.1.3:
resolution: {integrity: sha512-Yic4bZHJOt9RCFbRP3GgpqhScOY4HH3V2P8yBj6CeYq118Qr+BLXqT2JvpJ00mryLESpgOxf5XlFv4ZjXxLScw==}
engines: {node: '>=4'}
dependencies:
config-chain: 1.1.13
pify: 3.0.0
optional: true
/object-keys/1.1.1: /object-keys/1.1.1:
resolution: {integrity: sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==} resolution: {integrity: sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==}
@ -1596,9 +1573,9 @@ packages:
dependencies: dependencies:
wrappy: 1.0.2 wrappy: 1.0.2
/p-cancelable/1.1.0: /p-cancelable/2.1.1:
resolution: {integrity: sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw==} resolution: {integrity: sha512-BZOr3nRQHOntUjTrH8+Lh54smKHoHyur8We1V8DSMVrl5A2malOOwuJRnKRDjSnkoeBh4at6BwEnb5I7Jl31wg==}
engines: {node: '>=6'} engines: {node: '>=8'}
/p-limit/3.1.0: /p-limit/3.1.0:
resolution: {integrity: sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==} resolution: {integrity: sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==}
@ -1641,11 +1618,6 @@ packages:
/pend/1.2.0: /pend/1.2.0:
resolution: {integrity: sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==} resolution: {integrity: sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==}
/pify/3.0.0:
resolution: {integrity: sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==}
engines: {node: '>=4'}
optional: true
/plist/3.0.6: /plist/3.0.6:
resolution: {integrity: sha512-WiIVYyrp8TD4w8yCvyeIr+lkmrGRd5u0VbRnU+tP/aRLxP/YadJUYOMZJ/6hIa3oUyVCsycXvtNRgd5XBJIbiA==} resolution: {integrity: sha512-WiIVYyrp8TD4w8yCvyeIr+lkmrGRd5u0VbRnU+tP/aRLxP/YadJUYOMZJ/6hIa3oUyVCsycXvtNRgd5XBJIbiA==}
engines: {node: '>=6'} engines: {node: '>=6'}
@ -1654,10 +1626,6 @@ packages:
xmlbuilder: 15.1.1 xmlbuilder: 15.1.1
dev: true dev: true
/prepend-http/2.0.0:
resolution: {integrity: sha512-ravE6m9Atw9Z/jjttRUZ+clIXogdghyZAuWJ3qEzjT+jI/dL1ifAqhZeC5VHzQp1MSt1+jxKkFNemj/iO7tVUA==}
engines: {node: '>=4'}
/prettier/2.7.1: /prettier/2.7.1:
resolution: {integrity: sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==} resolution: {integrity: sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==}
engines: {node: '>=10.13.0'} engines: {node: '>=10.13.0'}
@ -1672,10 +1640,6 @@ packages:
resolution: {integrity: sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==} resolution: {integrity: sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==}
engines: {node: '>=0.4.0'} engines: {node: '>=0.4.0'}
/proto-list/1.2.4:
resolution: {integrity: sha512-vtK/94akxsTMhe0/cbfpR+syPuszcuwhqVjJq26CuNDgFGj682oRBXOP5MJpv2r7JtE8MsiepGIqvvOTBwn2vA==}
optional: true
/pump/3.0.0: /pump/3.0.0:
resolution: {integrity: sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==} resolution: {integrity: sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==}
dependencies: dependencies:
@ -1698,7 +1662,6 @@ packages:
/quick-lru/5.1.1: /quick-lru/5.1.1:
resolution: {integrity: sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==} resolution: {integrity: sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==}
engines: {node: '>=10'} engines: {node: '>=10'}
dev: true
/read-config-file/6.2.0: /read-config-file/6.2.0:
resolution: {integrity: sha512-gx7Pgr5I56JtYz+WuqEbQHj/xWo+5Vwua2jhb1VwM4Wid5PqYmZ4i00ZB0YEGIfkVBsCv9UrjgyqCiQfS/Oosg==} resolution: {integrity: sha512-gx7Pgr5I56JtYz+WuqEbQHj/xWo+5Vwua2jhb1VwM4Wid5PqYmZ4i00ZB0YEGIfkVBsCv9UrjgyqCiQfS/Oosg==}
@ -1764,10 +1727,13 @@ packages:
engines: {node: '>=0.10.0'} engines: {node: '>=0.10.0'}
dev: true dev: true
/responselike/1.0.2: /resolve-alpn/1.2.1:
resolution: {integrity: sha512-/Fpe5guzJk1gPqdJLJR5u7eG/gNY4nImjbRDaVWVMRhne55TCmj2i9Q+54PBRfatRC8v/rIiv9BN0pMd9OV5EQ==} resolution: {integrity: sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g==}
/responselike/2.0.1:
resolution: {integrity: sha512-4gl03wn3hj1HP3yzgdI7d3lCkF95F21Pz4BPGvKHinyQzALR5CapwC8yIi0Rh58DEMQ/SguC03wFj2k0M/mHhw==}
dependencies: dependencies:
lowercase-keys: 1.0.1 lowercase-keys: 2.0.0
/rimraf/3.0.2: /rimraf/3.0.2:
resolution: {integrity: sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==} resolution: {integrity: sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==}
@ -2016,10 +1982,6 @@ packages:
rimraf: 3.0.2 rimraf: 3.0.2
dev: true dev: true
/to-readable-stream/1.0.0:
resolution: {integrity: sha512-Iq25XBt6zD5npPhlLVXGFN3/gyR2/qODcKNNyTMd4vbm39HUaOiAM4PMq0eMVC/Tkxz+Zjdsc55g9yyz+Yq00Q==}
engines: {node: '>=6'}
/tr46/0.0.3: /tr46/0.0.3:
resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==}
dev: false dev: false
@ -2035,11 +1997,6 @@ packages:
utf8-byte-length: 1.0.4 utf8-byte-length: 1.0.4
dev: true dev: true
/tunnel/0.0.6:
resolution: {integrity: sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==}
engines: {node: '>=0.6.11 <=0.7.0 || >=0.7.3'}
optional: true
/type-fest/0.13.1: /type-fest/0.13.1:
resolution: {integrity: sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg==} resolution: {integrity: sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg==}
engines: {node: '>=10'} engines: {node: '>=10'}
@ -2085,12 +2042,6 @@ packages:
punycode: 2.1.1 punycode: 2.1.1
dev: true dev: true
/url-parse-lax/3.0.0:
resolution: {integrity: sha512-NjFKA0DidqPa5ciFcSrXnAltTtzz84ogy+NebPvfEgAck0+TNg4UJ4IN+fB7zRZfbgUf0syOo9MDxFkDSMuFaQ==}
engines: {node: '>=4'}
dependencies:
prepend-http: 2.0.0
/utf8-byte-length/1.0.4: /utf8-byte-length/1.0.4:
resolution: {integrity: sha512-4+wkEYLBbWxqTahEsWrhxepcoVOJ+1z5PGIjPZxRkytcdSUaNjIjBM7Xn8E+pdSuV7SzvWovBFA54FO0JSoqhA==} resolution: {integrity: sha512-4+wkEYLBbWxqTahEsWrhxepcoVOJ+1z5PGIjPZxRkytcdSUaNjIjBM7Xn8E+pdSuV7SzvWovBFA54FO0JSoqhA==}
dev: true dev: true
@ -2234,7 +2185,7 @@ packages:
file:src/arrpc: file:src/arrpc:
resolution: {directory: src/arrpc, type: directory} resolution: {directory: src/arrpc, type: directory}
name: arrpc name: arrpc
version: 1.1.0 version: 3.0.0
dependencies: dependencies:
ws: 8.11.0 ws: 8.11.0
transitivePeerDependencies: transitivePeerDependencies:
@ -2252,7 +2203,7 @@ packages:
electron-is-dev: 2.0.0 electron-is-dev: 2.0.0
dev: false dev: false
github.com/pykeio/vibe/11984868ce9e007859ed91ff159c7f7f0a34e7ae_electron@21.3.0: github.com/pykeio/vibe/11984868ce9e007859ed91ff159c7f7f0a34e7ae_electron@22.0.0:
resolution: {tarball: https://codeload.github.com/pykeio/vibe/tar.gz/11984868ce9e007859ed91ff159c7f7f0a34e7ae} resolution: {tarball: https://codeload.github.com/pykeio/vibe/tar.gz/11984868ce9e007859ed91ff159c7f7f0a34e7ae}
id: github.com/pykeio/vibe/11984868ce9e007859ed91ff159c7f7f0a34e7ae id: github.com/pykeio/vibe/11984868ce9e007859ed91ff159c7f7f0a34e7ae
name: '@pyke/vibe' name: '@pyke/vibe'
@ -2262,5 +2213,5 @@ packages:
electron: '>=11.0' electron: '>=11.0'
dependencies: dependencies:
cargo-cp-artifact: 0.1.7 cargo-cp-artifact: 0.1.7
electron: 21.3.0 electron: 22.0.0
dev: false dev: false

View file

@ -56,7 +56,7 @@
} else if (armcordinternal.installState === "modDownload") { } else if (armcordinternal.installState === "modDownload") {
text.innerHTML = "Updating " + armcord.mods; text.innerHTML = "Updating " + armcord.mods;
} else if (armcordinternal.installState === "none") { } else if (armcordinternal.installState === "none") {
text.innerHTML = "Nothing to install. Starting ArmCord"; text.innerHTML = "Nothing to install.";
return true; return true;
} else { } else {
return true; return true;

View file

@ -1,5 +1,5 @@
//ipc stuff //ipc stuff
import {app, ipcMain, shell, desktopCapturer, nativeImage} from "electron"; import {app, ipcMain, shell, desktopCapturer, nativeImage, screen} from "electron";
import {mainWindow} from "./window"; import {mainWindow} from "./window";
import { import {
setConfigBulk, setConfigBulk,
@ -87,6 +87,8 @@ export function registerIpc() {
var width = (await getWindowState("width")) ?? 800; var width = (await getWindowState("width")) ?? 800;
var height = (await getWindowState("height")) ?? 600; var height = (await getWindowState("height")) ?? 600;
var isMaximized = (await getWindowState("isMaximized")) ?? false; var isMaximized = (await getWindowState("isMaximized")) ?? false;
var xValue = await getWindowState("x");
var yValue = await getWindowState("y");
} catch (e) { } catch (e) {
console.log("[Window state manager] No window state file found. Fallbacking to default values."); console.log("[Window state manager] No window state file found. Fallbacking to default values.");
mainWindow.setSize(800, 600); mainWindow.setSize(800, 600);
@ -96,6 +98,7 @@ export function registerIpc() {
mainWindow.maximize(); mainWindow.maximize();
} else { } else {
mainWindow.setSize(width, height); mainWindow.setSize(width, height);
mainWindow.setPosition(xValue, yValue);
console.log("[Window state manager] Not maximized."); console.log("[Window state manager] Not maximized.");
} }
}); });

111
src/preload/alt.ts Normal file
View file

@ -0,0 +1,111 @@
import {ipcRenderer} from "electron";
import "./bridge";
import "./capturer";
import "./patch";
import * as fs from "fs";
import * as path from "path";
import {fixTitlebar, injectHummusTitlebar, injectTitlebar} from "./titlebar";
import {sleep, addStyle, addScript} from "../utils";
import {injectMobileStuff} from "./mobile";
var version = ipcRenderer.sendSync("displayVersion");
var channel = ipcRenderer.sendSync("channel");
async function updateLang() {
if (window.location.href.indexOf("setup.html") > -1) {
console.log("Setup, skipping lang update");
} else {
const value = `; ${document.cookie}`;
const parts: any = value.split(`; locale=`);
if (parts.length === 2) ipcRenderer.send("setLang", parts.pop().split(";").shift());
}
}
declare global {
interface Window {
armcord: any;
}
}
console.log("ArmCord " + version);
ipcRenderer.on("themeLoader", (event, message) => {
addStyle(message);
});
if (window.location.href.indexOf("splash.html") > -1) {
console.log("Skipping titlebar injection and client mod injection.");
} else {
if (ipcRenderer.sendSync("titlebar")) {
if (channel == "hummus") {
injectHummusTitlebar();
} else {
injectTitlebar();
}
}
if (ipcRenderer.sendSync("mobileMode")) {
injectMobileStuff();
}
sleep(5000).then(async () => {
// dirty hack to make clicking notifications focus ArmCord
addScript(`
(() => {
const originalSetter = Object.getOwnPropertyDescriptor(Notification.prototype, "onclick").set;
Object.defineProperty(Notification.prototype, "onclick", {
set(onClick) {
originalSetter.call(this, function() {
onClick.apply(this, arguments);
armcord.window.show();
})
},
configurable: true
});
})();
`);
addScript(fs.readFileSync(path.join(__dirname, "../", "/content/js/rpc.js"), "utf8"));
const cssPath = path.join(__dirname, "../", "/content/css/discord.css");
addStyle(fs.readFileSync(cssPath, "utf8"));
if (document.getElementById("window-controls-container") == null) {
console.warn("Titlebar didn't inject, retrying...");
if (ipcRenderer.sendSync("titlebar")) {
if (channel == "hummus") {
injectHummusTitlebar();
} else {
fixTitlebar();
}
}
}
await updateLang();
});
}
/*
MIT License
Copyright (c) 2022 GooseNest
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
// Settings info version injection
setInterval(() => {
const host = document.getElementsByClassName("info-3pQQBb")[0];
if (!host || document.querySelector("#ac-ver")) return;
const el = document.createElement("span");
el.id = "ac-ver";
el.classList.add("text-xs-normal-3SiVjE", "line-18uChy");
el.textContent = `\nArmCord Version: ${version}`;
el.onclick = () => ipcRenderer.send("openSettingsWindow");
host.append(el);
}, 2000);

View file

@ -102,3 +102,45 @@ export function injectHummusTitlebar() {
}); });
}); });
} }
export function fixTitlebar() {
var elem = document.createElement("div");
elem.innerHTML = `<nav class="titlebar">
<div class="window-title" id="window-title"></div>
<div id="window-controls-container">
<div id="spacer"></div>
<div id="minimize"><div id="minimize-icon"></div></div>
<div id="maximize"><div id="maximize-icon"></div></div>
<div id="quit"><div id="quit-icon"></div></div>
</div>
</nav>`;
elem.classList.add("withFrame-haYltI");
if (document.getElementById("app-mount") == null) {
document.body.appendChild(elem);
} else {
document.getElementById("app-mount")!.prepend(elem);
}
var minimize = document.getElementById("minimize");
var maximize = document.getElementById("maximize");
var quit = document.getElementById("quit");
minimize!.addEventListener("click", () => {
ipcRenderer.send("win-minimize");
});
maximize!.addEventListener("click", () => {
if (ipcRenderer.sendSync("win-isMaximized") == true) {
ipcRenderer.send("win-unmaximize");
document.body.removeAttribute("isMaximized");
} else if (ipcRenderer.sendSync("win-isNormal") == true) {
ipcRenderer.send("win-maximize");
}
});
quit!.addEventListener("click", () => {
if (ipcRenderer.sendSync("minimizeToTray") === true) {
ipcRenderer.send("win-hide");
} else if (ipcRenderer.sendSync("minimizeToTray") === false) {
ipcRenderer.send("win-quit");
}
});
}

View file

@ -17,7 +17,7 @@ import fs from "fs";
import {mainWindow} from "../window"; import {mainWindow} from "../window";
var settingsWindow: BrowserWindow; var settingsWindow: BrowserWindow;
var instance: number = 0; var instance: number = 0;
checkForDataFolder(); //checkForDataFolder();
const userDataPath = app.getPath("userData"); const userDataPath = app.getPath("userData");
const storagePath = path.join(userDataPath, "/storage/"); const storagePath = path.join(userDataPath, "/storage/");
const themesPath = path.join(userDataPath, "/themes/"); const themesPath = path.join(userDataPath, "/themes/");

View file

@ -56,7 +56,13 @@ app.whenReady().then(async () => {
label: `Quit ${clientName}`, label: `Quit ${clientName}`,
click: function () { click: function () {
let [width, height] = mainWindow.getSize(); let [width, height] = mainWindow.getSize();
setWindowState({width: width, height: height, isMaximized: mainWindow.isMaximized()}); setWindowState({
width: width,
height: height,
isMaximized: mainWindow.isMaximized(),
x: mainWindow.getPosition()[0],
y: mainWindow.getPosition()[1]
});
app.quit(); app.quit();
} }
} }

View file

@ -1,5 +1,5 @@
import * as fs from "fs"; import * as fs from "fs";
import {app, dialog, session} from "electron"; import {app, dialog, Rectangle} from "electron";
import path from "path"; import path from "path";
import fetch from "cross-fetch"; import fetch from "cross-fetch";
import extract from "extract-zip"; import extract from "extract-zip";
@ -199,6 +199,8 @@ export async function getLangName() {
export interface WindowState { export interface WindowState {
width: number; width: number;
height: number; height: number;
x: number;
y: number;
isMaximized: boolean; isMaximized: boolean;
} }
export async function setWindowState(object: WindowState) { export async function setWindowState(object: WindowState) {
@ -217,7 +219,8 @@ export async function getWindowState(object: string) {
const settingsFile = storagePath + "window.json"; const settingsFile = storagePath + "window.json";
let rawdata = fs.readFileSync(settingsFile, "utf-8"); let rawdata = fs.readFileSync(settingsFile, "utf-8");
let returndata = JSON.parse(rawdata); let returndata = JSON.parse(rawdata);
console.log("[Window state manager] " + object + ": " + returndata[object]); console.log(returndata);
console.log("[Window state manager] " + returndata);
return returndata[object]; return returndata[object];
} }
//ArmCord Settings/Storage manager //ArmCord Settings/Storage manager

View file

@ -178,7 +178,9 @@ async function doAfterDefiningTheWindow() {
await setWindowState({ await setWindowState({
width: width, width: width,
height: height, height: height,
isMaximized: mainWindow.isMaximized() isMaximized: mainWindow.isMaximized(),
x: mainWindow.getPosition()[0],
y: mainWindow.getPosition()[1]
}); });
if (await getConfig("minimizeToTray")) { if (await getConfig("minimizeToTray")) {
e.preventDefault(); e.preventDefault();