| 82 | } |
| 83 | |
| 84 | async set(devices: readonly OverlayDisplayDevice[]): Promise<void> { |
| 85 | await this.#settings.put( |
| 86 | "global", |
| 87 | OverlayDisplay.SETTING_KEY, |
| 88 | OverlayDisplay.SETTING_FORMAT.stringify( |
| 89 | devices.map((device) => { |
| 90 | const flags: ( |
| 91 | | "secure" |
| 92 | | "own_content_only" |
| 93 | | "show_system_decorations" |
| 94 | )[] = []; |
| 95 | if (device.secure) { |
| 96 | flags.push("secure"); |
| 97 | } |
| 98 | if (device.ownContentOnly) { |
| 99 | flags.push("own_content_only"); |
| 100 | } |
| 101 | if (device.showSystemDecorations) { |
| 102 | flags.push("show_system_decorations"); |
| 103 | } |
| 104 | return { |
| 105 | modes: device.modes, |
| 106 | flags, |
| 107 | }; |
| 108 | }), |
| 109 | ), |
| 110 | ); |
| 111 | } |
| 112 | } |