halley-config 0.3.2

Configuration loading and parsing for the Halley Wayland compositor.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
use halley_core::cluster_layout::ClusterWorkspaceLayoutKind;
use halley_core::viewport::FocusRing;
use regex::Regex;

#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum NodeBorderColorMode {
    UseWindowActive,
    UseWindowInactive,
    UseWindowSecondaryActive,
    UseWindowSecondaryInactive,
}

#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum NodeDisplayPolicy {
    Off,
    Hover,
    Always,
}

#[derive(Clone, Copy, Debug, PartialEq)]
pub enum NodeBackgroundColorMode {
    Auto,
    Theme,
    Light,
    Dark,
    Fixed { r: f32, g: f32, b: f32 },
}

#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum ShapeStyle {
    Square,
    Squircle,
}

#[derive(Clone, Copy, Debug, PartialEq)]
pub enum OverlayColorMode {
    Auto,
    Light,
    Dark,
    Fixed { r: f32, g: f32, b: f32 },
}

#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum OverlayShape {
    Square,
    Rounded,
}

#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum OverlayBorderSource {
    Primary,
    Secondary,
}

#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum PinBadgeCorner {
    TopLeft,
    TopRight,
}

#[derive(Clone, Copy, Debug, PartialEq)]
pub struct PinsConfig {
    pub corner: PinBadgeCorner,
    pub color: OverlayColorMode,
    pub background_color: OverlayColorMode,
    pub size: f32,
}

impl Default for PinsConfig {
    fn default() -> Self {
        Self {
            corner: PinBadgeCorner::TopRight,
            color: OverlayColorMode::Auto,
            background_color: OverlayColorMode::Auto,
            size: 1.0,
        }
    }
}

#[derive(Clone, Copy, Debug, PartialEq)]
pub struct OverlayStyleConfig {
    pub background_color: OverlayColorMode,
    pub text_color: OverlayColorMode,
    pub error_color: OverlayColorMode,
    pub shape: OverlayShape,
    pub borders: bool,
    pub border_source: OverlayBorderSource,
}

impl Default for OverlayStyleConfig {
    fn default() -> Self {
        Self {
            background_color: OverlayColorMode::Auto,
            text_color: OverlayColorMode::Auto,
            error_color: OverlayColorMode::Fixed {
                r: 0xfb as f32 / 255.0,
                g: 0x49 as f32 / 255.0,
                b: 0x34 as f32 / 255.0,
            },
            shape: OverlayShape::Square,
            borders: true,
            border_source: OverlayBorderSource::Primary,
        }
    }
}

#[derive(Clone, Copy, Debug, PartialEq)]
pub struct DebugConfig {
    pub overlay_fps: bool,
    pub show_ring_when_resizing: bool,
}

impl Default for DebugConfig {
    fn default() -> Self {
        Self {
            overlay_fps: false,
            show_ring_when_resizing: true,
        }
    }
}

#[derive(Clone, Copy, Debug, PartialEq)]
pub struct AnimationToggleConfig {
    pub enabled: bool,
}

impl Default for AnimationToggleConfig {
    fn default() -> Self {
        Self { enabled: true }
    }
}

#[derive(Clone, Copy, Debug, PartialEq)]
pub struct TimedAnimationConfig {
    pub enabled: bool,
    pub duration_ms: u64,
}

impl TimedAnimationConfig {
    pub const fn new(enabled: bool, duration_ms: u64) -> Self {
        Self {
            enabled,
            duration_ms,
        }
    }
}

#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum WindowCloseAnimationStyle {
    Shrink,
    Fade,
}

#[derive(Clone, Copy, Debug, PartialEq)]
pub struct WindowCloseAnimationConfig {
    pub enabled: bool,
    pub duration_ms: u64,
    pub style: WindowCloseAnimationStyle,
}

#[derive(Clone, Copy, Debug, PartialEq)]
pub struct RaiseAnimationConfig {
    pub enabled: bool,
    pub duration_ms: u64,
    pub scale: f32,
    pub shadow_boost: f32,
}

