mirror of
https://github.com/bitwarden/browser
synced 2026-01-03 17:13:47 +00:00
[PM-3316] Feature addition - Toggle Hardware Acceleration [Desktop] (#5968)
Added a toggle for disabling/enabling hardware acceleration on Desktop client. Resolves #2615 --------- Co-authored-by: Hinton <hinton@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import { map } from "rxjs";
|
||||
|
||||
import {
|
||||
DESKTOP_SETTINGS_DISK,
|
||||
KeyDefinition,
|
||||
StateProvider,
|
||||
} from "@bitwarden/common/platform/state";
|
||||
|
||||
export const HARDWARE_ACCELERATION = new KeyDefinition<boolean>(
|
||||
DESKTOP_SETTINGS_DISK,
|
||||
"hardwareAcceleration",
|
||||
{
|
||||
deserializer: (v: boolean) => v,
|
||||
},
|
||||
);
|
||||
|
||||
export class DesktopSettingsService {
|
||||
private hwState = this.stateProvider.getGlobal(HARDWARE_ACCELERATION);
|
||||
hardwareAcceleration$ = this.hwState.state$.pipe(map((v) => v ?? true));
|
||||
|
||||
constructor(private stateProvider: StateProvider) {}
|
||||
|
||||
async setHardwareAcceleration(enabled: boolean) {
|
||||
await this.hwState.update(() => enabled);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user