diff options
| author | David Lönnhager <david.l@mullvad.net> | 2022-02-01 11:57:52 +0100 |
|---|---|---|
| committer | David Lönnhager <david.l@mullvad.net> | 2022-02-08 17:43:12 +0100 |
| commit | e2f7cf1ba90fa59ea04d26dae28ae576db92bb07 (patch) | |
| tree | c20956d1bb25f8703186171d97059fd23d6e1cec /gui/src/main | |
| parent | 022874449ba862aba6788bb430099923ba8a1a6c (diff) | |
| download | mullvadvpn-e2f7cf1ba90fa59ea04d26dae28ae576db92bb07.tar.xz mullvadvpn-e2f7cf1ba90fa59ea04d26dae28ae576db92bb07.zip | |
Reapply excluded paths when the frontend receives messages for device
arrivals or removals
Diffstat (limited to 'gui/src/main')
| -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(); |