impl RaiseAnimationConfig {
    pub const fn new(enabled: bool, duration_ms: u64, scale: f32, shadow_boost: f32) -> Self {
        Self {
            enabled,
            duration_ms,
            scale,
            shadow_boost,
        }
    }
}

impl WindowCloseAnimationConfig {
    pub const fn new(enabled: bool, duration_ms: u64, style: WindowCloseAnimationStyle) -> Self {
        Self {
            enabled,
            duration_ms,
            style,
        }
    }
}

#[derive(Clone, Copy, Debug, PartialEq)]
pub struct AnimationsConfig {
    pub enabled: bool,
    pub smooth_resize: TimedAnimationConfig,
    pub maximize: TimedAnimationConfig,
    pub fullscreen: TimedAnimationConfig,
    pub window_close: WindowCloseAnimationConfig,
    pub window_open: TimedAnimationConfig,
    pub tile: TimedAnimationConfig,
    pub stack: TimedAnimationConfig,
    pub raise: RaiseAnimationConfig,
}

impl Default for AnimationsConfig {
    fn default() -> Self {
        Self {
            enabled: true,
            smooth_resize: TimedAnimationConfig::new(true, 90),
            maximize: TimedAnimationConfig::new(true, 240),
            fullscreen: TimedAnimationConfig::new(true, 240),
            window_close: WindowCloseAnimationConfig::new(
                true,
                250,
                WindowCloseAnimationStyle::Shrink,
            ),
            window_open: TimedAnimationConfig::new(true, 620),
            tile: TimedAnimationConfig::new(true, 240),
            stack: TimedAnimationConfig::new(true, 220),
            raise: RaiseAnimationConfig::new(true, 140, 1.025, 0.18),
        }
    }
}

#[derive(Clone, Debug, PartialEq)]
pub struct ScreenshotConfig {
    pub directory: String,
    pub highlight_color: OverlayColorMode,
    pub background_color: OverlayColorMode,
}

impl Default for ScreenshotConfig {
    fn default() -> Self {
        let home = std::env::var("HOME").unwrap_or_else(|_| ".".to_string());
        Self {
            directory: format!("{home}/Pictures/Screenshots"),
            highlight_color: OverlayColorMode::Auto,
            background_color: OverlayColorMode::Auto,
        }
    }
}

#[derive(Clone, Copy, Debug, PartialEq)]
pub struct DecorationBorderColor {
    pub r: f32,
    pub g: f32,
    pub b: f32,
}

#[derive(Clone, Copy, Debug, PartialEq)]
pub struct PrimaryBorderConfig {
    pub size_px: i32,
    pub radius_px: i32,
    pub color_focused: DecorationBorderColor,
    pub color_unfocused: DecorationBorderColor,
}

#[derive(Clone, Copy, Debug, PartialEq)]
pub struct SecondaryBorderConfig {
    pub enabled: bool,
    pub size_px: i32,
    pub gap_px: i32,
    pub color_focused: DecorationBorderColor,
    pub color_unfocused: DecorationBorderColor,
}

#[derive(Clone, Copy, Debug, PartialEq)]
pub struct ShadowColor {
    pub r: f32,
    pub g: f32,
    pub b: f32,
    pub a: f32,
}

#[derive(Clone, Copy, Debug, PartialEq)]
pub struct ShadowLayerConfig {
    pub enabled: bool,
    pub blur_radius: f32,
    pub spread: f32,
    pub offset_x: f32,
    pub offset_y: f32,
    pub color: ShadowColor,
}

#[derive(Clone, Copy, Debug, PartialEq)]
pub struct ShadowsConfig {
    pub window: ShadowLayerConfig,
    pub node: ShadowLayerConfig,
    pub overlay: ShadowLayerConfig,
}

#[derive(Clone, Copy, Debug, PartialEq)]
pub struct DecorationsConfig {
    pub border: PrimaryBorderConfig,
    pub secondary_border: SecondaryBorderConfig,
    pub shadows: ShadowsConfig,
    pub resize_using_border: bool,
}

