-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[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 <[email protected]>
- Loading branch information
1 parent
e80ee2e
commit cd5dc09
Showing
7 changed files
with
84 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
apps/desktop/src/platform/services/desktop-settings.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters