diff options
Diffstat (limited to 'gui/src')
| -rw-r--r-- | gui/src/main/daemon-rpc.ts | 4 | ||||
| -rw-r--r-- | gui/src/main/index.ts | 14 |
2 files changed, 18 insertions, 0 deletions
diff --git a/gui/src/main/daemon-rpc.ts b/gui/src/main/daemon-rpc.ts index ac677f4ded..c00508dc57 100644 --- a/gui/src/main/daemon-rpc.ts +++ b/gui/src/main/daemon-rpc.ts @@ -501,6 +501,10 @@ export class DaemonRpc { await this.callBool(this.client.setSplitTunnelState, enabled); } + public async checkVolumes(): Promise<void> { + await this.callEmpty(this.client.checkVolumes); + } + private subscriptionId(): number { const current = this.nextSubscriptionId; this.nextSubscriptionId += 1; diff --git a/gui/src/main/index.ts b/gui/src/main/index.ts index a9daa98367..5b7504e711 100644 --- a/gui/src/main/index.ts +++ b/gui/src/main/index.ts @@ -1857,6 +1857,20 @@ class ApplicationMain { // https://github.com/electron/electron/blob/main/docs/faq.md#the-font-looks-blurry-what-is-this-and-what-can-i-do backgroundColor: '#fff', }); + const WM_DEVICECHANGE = 0x0219; + const DBT_DEVICEARRIVAL = 0x8000; + const DBT_DEVICEREMOVECOMPLETE = 0x8004; + appWindow.hookWindowMessage(WM_DEVICECHANGE, (wParam) => { + const wParamL = wParam.readBigInt64LE(0); + if (wParamL != DBT_DEVICEARRIVAL && wParamL != DBT_DEVICEREMOVECOMPLETE) { + return; + } + this.daemonRpc + .checkVolumes() + .catch((error) => + log.error(`Unable to notify daemon of device event: ${error.message}`), + ); + }); appWindow.removeMenu(); |