impl Default for PrimaryBorderConfig {
    fn default() -> Self {
        Self {
            size_px: 3,
            radius_px: 0,
            color_focused: DecorationBorderColor {
                r: 0.22,
                g: 0.82,
                b: 0.92,
            },
            color_unfocused: DecorationBorderColor {
                r: 0.28,
                g: 0.30,
                b: 0.35,
            },
        }
    }
}

impl Default for SecondaryBorderConfig {
    fn default() -> Self {
        Self {
            enabled: false,
            size_px: 1,
            gap_px: 2,
            color_focused: DecorationBorderColor {
                r: 0.98,
                g: 0.74,
                b: 0.15,
            },
            color_unfocused: DecorationBorderColor {
                r: 0.12,
                g: 0.12,
                b: 0.12,
            },
        }
    }
}

impl Default for ShadowsConfig {
    fn default() -> Self {
        Self {
            window: ShadowLayerConfig {
                enabled: true,
                blur_radius: 8.0,
                spread: 0.0,
                offset_x: 0.0,
                offset_y: 5.0,
                color: ShadowColor {
                    r: 0x05 as f32 / 255.0,
                    g: 0x03 as f32 / 255.0,
                    b: 0x05 as f32 / 255.0,
                    a: 0x30 as f32 / 255.0,
                },
            },
            node: ShadowLayerConfig {
                enabled: true,
                blur_radius: 14.0,
                spread: 0.0,
                offset_x: 0.0,
                offset_y: 3.0,
                color: ShadowColor {
                    r: 0x05 as f32 / 255.0,
                    g: 0x03 as f32 / 255.0,
                    b: 0x05 as f32 / 255.0,
                    a: 0x24 as f32 / 255.0,
                },
            },
            overlay: ShadowLayerConfig {
                enabled: true,
                blur_radius: 24.0,
                spread: 1.0,
                offset_x: 0.0,
                offset_y: 7.0,
                color: ShadowColor {
                    r: 0x05 as f32 / 255.0,
                    g: 0x03 as f32 / 255.0,
                    b: 0x05 as f32 / 255.0,
                    a: 0x38 as f32 / 255.0,
                },
            },
        }
    }
}

impl Default for DecorationsConfig {
    fn default() -> Self {
        Self {
            border: PrimaryBorderConfig::default(),
            secondary_border: SecondaryBorderConfig::default(),
            shadows: ShadowsConfig::default(),
            resize_using_border: false,
        }
    }
}

#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum PanToNewMode {
    Never,
    IfNeeded,
    Always,
}

#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum ExpandedPlacementStrategy {
    Center,
    FindEmpty,
}

#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum FindEmptyMode {
    BestEffort,
}

#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum LandmarkPlacementStrategy {
    NearestFree,
}

#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum NormalBlockerPolicy {
    Relocate,
}

#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum PinnedBlockerPolicy {
    Preserve,
}

#[derive(Clone, Debug, Eq, PartialEq)]
pub struct ExpandedPlacementConfig {
    pub strategy: ExpandedPlacementStrategy,
    pub fallback: ExpandedPlacementStrategy,
    pub find_empty_mode: FindEmptyMode,
}

impl Default for ExpandedPlacementConfig {
    fn default() -> Self {
        Self {
            strategy: ExpandedPlacementStrategy::FindEmpty,
            fallback: ExpandedPlacementStrategy::Center,
            find_empty_mode: FindEmptyMode::BestEffort,
        }
    }
}

#[derive(Clone, Debug, Eq, PartialEq)]
pub struct LandmarkPlacementConfig {
    pub strategy: LandmarkPlacementStrategy,
    pub normal_blocker: NormalBlockerPolicy,
    pub pinned_blocker: PinnedBlockerPolicy,
}

impl Default for LandmarkPlacementConfig {
    fn default() -> Self {
        Self {
            strategy: LandmarkPlacementStrategy::NearestFree,
            normal_blocker: NormalBlockerPolicy::Relocate,
            pinned_blocker: PinnedBlockerPolicy::Preserve,
        }
    }
}

#[derive(Clone, Debug, PartialEq)]
pub struct PlacementRevealConfig {
    pub enabled: bool,
    pub max_pan_px: f32,
    pub animation_ms: u64,
}

impl Default for PlacementRevealConfig {
    fn default() -> Self {
        Self {
            enabled: true,
            max_pan_px: 360.0,
            animation_ms: 180,
        }
    }
}

#[derive(Clone, Debug, PartialEq)]
pub struct PlacementConfig {
    pub expanded: ExpandedPlacementConfig,
    pub landmarks: LandmarkPlacementConfig,
    pub reveal: PlacementRevealConfig,
}

impl Default for PlacementConfig {
    fn default() -> Self {
        Self {
            expanded: ExpandedPlacementConfig::default(),
            landmarks: LandmarkPlacementConfig::default(),
            reveal: PlacementRevealConfig::default(),
        }
    }
}

#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum CloseRestorePanMode {
    Never,
    IfOffscreen,
    Always,
}

#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum ClickCollapsedOutsideFocusMode {
    Ignore,
    Activate,
}

#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum ClickCollapsedPanMode {
    Never,
    IfOffscreen,
    Always,
}

#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum InputFocusMode {
    Click,
    Hover,
}

#[derive(Clone, Debug, Eq, PartialEq)]
pub struct KeyboardConfig {
    pub layout: String,
    pub variant: String,
    pub options: String,
}

impl Default for KeyboardConfig {
    fn default() -> Self {
        Self {
            layout: "us".to_string(),
            variant: String::new(),
            options: String::new(),
        }
    }
}

#[derive(Clone, Debug, Eq, PartialEq)]
pub struct InputConfig {
    pub repeat_rate: i32,
    pub repeat_delay: i32,
    pub focus_mode: InputFocusMode,
    pub raise_on_click: bool,
    pub keyboard: KeyboardConfig,
}

impl Default for InputConfig {
    fn default() -> Self {
        Self {
            repeat_rate: 30,
            repeat_delay: 500,
            focus_mode: InputFocusMode::Click,
            raise_on_click: true,
            keyboard: KeyboardConfig::default(),
        }
    }
}

#[derive(Clone, Copy, Debug, PartialEq)]
pub struct FocusRingConfig {
    pub rx: f32,
    pub ry: f32,
    pub offset_x: f32,
    pub offset_y: f32,
}

impl FocusRingConfig {
    pub fn to_focus_ring(self) -> FocusRing {
        FocusRing::new(self.rx, self.ry, self.offset_x, self.offset_y)
    }
}

#[derive(Clone, Copy, Debug, PartialEq)]
pub struct BearingsConfig {
    pub show_distance: bool,
    pub show_icons: bool,
    pub show_pinned: bool,
    pub fade_distance: f32,
}

#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum RailPlacement {
    Up,
    Down,
    Left,
    Right,
}

#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum RailSizingMode {
    Fixed,
    GrowToContent,
}

#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum RailObstructionBehavior {
    AutoHide,
    StayOnTop,
    StayUnder,
}

#[derive(Clone, Copy, Debug, PartialEq)]
pub struct RailConfig {
    pub enabled: bool,
    pub placement: RailPlacement,
    pub background_color: OverlayColorMode,
    pub foreground_color: OverlayColorMode,
    pub divider_color: OverlayColorMode,
    pub offset_x: i32,
    pub offset_y: i32,
    pub width: i32,
    pub height: i32,
    pub sizing: RailSizingMode,
    pub icon_size: i32,
    pub gap: i32,
    pub padding: i32,
    pub radius: i32,
    pub pinned_separator: bool,
    pub obstruction: RailObstructionBehavior,
}

impl Default for RailConfig {
    fn default() -> Self {
        Self {
            enabled: true,
            placement: RailPlacement::Down,
            background_color: OverlayColorMode::Auto,
            foreground_color: OverlayColorMode::Auto,
            divider_color: OverlayColorMode::Auto,
            offset_x: 0,
            offset_y: 18,
            width: 0,
            height: 56,
            sizing: RailSizingMode::GrowToContent,
            icon_size: 34,
            gap: 8,
            padding: 10,
            radius: 18,
            pinned_separator: true,
            obstruction: RailObstructionBehavior::AutoHide,
        }
    }
}

#[derive(Clone, Debug, Eq, PartialEq)]
pub struct CursorConfig {
    pub theme: String,
    pub size: u32,
    pub hide_while_typing: bool,
    pub hide_after_ms: u64,
}

impl Default for CursorConfig {
    fn default() -> Self {
        Self {
            theme: "Adwaita".to_string(),
            size: 24,
            hide_while_typing: false,
            hide_after_ms: 0,
        }
    }
}

#[derive(Clone, Debug, Eq, PartialEq)]
pub struct FontConfig {
    pub family: String,
    pub size: u32,
}

impl Default for FontConfig {
    fn default() -> Self {
        Self {
            family: "monospace".to_string(),
            size: 11,
        }
    }
}

#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum ClusterBloomDirection {
    Clockwise,
    CounterClockwise,
}

#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum ClusterDefaultLayout {
    Tiling,
    Stacking,
}

impl ClusterDefaultLayout {
    pub fn to_workspace_layout_kind(self) -> ClusterWorkspaceLayoutKind {
        match self {
            Self::Tiling => ClusterWorkspaceLayoutKind::Tiling,
            Self::Stacking => ClusterWorkspaceLayoutKind::Stacking,
        }
    }
}

#[derive(Clone, Debug)]
pub enum WindowRulePattern {
    Exact(String),
    Regex(Regex),
}

impl PartialEq for WindowRulePattern {
    fn eq(&self, other: &Self) -> bool {
        match (self, other) {
            (Self::Exact(a), Self::Exact(b)) => a == b,
            (Self::Regex(a), Self::Regex(b)) => a.as_str() == b.as_str(),
            _ => false,
        }
    }
}

impl Eq for WindowRulePattern {}

impl WindowRulePattern {
    pub fn matches(&self, value: &str) -> bool {
        match self {
            Self::Exact(exact) => exact == value,
            Self::Regex(regex) => regex.is_match(value),
        }
    }

    pub fn as_str(&self) -> &str {
        match self {
            Self::Exact(exact) => exact.as_str(),
            Self::Regex(regex) => regex.as_str(),
        }
    }
}

#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum InitialWindowOverlapPolicy {
    None,
    ParentOnly,
    All,
}

#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum InitialWindowSpawnPlacement {
    Default,
    Center,
    Adjacent,
    ViewportCenter,
    Cursor,
    App,
}

#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum InitialWindowClusterParticipation {
    Layout,
    Float,
}

#[derive(Clone, Debug, PartialEq)]
pub struct WindowRule {
    pub app_ids: Vec<WindowRulePattern>,
    pub titles: Vec<WindowRulePattern>,
    pub initial_size: Option<(u32, u32)>,
    pub opacity: Option<f32>,
    pub overlap_policy: InitialWindowOverlapPolicy,
    pub spawn_placement: InitialWindowSpawnPlacement,
    pub cluster_participation: InitialWindowClusterParticipation,
}

#[derive(Clone, Debug, PartialEq)]
pub struct ViewportOutputConfig {
    pub connector: String,
    pub enabled: bool,
    pub offset_x: i32,
    pub offset_y: i32,
    pub width: u32,
    pub height: u32,
    pub refresh_rate: Option<f64>,
    pub transform_degrees: u16,
    pub vrr: ViewportVrrMode,
    pub focus_ring: Option<FocusRingConfig>,
}

#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum ViewportVrrMode {
    Off,
    On,
    OnDemand,
}

impl ViewportVrrMode {
    pub fn as_str(self) -> &'static str {
        match self {
            Self::Off => "off",
            Self::On => "on",
            Self::OnDemand => "on-demand",
        }
    }

    pub fn drm_enabled(self) -> bool {
        matches!(self, Self::On)
    }
}