forge
Explore
Log in

Don't you dare go Hollow

config: Convert parse test to a snapshot test

Browse files at this commit

bb6663ebac872ad8a9982bdc63e5e8792073b63eIvan MolodetskikhParent: c6e98d5
Updating it by hand got really old tbh
niri-config/src/lib.rsmodified+853 -354
@@ -3494,18 +3494,17 @@ mod tests {
3494 use super::*;3494 use super::*;
3495 3495
3496 #[track_caller]3496 #[track_caller]
3497- fn check(text: &str, expected: Config) {3497+ fn do_parse(text: &str) -> Config {
3498 let _ = set_miette_hook();3498 let _ = set_miette_hook();
3499 3499
3500- let parsed = Config::parse("test.kdl", text)3500+ Config::parse("test.kdl", text)
3501 .map_err(miette::Report::new)3501 .map_err(miette::Report::new)
3502- .unwrap();3502+ .unwrap()
3503- assert_eq!(parsed, expected);
3504 }3503 }
3505 3504
3506 #[test]3505 #[test]
3507 fn parse() {3506 fn parse() {
3508- check(3507+ let parsed = do_parse(
3509 r##"3508 r##"
3510 input {3509 input {
3511 keyboard {3510 keyboard {
@@ -3748,17 +3747,25 @@ mod tests {
3748 workspace "workspace-2"3747 workspace "workspace-2"
3749 workspace "workspace-3"3748 workspace "workspace-3"
3750 "##,3749 "##,
3750+ );
3751+
3752+ assert_debug_snapshot!(parsed, @r#"
3751 Config {3753 Config {
3752 input: Input {3754 input: Input {
3753 keyboard: Keyboard {3755 keyboard: Keyboard {
3754 xkb: Xkb {3756 xkb: Xkb {
3755- layout: "us,ru".to_owned(),3757+ rules: "",
3756- options: Some("grp:win_space_toggle".to_owned()),3758+ model: "",
3757- ..Default::default()3759+ layout: "us,ru",
3760+ variant: "",
3761+ options: Some(
3762+ "grp:win_space_toggle",
3763+ ),
3764+ file: None,
3758 },3765 },
3759 repeat_delay: 600,3766 repeat_delay: 600,
3760 repeat_rate: 25,3767 repeat_rate: 25,
3761- track_layout: TrackLayout::Window,3768+ track_layout: Window,
3762 },3769 },
3763 touchpad: Touchpad {3770 touchpad: Touchpad {
3764 off: false,3771 off: false,
@@ -3766,169 +3773,380 @@ mod tests {
3766 dwt: true,3773 dwt: true,
3767 dwtp: true,3774 dwtp: true,
3768 drag_lock: false,3775 drag_lock: false,
3769- click_method: Some(ClickMethod::Clickfinger),
3770 natural_scroll: false,3776 natural_scroll: false,
3777+ click_method: Some(
3778+ Clickfinger,
3779+ ),
3771 accel_speed: 0.2,3780 accel_speed: 0.2,
3772- accel_profile: Some(AccelProfile::Flat),3781+ accel_profile: Some(
3773- scroll_method: Some(ScrollMethod::TwoFinger),3782+ Flat,
3774- scroll_button: Some(272),3783+ ),
3775- tap_button_map: Some(TapButtonMap::LeftMiddleRight),3784+ scroll_method: Some(
3785+ TwoFinger,
3786+ ),
3787+ scroll_button: Some(
3788+ 272,
3789+ ),
3790+ tap_button_map: Some(
3791+ LeftMiddleRight,
3792+ ),
3776 left_handed: false,3793 left_handed: false,
3777 disabled_on_external_mouse: true,3794 disabled_on_external_mouse: true,
3778 middle_emulation: false,3795 middle_emulation: false,
3779- scroll_factor: Some(FloatOrInt(0.9)),3796+ scroll_factor: Some(
3797+ FloatOrInt(
3798+ 0.9,
3799+ ),
3800+ ),
3780 },3801 },
3781 mouse: Mouse {3802 mouse: Mouse {
3782 off: false,3803 off: false,
3783 natural_scroll: true,3804 natural_scroll: true,
3784 accel_speed: 0.4,3805 accel_speed: 0.4,
3785- accel_profile: Some(AccelProfile::Flat),3806+ accel_profile: Some(
3786- scroll_method: Some(ScrollMethod::NoScroll),3807+ Flat,
3787- scroll_button: Some(273),3808+ ),
3809+ scroll_method: Some(
3810+ NoScroll,
3811+ ),
3812+ scroll_button: Some(
3813+ 273,
3814+ ),
3788 left_handed: false,3815 left_handed: false,
3789 middle_emulation: true,3816 middle_emulation: true,
3790- scroll_factor: Some(FloatOrInt(0.2)),3817+ scroll_factor: Some(
3818+ FloatOrInt(
3819+ 0.2,
3820+ ),
3821+ ),
3791 },3822 },
3792 trackpoint: Trackpoint {3823 trackpoint: Trackpoint {
3793 off: true,3824 off: true,
3794 natural_scroll: true,3825 natural_scroll: true,
3795 accel_speed: 0.0,3826 accel_speed: 0.0,
3796- accel_profile: Some(AccelProfile::Flat),3827+ accel_profile: Some(
3797- scroll_method: Some(ScrollMethod::OnButtonDown),3828+ Flat,
3798- scroll_button: Some(274),3829+ ),
3830+ scroll_method: Some(
3831+ OnButtonDown,
3832+ ),
3833+ scroll_button: Some(
3834+ 274,
3835+ ),
3799 middle_emulation: false,3836 middle_emulation: false,
3800 },3837 },
3801 trackball: Trackball {3838 trackball: Trackball {
3802 off: true,3839 off: true,
3803 natural_scroll: true,3840 natural_scroll: true,
3804 accel_speed: 0.0,3841 accel_speed: 0.0,
3805- accel_profile: Some(AccelProfile::Flat),3842+ accel_profile: Some(
3806- scroll_method: Some(ScrollMethod::Edge),3843+ Flat,
3807- scroll_button: Some(275),3844+ ),
3845+ scroll_method: Some(
3846+ Edge,
3847+ ),
3848+ scroll_button: Some(
3849+ 275,
3850+ ),
3808 left_handed: true,3851 left_handed: true,
3809 middle_emulation: true,3852 middle_emulation: true,
3810 },3853 },
3811 tablet: Tablet {3854 tablet: Tablet {
3812 off: false,3855 off: false,
3813- calibration_matrix: Some(vec![1., 2., 3.,3856+ calibration_matrix: Some(
3814- 4., 5., 6.]),3857+ [
3815- map_to_output: Some("eDP-1".to_owned()),3858+ 1.0,
3859+ 2.0,
3860+ 3.0,
3861+ 4.0,
3862+ 5.0,
3863+ 6.0,
3864+ ],
3865+ ),
3866+ map_to_output: Some(
3867+ "eDP-1",
3868+ ),
3816 left_handed: false,3869 left_handed: false,
3817 },3870 },
3818 touch: Touch {3871 touch: Touch {
3819- map_to_output: Some("eDP-1".to_owned()),3872+ map_to_output: Some(
3873+ "eDP-1",
3874+ ),
3820 },3875 },
3821 disable_power_key_handling: true,3876 disable_power_key_handling: true,
3822 warp_mouse_to_focus: true,3877 warp_mouse_to_focus: true,
3823- focus_follows_mouse: Some(FocusFollowsMouse {3878+ focus_follows_mouse: Some(
3824- max_scroll_amount: None,3879+ FocusFollowsMouse {
3825- }),3880+ max_scroll_amount: None,
3881+ },
3882+ ),
3826 workspace_auto_back_and_forth: true,3883 workspace_auto_back_and_forth: true,
3827 },3884 },
3828- outputs: Outputs(vec![Output {3885+ outputs: Outputs(
3829- off: false,3886+ [
3830- name: "eDP-1".to_owned(),3887+ Output {
3831- scale: Some(FloatOrInt(2.)),3888+ off: false,
3832- transform: Transform::Flipped90,3889+ name: "eDP-1",
3833- position: Some(Position { x: 10, y: 20 }),3890+ scale: Some(
3834- mode: Some(ConfiguredMode {3891+ FloatOrInt(
3835- width: 1920,3892+ 2.0,
3836- height: 1080,3893+ ),
3837- refresh: Some(144.),3894+ ),
3838- }),3895+ transform: Flipped90,
3839- variable_refresh_rate: Some(Vrr { on_demand: true }),3896+ position: Some(
3840- background_color: Color::from_rgba8_unpremul(25, 25, 102, 255),3897+ Position {
3841- }]),3898+ x: 10,
3899+ y: 20,
3900+ },
3901+ ),
3902+ mode: Some(
3903+ ConfiguredMode {
3904+ width: 1920,
3905+ height: 1080,
3906+ refresh: Some(
3907+ 144.0,
3908+ ),
3909+ },
3910+ ),
3911+ variable_refresh_rate: Some(
3912+ Vrr {
3913+ on_demand: true,
3914+ },
3915+ ),
3916+ background_color: Color {
3917+ r: 0.09803922,
3918+ g: 0.09803922,
3919+ b: 0.4,
3920+ a: 1.0,
3921+ },
3922+ },
3923+ ],
3924+ ),
3925+ spawn_at_startup: [
3926+ SpawnAtStartup {
3927+ command: [
3928+ "alacritty",
3929+ "-e",
3930+ "fish",
3931+ ],
3932+ },
3933+ ],
3842 layout: Layout {3934 layout: Layout {
3843 focus_ring: FocusRing {3935 focus_ring: FocusRing {
3844 off: false,3936 off: false,
3845- width: FloatOrInt(5.),3937+ width: FloatOrInt(
3846- active_color: Color::from_rgba8_unpremul(0, 100, 200, 255),3938+ 5.0,
3847- inactive_color: Color::from_rgba8_unpremul(255, 200, 100, 0),3939+ ),
3848- active_gradient: Some(Gradient {3940+ active_color: Color {
3849- from: Color::from_rgba8_unpremul(10, 20, 30, 255),3941+ r: 0.0,
3850- to: Color::from_rgba8_unpremul(0, 128, 255, 255),3942+ g: 0.39215687,
3851- angle: 180,3943+ b: 0.78431374,
3852- relative_to: GradientRelativeTo::WorkspaceView,3944+ a: 1.0,
3853- in_: GradientInterpolation {3945+ },
3854- color_space: GradientColorSpace::Srgb,3946+ inactive_color: Color {
3855- hue_interpolation: HueInterpolation::Shorter,3947+ r: 1.0,
3948+ g: 0.78431374,
3949+ b: 0.39215687,
3950+ a: 0.0,
3951+ },
3952+ active_gradient: Some(
3953+ Gradient {
3954+ from: Color {
3955+ r: 0.039215688,
3956+ g: 0.078431375,
3957+ b: 0.11764706,
3958+ a: 1.0,
3959+ },
3960+ to: Color {
3961+ r: 0.0,
3962+ g: 0.5019608,
3963+ b: 1.0,
3964+ a: 1.0,
3965+ },
3966+ angle: 180,
3967+ relative_to: WorkspaceView,
3968+ in_: GradientInterpolation {
3969+ color_space: Srgb,
3970+ hue_interpolation: Shorter,
3971+ },
3856 },3972 },
3857- }),3973+ ),
3858 inactive_gradient: None,3974 inactive_gradient: None,
3859 },3975 },
3860 border: Border {3976 border: Border {
3861 off: false,3977 off: false,
3862- width: FloatOrInt(3.),3978+ width: FloatOrInt(
3863- active_color: Color::from_rgba8_unpremul(255, 200, 127, 255),3979+ 3.0,
3864- inactive_color: Color::from_rgba8_unpremul(255, 200, 100, 0),3980+ ),
3981+ active_color: Color {
3982+ r: 1.0,
3983+ g: 0.78431374,
3984+ b: 0.49803922,
3985+ a: 1.0,
3986+ },
3987+ inactive_color: Color {
3988+ r: 1.0,
3989+ g: 0.78431374,
3990+ b: 0.39215687,
3991+ a: 0.0,
3992+ },
3865 active_gradient: None,3993 active_gradient: None,
3866 inactive_gradient: None,3994 inactive_gradient: None,
3867 },3995 },
3868 shadow: Shadow {3996 shadow: Shadow {
3997+ on: false,
3869 offset: ShadowOffset {3998 offset: ShadowOffset {
3870- x: FloatOrInt(10.),3999+ x: FloatOrInt(
3871- y: FloatOrInt(-20.),4000+ 10.0,
4001+ ),
4002+ y: FloatOrInt(
4003+ -20.0,
4004+ ),
3872 },4005 },
3873- ..Default::default()4006+ softness: FloatOrInt(
4007+ 30.0,
4008+ ),
4009+ spread: FloatOrInt(
4010+ 5.0,
4011+ ),
4012+ draw_behind_window: false,
4013+ color: Color {
4014+ r: 0.0,
4015+ g: 0.0,
4016+ b: 0.0,
4017+ a: 0.4392157,
4018+ },
4019+ inactive_color: None,
3874 },4020 },
3875 tab_indicator: TabIndicator {4021 tab_indicator: TabIndicator {
3876- width: FloatOrInt(10.),4022+ off: false,
3877- position: TabIndicatorPosition::Top,4023+ hide_when_single_tab: false,
3878- ..Default::default()4024+ place_within_column: false,
4025+ gap: FloatOrInt(
4026+ 5.0,
4027+ ),
4028+ width: FloatOrInt(
4029+ 10.0,
4030+ ),
4031+ length: TabIndicatorLength {
4032+ total_proportion: Some(
4033+ 0.5,
4034+ ),
4035+ },
4036+ position: Top,
4037+ gaps_between_tabs: FloatOrInt(
4038+ 0.0,
4039+ ),
4040+ corner_radius: FloatOrInt(
4041+ 0.0,
4042+ ),
4043+ active_color: None,
4044+ inactive_color: None,
4045+ active_gradient: None,
4046+ inactive_gradient: None,
3879 },4047 },
3880 insert_hint: InsertHint {4048 insert_hint: InsertHint {
3881 off: false,4049 off: false,
3882- color: Color::from_rgba8_unpremul(255, 200, 127, 255),4050+ color: Color {
3883- gradient: Some(Gradient {4051+ r: 1.0,
3884- from: Color::from_rgba8_unpremul(10, 20, 30, 255),4052+ g: 0.78431374,
3885- to: Color::from_rgba8_unpremul(0, 128, 255, 255),4053+ b: 0.49803922,
3886- angle: 180,4054+ a: 1.0,
3887- relative_to: GradientRelativeTo::WorkspaceView,4055+ },
3888- in_: GradientInterpolation {4056+ gradient: Some(
3889- color_space: GradientColorSpace::Srgb,4057+ Gradient {
3890- hue_interpolation: HueInterpolation::Shorter,4058+ from: Color {
4059+ r: 0.039215688,
4060+ g: 0.078431375,
4061+ b: 0.11764706,
4062+ a: 1.0,
4063+ },
4064+ to: Color {
4065+ r: 0.0,
4066+ g: 0.5019608,
4067+ b: 1.0,
4068+ a: 1.0,
4069+ },
4070+ angle: 180,
4071+ relative_to: WorkspaceView,
4072+ in_: GradientInterpolation {
4073+ color_space: Srgb,
4074+ hue_interpolation: Shorter,
4075+ },
3891 },4076 },
3892- }),4077+ ),
3893 },4078 },
3894- preset_column_widths: vec![4079+ preset_column_widths: [
3895- PresetSize::Proportion(0.25),4080+ Proportion(
3896- PresetSize::Proportion(0.5),4081+ 0.25,
3897- PresetSize::Fixed(960),4082+ ),
3898- PresetSize::Fixed(1280),4083+ Proportion(
4084+ 0.5,
4085+ ),
4086+ Fixed(
4087+ 960,
4088+ ),
4089+ Fixed(
4090+ 1280,
4091+ ),
3899 ],4092 ],
3900- default_column_width: Some(DefaultPresetSize(Some(PresetSize::Proportion(4093+ default_column_width: Some(
3901- 0.25,4094+ DefaultPresetSize(
3902- )))),4095+ Some(
3903- preset_window_heights: vec![4096+ Proportion(
3904- PresetSize::Proportion(0.25),4097+ 0.25,
3905- PresetSize::Proportion(0.5),4098+ ),
3906- PresetSize::Fixed(960),4099+ ),
3907- PresetSize::Fixed(1280),4100+ ),
4101+ ),
4102+ preset_window_heights: [
4103+ Proportion(
4104+ 0.25,
4105+ ),
4106+ Proportion(
4107+ 0.5,
4108+ ),
4109+ Fixed(
4110+ 960,
4111+ ),
4112+ Fixed(
4113+ 1280,
4114+ ),
3908 ],4115 ],
3909- gaps: FloatOrInt(8.),4116+ center_focused_column: OnOverflow,
3910- struts: Struts {
3911- left: FloatOrInt(1.),
3912- right: FloatOrInt(2.),
3913- top: FloatOrInt(3.),
3914- bottom: FloatOrInt(0.),
3915- },
3916- center_focused_column: CenterFocusedColumn::OnOverflow,
3917- default_column_display: ColumnDisplay::Tabbed,
3918 always_center_single_column: false,4117 always_center_single_column: false,
3919 empty_workspace_above_first: false,4118 empty_workspace_above_first: false,
4119+ default_column_display: Tabbed,
4120+ gaps: FloatOrInt(
4121+ 8.0,
4122+ ),
4123+ struts: Struts {
4124+ left: FloatOrInt(
4125+ 1.0,
4126+ ),
4127+ right: FloatOrInt(
4128+ 2.0,
4129+ ),
4130+ top: FloatOrInt(
4131+ 3.0,
4132+ ),
4133+ bottom: FloatOrInt(
4134+ 0.0,
4135+ ),
4136+ },
3920 },4137 },
3921- spawn_at_startup: vec![SpawnAtStartup {
3922- command: vec!["alacritty".to_owned(), "-e".to_owned(), "fish".to_owned()],
3923- }],
3924 prefer_no_csd: true,4138 prefer_no_csd: true,
3925 cursor: Cursor {4139 cursor: Cursor {
3926- xcursor_theme: String::from("breeze_cursors"),4140+ xcursor_theme: "breeze_cursors",
3927 xcursor_size: 16,4141 xcursor_size: 16,
3928 hide_when_typing: true,4142 hide_when_typing: true,
3929- hide_after_inactive_ms: Some(3000),4143+ hide_after_inactive_ms: Some(
4144+ 3000,
4145+ ),
3930 },4146 },
3931- screenshot_path: Some(String::from("~/Screenshots/screenshot.png")),4147+ screenshot_path: Some(
4148+ "~/Screenshots/screenshot.png",
4149+ ),
3932 clipboard: Clipboard {4150 clipboard: Clipboard {
3933 disable_primary: true,4151 disable_primary: true,
3934 },4152 },
@@ -3936,289 +4154,570 @@ mod tests {
3936 skip_at_startup: true,4154 skip_at_startup: true,
3937 },4155 },
3938 animations: Animations {4156 animations: Animations {
3939- slowdown: 2.,4157+ off: false,
3940- workspace_switch: WorkspaceSwitchAnim(Animation {4158+ slowdown: 2.0,
3941- off: false,4159+ workspace_switch: WorkspaceSwitchAnim(
3942- kind: AnimationKind::Spring(SpringParams {4160+ Animation {
3943- damping_ratio: 1.,4161+ off: false,
3944- stiffness: 1000,4162+ kind: Spring(
3945- epsilon: 0.0001,4163+ SpringParams {
3946- }),4164+ damping_ratio: 1.0,
3947- }),4165+ stiffness: 1000,
3948- horizontal_view_movement: HorizontalViewMovementAnim(Animation {4166+ epsilon: 0.0001,
3949- off: false,4167+ },
3950- kind: AnimationKind::Easing(EasingParams {4168+ ),
3951- duration_ms: 100,4169+ },
3952- curve: AnimationCurve::EaseOutExpo,4170+ ),
3953- }),
3954- }),
3955 window_open: WindowOpenAnim {4171 window_open: WindowOpenAnim {
3956 anim: Animation {4172 anim: Animation {
3957 off: true,4173 off: true,
3958- ..WindowOpenAnim::default().anim4174+ kind: Easing(
4175+ EasingParams {
4176+ duration_ms: 150,
4177+ curve: EaseOutExpo,
4178+ },
4179+ ),
3959 },4180 },
3960 custom_shader: None,4181 custom_shader: None,
3961 },4182 },
3962- ..Default::default()4183+ window_close: WindowCloseAnim {
3963- },4184+ anim: Animation {
3964- environment: Environment(vec![4185+ off: false,
3965- EnvironmentVariable {4186+ kind: Easing(
3966- name: String::from("QT_QPA_PLATFORM"),4187+ EasingParams {
3967- value: Some(String::from("wayland")),4188+ duration_ms: 150,
4189+ curve: EaseOutQuad,
4190+ },
4191+ ),
4192+ },
4193+ custom_shader: None,
3968 },4194 },
3969- EnvironmentVariable {4195+ horizontal_view_movement: HorizontalViewMovementAnim(
3970- name: String::from("DISPLAY"),4196+ Animation {
3971- value: None,4197+ off: false,
4198+ kind: Easing(
4199+ EasingParams {
4200+ duration_ms: 100,
4201+ curve: EaseOutExpo,
4202+ },
4203+ ),
4204+ },
4205+ ),
4206+ window_movement: WindowMovementAnim(
4207+ Animation {
4208+ off: false,
4209+ kind: Spring(
4210+ SpringParams {
4211+ damping_ratio: 1.0,
4212+ stiffness: 800,
4213+ epsilon: 0.0001,
4214+ },
4215+ ),
4216+ },
4217+ ),
4218+ window_resize: WindowResizeAnim {
4219+ anim: Animation {
4220+ off: false,
4221+ kind: Spring(
4222+ SpringParams {
4223+ damping_ratio: 1.0,
4224+ stiffness: 800,
4225+ epsilon: 0.0001,
4226+ },
4227+ ),
4228+ },
4229+ custom_shader: None,
3972 },4230 },
3973- ]),4231+ config_notification_open_close: ConfigNotificationOpenCloseAnim(
3974- window_rules: vec![WindowRule {4232+ Animation {
3975- matches: vec![Match {4233+ off: false,
3976- app_id: Some(RegexEq::from_str(".*alacritty").unwrap()),4234+ kind: Spring(
3977- title: None,4235+ SpringParams {
3978- is_active: None,4236+ damping_ratio: 0.6,
3979- is_focused: None,4237+ stiffness: 1000,
3980- is_active_in_column: None,4238+ epsilon: 0.001,
3981- is_floating: None,4239+ },
3982- is_window_cast_target: None,4240+ ),
3983- at_startup: None,
3984- }],
3985- excludes: vec![
3986- Match {
3987- app_id: None,
3988- title: Some(RegexEq::from_str("~").unwrap()),
3989- is_active: None,
3990- is_focused: None,
3991- is_active_in_column: None,
3992- is_floating: None,
3993- is_window_cast_target: None,
3994- at_startup: None,
3995 },4241 },
3996- Match {4242+ ),
3997- app_id: None,4243+ screenshot_ui_open: ScreenshotUiOpenAnim(
3998- title: None,4244+ Animation {
3999- is_active: Some(true),4245+ off: false,
4000- is_focused: Some(false),4246+ kind: Easing(
4001- is_active_in_column: None,4247+ EasingParams {
4002- is_floating: None,4248+ duration_ms: 200,
4003- is_window_cast_target: None,4249+ curve: EaseOutQuad,
4004- at_startup: None,4250+ },
4251+ ),
4252+ },
4253+ ),
4254+ },
4255+ environment: Environment(
4256+ [
4257+ EnvironmentVariable {
4258+ name: "QT_QPA_PLATFORM",
4259+ value: Some(
4260+ "wayland",
4261+ ),
4262+ },
4263+ EnvironmentVariable {
4264+ name: "DISPLAY",
4265+ value: None,
4005 },4266 },
4006 ],4267 ],
4007- open_on_output: Some("eDP-1".to_owned()),4268+ ),
4008- open_maximized: Some(true),4269+ window_rules: [
4009- open_fullscreen: Some(false),4270+ WindowRule {
4010- open_floating: Some(false),4271+ matches: [
4011- open_focused: Some(true),4272+ Match {
4012- default_window_height: Some(DefaultPresetSize(Some(PresetSize::Fixed(500)))),4273+ app_id: Some(
4013- default_column_display: Some(ColumnDisplay::Tabbed),4274+ RegexEq(
4014- default_floating_position: Some(FloatingPosition {4275+ Regex(
4015- x: FloatOrInt(100.),4276+ ".*alacritty",
4016- y: FloatOrInt(-200.),4277+ ),
4017- relative_to: RelativeTo::BottomLeft,4278+ ),
4018- }),4279+ ),
4019- focus_ring: BorderRule {4280+ title: None,
4020- off: true,4281+ is_active: None,
4021- width: Some(FloatOrInt(3.)),4282+ is_focused: None,
4022- ..Default::default()4283+ is_active_in_column: None,
4023- },4284+ is_floating: None,
4024- border: BorderRule {4285+ is_window_cast_target: None,
4025- on: true,4286+ at_startup: None,
4026- width: Some(FloatOrInt(8.5)),4287+ },
4027- ..Default::default()4288+ ],
4028- },4289+ excludes: [
4029- tab_indicator: TabIndicatorRule {4290+ Match {
4030- active_color: Some(Color::from_rgba8_unpremul(255, 0, 0, 255)),4291+ app_id: None,
4031- ..Default::default()4292+ title: Some(
4293+ RegexEq(
4294+ Regex(
4295+ "~",
4296+ ),
4297+ ),
4298+ ),
4299+ is_active: None,
4300+ is_focused: None,
4301+ is_active_in_column: None,
4302+ is_floating: None,
4303+ is_window_cast_target: None,
4304+ at_startup: None,
4305+ },
4306+ Match {
4307+ app_id: None,
4308+ title: None,
4309+ is_active: Some(
4310+ true,
4311+ ),
4312+ is_focused: Some(
4313+ false,
4314+ ),
4315+ is_active_in_column: None,
4316+ is_floating: None,
4317+ is_window_cast_target: None,
4318+ at_startup: None,
4319+ },
4320+ ],
4321+ default_column_width: None,
4322+ default_window_height: Some(
4323+ DefaultPresetSize(
4324+ Some(
4325+ Fixed(
4326+ 500,
4327+ ),
4328+ ),
4329+ ),
4330+ ),
4331+ open_on_output: Some(
4332+ "eDP-1",
4333+ ),
4334+ open_on_workspace: None,
4335+ open_maximized: Some(
4336+ true,
4337+ ),
4338+ open_fullscreen: Some(
4339+ false,
4340+ ),
4341+ open_floating: Some(
4342+ false,
4343+ ),
4344+ open_focused: Some(
4345+ true,
4346+ ),
4347+ min_width: None,
4348+ min_height: None,
4349+ max_width: None,
4350+ max_height: None,
4351+ focus_ring: BorderRule {
4352+ off: true,
4353+ on: false,
4354+ width: Some(
4355+ FloatOrInt(
4356+ 3.0,
4357+ ),
4358+ ),
4359+ active_color: None,
4360+ inactive_color: None,
4361+ active_gradient: None,
4362+ inactive_gradient: None,
4363+ },
4364+ border: BorderRule {
4365+ off: false,
4366+ on: true,
4367+ width: Some(
4368+ FloatOrInt(
4369+ 8.5,
4370+ ),
4371+ ),
4372+ active_color: None,
4373+ inactive_color: None,
4374+ active_gradient: None,
4375+ inactive_gradient: None,
4376+ },
4377+ shadow: ShadowRule {
4378+ off: false,
4379+ on: false,
4380+ offset: None,
4381+ softness: None,
4382+ spread: None,
4383+ draw_behind_window: None,
4384+ color: None,
4385+ inactive_color: None,
4386+ },
4387+ tab_indicator: TabIndicatorRule {
4388+ active_color: Some(
4389+ Color {
4390+ r: 1.0,
4391+ g: 0.0,
4392+ b: 0.0,
4393+ a: 1.0,
4394+ },
4395+ ),
4396+ inactive_color: None,
4397+ active_gradient: None,
4398+ inactive_gradient: None,
4399+ },
4400+ draw_border_with_background: None,
4401+ opacity: None,
4402+ geometry_corner_radius: None,
4403+ clip_to_geometry: None,
4404+ baba_is_float: None,
4405+ block_out_from: None,
4406+ variable_refresh_rate: None,
4407+ default_column_display: Some(
4408+ Tabbed,
4409+ ),
4410+ default_floating_position: Some(
4411+ FloatingPosition {
4412+ x: FloatOrInt(
4413+ 100.0,
4414+ ),
4415+ y: FloatOrInt(
4416+ -200.0,
4417+ ),
4418+ relative_to: BottomLeft,
4419+ },
4420+ ),
4421+ scroll_factor: None,
4032 },4422 },
4033- ..Default::default()4423+ ],
4034- }],4424+ layer_rules: [
4035- layer_rules: vec![
4036 LayerRule {4425 LayerRule {
4037- matches: vec![layer_rule::Match {4426+ matches: [
4038- namespace: Some(RegexEq::from_str("^notifications$").unwrap()),4427+ Match {
4039- at_startup: None,4428+ namespace: Some(
4040- }],4429+ RegexEq(
4041- excludes: vec![],4430+ Regex(
4431+ "^notifications$",
4432+ ),
4433+ ),
4434+ ),
4435+ at_startup: None,
4436+ },
4437+ ],
4438+ excludes: [],
4042 opacity: None,4439 opacity: None,
4043- block_out_from: Some(BlockOutFrom::Screencast),4440+ block_out_from: Some(
4044- shadow: ShadowRule::default(),4441+ Screencast,
4442+ ),
4443+ shadow: ShadowRule {
4444+ off: false,
4445+ on: false,
4446+ offset: None,
4447+ softness: None,
4448+ spread: None,
4449+ draw_behind_window: None,
4450+ color: None,
4451+ inactive_color: None,
4452+ },
4045 geometry_corner_radius: None,4453 geometry_corner_radius: None,
4046- }
4047- ],
4048- workspaces: vec![
4049- Workspace {
4050- name: WorkspaceName("workspace-1".to_string()),
4051- open_on_output: Some("eDP-1".to_string()),
4052- },
4053- Workspace {
4054- name: WorkspaceName("workspace-2".to_string()),
4055- open_on_output: None,
4056- },
4057- Workspace {
4058- name: WorkspaceName("workspace-3".to_string()),
4059- open_on_output: None,
4060 },4454 },
4061 ],4455 ],
4062- binds: Binds(vec![4456+ binds: Binds(
4063- Bind {4457+ [
4064- key: Key {4458+ Bind {
4065- trigger: Trigger::Keysym(Keysym::Escape),4459+ key: Key {
4066- modifiers: Modifiers::COMPOSITOR,4460+ trigger: Keysym(
4461+ XK_Escape,
4462+ ),
4463+ modifiers: Modifiers(
4464+ COMPOSITOR,
4465+ ),
4466+ },
4467+ action: ToggleKeyboardShortcutsInhibit,
4468+ repeat: true,
4469+ cooldown: None,
4470+ allow_when_locked: false,
4471+ allow_inhibiting: false,
4472+ hotkey_overlay_title: Some(
4473+ Some(
4474+ "Inhibit",
4475+ ),
4476+ ),
4067 },4477 },
4068- action: Action::ToggleKeyboardShortcutsInhibit,4478+ Bind {
4069- repeat: true,4479+ key: Key {
4070- cooldown: None,4480+ trigger: Keysym(
4071- allow_when_locked: false,4481+ XK_Escape,
4072- allow_inhibiting: false,4482+ ),
4073- hotkey_overlay_title: Some(Some("Inhibit".to_owned())),4483+ modifiers: Modifiers(
4074- },4484+ SHIFT | COMPOSITOR,
4075- Bind {4485+ ),
4076- key: Key {4486+ },
4077- trigger: Trigger::Keysym(Keysym::Escape),4487+ action: ToggleKeyboardShortcutsInhibit,
4078- modifiers: Modifiers::COMPOSITOR | Modifiers::SHIFT,4488+ repeat: true,
4489+ cooldown: None,
4490+ allow_when_locked: false,
4491+ allow_inhibiting: false,
4492+ hotkey_overlay_title: None,
4079 },4493 },
4080- action: Action::ToggleKeyboardShortcutsInhibit,4494+ Bind {
4081- repeat: true,4495+ key: Key {
4082- cooldown: None,4496+ trigger: Keysym(
4083- allow_when_locked: false,4497+ XK_t,
4084- allow_inhibiting: false,4498+ ),
4085- hotkey_overlay_title: None,4499+ modifiers: Modifiers(
4086- },4500+ COMPOSITOR,
4087- Bind {4501+ ),
4088- key: Key {4502+ },
4089- trigger: Trigger::Keysym(Keysym::t),4503+ action: Spawn(
4090- modifiers: Modifiers::COMPOSITOR,4504+ [
4505+ "alacritty",
4506+ ],
4507+ ),
4508+ repeat: true,
4509+ cooldown: None,
4510+ allow_when_locked: true,
4511+ allow_inhibiting: true,
4512+ hotkey_overlay_title: None,
4091 },4513 },
4092- action: Action::Spawn(vec!["alacritty".to_owned()]),4514+ Bind {
4093- repeat: true,4515+ key: Key {
4094- cooldown: None,4516+ trigger: Keysym(
4095- allow_when_locked: true,4517+ XK_q,
4096- allow_inhibiting: true,4518+ ),
4097- hotkey_overlay_title: None,4519+ modifiers: Modifiers(
4098- },4520+ COMPOSITOR,
4099- Bind {4521+ ),
4100- key: Key {4522+ },
4101- trigger: Trigger::Keysym(Keysym::q),4523+ action: CloseWindow,
4102- modifiers: Modifiers::COMPOSITOR,4524+ repeat: true,
4525+ cooldown: None,
4526+ allow_when_locked: false,
4527+ allow_inhibiting: true,
4528+ hotkey_overlay_title: Some(
4529+ None,
4530+ ),
4103 },4531 },
4104- action: Action::CloseWindow,4532+ Bind {
4105- repeat: true,4533+ key: Key {
4106- cooldown: None,4534+ trigger: Keysym(
4107- allow_when_locked: false,4535+ XK_h,
4108- allow_inhibiting: true,4536+ ),
4109- hotkey_overlay_title: Some(None),4537+ modifiers: Modifiers(
4110- },4538+ SHIFT | COMPOSITOR,
4111- Bind {4539+ ),
4112- key: Key {4540+ },
4113- trigger: Trigger::Keysym(Keysym::h),4541+ action: FocusMonitorLeft,
4114- modifiers: Modifiers::COMPOSITOR | Modifiers::SHIFT,4542+ repeat: true,
4543+ cooldown: None,
4544+ allow_when_locked: false,
4545+ allow_inhibiting: true,
4546+ hotkey_overlay_title: None,
4115 },4547 },
4116- action: Action::FocusMonitorLeft,4548+ Bind {
4117- repeat: true,4549+ key: Key {
4118- cooldown: None,4550+ trigger: Keysym(
4119- allow_when_locked: false,4551+ XK_l,
4120- allow_inhibiting: true,4552+ ),
4121- hotkey_overlay_title: None,4553+ modifiers: Modifiers(
4122- },4554+ CTRL | SHIFT | COMPOSITOR,
4123- Bind {4555+ ),
4124- key: Key {4556+ },
4125- trigger: Trigger::Keysym(Keysym::l),4557+ action: MoveWindowToMonitorRight,
4126- modifiers: Modifiers::COMPOSITOR | Modifiers::SHIFT | Modifiers::CTRL,4558+ repeat: true,
4559+ cooldown: None,
4560+ allow_when_locked: false,
4561+ allow_inhibiting: true,
4562+ hotkey_overlay_title: None,
4127 },4563 },
4128- action: Action::MoveWindowToMonitorRight,4564+ Bind {
4129- repeat: true,4565+ key: Key {
4130- cooldown: None,4566+ trigger: Keysym(
4131- allow_when_locked: false,4567+ XK_comma,
4132- allow_inhibiting: true,4568+ ),
4133- hotkey_overlay_title: None,4569+ modifiers: Modifiers(
4134- },4570+ COMPOSITOR,
4135- Bind {4571+ ),
4136- key: Key {4572+ },
4137- trigger: Trigger::Keysym(Keysym::comma),4573+ action: ConsumeWindowIntoColumn,
4138- modifiers: Modifiers::COMPOSITOR,4574+ repeat: true,
4575+ cooldown: None,
4576+ allow_when_locked: false,
4577+ allow_inhibiting: true,
4578+ hotkey_overlay_title: None,
4139 },4579 },
4140- action: Action::ConsumeWindowIntoColumn,4580+ Bind {
4141- repeat: true,4581+ key: Key {
4142- cooldown: None,4582+ trigger: Keysym(
4143- allow_when_locked: false,4583+ XK_1,
4144- allow_inhibiting: true,4584+ ),
4145- hotkey_overlay_title: None,4585+ modifiers: Modifiers(
4146- },4586+ COMPOSITOR,
4147- Bind {4587+ ),
4148- key: Key {4588+ },
4149- trigger: Trigger::Keysym(Keysym::_1),4589+ action: FocusWorkspace(
4150- modifiers: Modifiers::COMPOSITOR,4590+ Index(
4591+ 1,
4592+ ),
4593+ ),
4594+ repeat: true,
4595+ cooldown: None,
4596+ allow_when_locked: false,
4597+ allow_inhibiting: true,
4598+ hotkey_overlay_title: None,
4151 },4599 },
4152- action: Action::FocusWorkspace(WorkspaceReference::Index(1)),4600+ Bind {
4153- repeat: true,4601+ key: Key {
4154- cooldown: None,4602+ trigger: Keysym(
4155- allow_when_locked: false,4603+ XK_1,
4156- allow_inhibiting: true,4604+ ),
4157- hotkey_overlay_title: None,4605+ modifiers: Modifiers(
4158- },4606+ SHIFT | COMPOSITOR,
4159- Bind {4607+ ),
4160- key: Key {4608+ },
4161- trigger: Trigger::Keysym(Keysym::_1),4609+ action: FocusWorkspace(
4162- modifiers: Modifiers::COMPOSITOR | Modifiers::SHIFT,4610+ Name(
4611+ "workspace-1",
4612+ ),
4613+ ),
4614+ repeat: true,
4615+ cooldown: None,
4616+ allow_when_locked: false,
4617+ allow_inhibiting: true,
4618+ hotkey_overlay_title: None,
4163 },4619 },
4164- action: Action::FocusWorkspace(WorkspaceReference::Name(4620+ Bind {
4165- "workspace-1".to_string(),4621+ key: Key {
4166- )),4622+ trigger: Keysym(
4167- repeat: true,4623+ XK_e,
4168- cooldown: None,4624+ ),
4169- allow_when_locked: false,4625+ modifiers: Modifiers(
4170- allow_inhibiting: true,4626+ SHIFT | COMPOSITOR,
4171- hotkey_overlay_title: None,4627+ ),
4172- },4628+ },
4173- Bind {4629+ action: Quit(
4174- key: Key {4630+ true,
4175- trigger: Trigger::Keysym(Keysym::e),4631+ ),
4176- modifiers: Modifiers::COMPOSITOR | Modifiers::SHIFT,4632+ repeat: true,
4633+ cooldown: None,
4634+ allow_when_locked: false,
4635+ allow_inhibiting: false,
4636+ hotkey_overlay_title: None,
4177 },4637 },
4178- action: Action::Quit(true),4638+ Bind {
4179- repeat: true,4639+ key: Key {
4180- cooldown: None,4640+ trigger: WheelScrollDown,
4181- allow_when_locked: false,4641+ modifiers: Modifiers(
4182- allow_inhibiting: false,4642+ COMPOSITOR,
4183- hotkey_overlay_title: None,4643+ ),
4184- },4644+ },
4185- Bind {4645+ action: FocusWorkspaceDown,
4186- key: Key {4646+ repeat: true,
4187- trigger: Trigger::WheelScrollDown,4647+ cooldown: Some(
4188- modifiers: Modifiers::COMPOSITOR,4648+ 150ms,
4649+ ),
4650+ allow_when_locked: false,
4651+ allow_inhibiting: true,
4652+ hotkey_overlay_title: None,
4189 },4653 },
4190- action: Action::FocusWorkspaceDown,4654+ ],
4191- repeat: true,4655+ ),
4192- cooldown: Some(Duration::from_millis(150)),
4193- allow_when_locked: false,
4194- allow_inhibiting: true,
4195- hotkey_overlay_title: None,
4196- },
4197- ]),
4198 switch_events: SwitchBinds {4656 switch_events: SwitchBinds {
4199 lid_open: None,4657 lid_open: None,
4200 lid_close: None,4658 lid_close: None,
4201- tablet_mode_on: Some(SwitchAction {4659+ tablet_mode_on: Some(
4202- spawn: vec![4660+ SwitchAction {
4203- "bash".to_owned(),4661+ spawn: [
4204- "-c".to_owned(),4662+ "bash",
4205- "gsettings set org.gnome.desktop.a11y.applications screen-keyboard-enabled true".to_owned(),4663+ "-c",
4206- ],4664+ "gsettings set org.gnome.desktop.a11y.applications screen-keyboard-enabled true",
4207- }),4665+ ],
4208- tablet_mode_off: Some(SwitchAction {4666+ },
4209- spawn: vec![4667+ ),
4210- "bash".to_owned(),4668+ tablet_mode_off: Some(
4211- "-c".to_owned(),4669+ SwitchAction {
4212- "gsettings set org.gnome.desktop.a11y.applications screen-keyboard-enabled false".to_owned(),4670+ spawn: [
4213- ],4671+ "bash",
4214- }),4672+ "-c",
4673+ "gsettings set org.gnome.desktop.a11y.applications screen-keyboard-enabled false",
4674+ ],
4675+ },
4676+ ),
4215 },4677 },
4216 debug: DebugConfig {4678 debug: DebugConfig {
4217- render_drm_device: Some(PathBuf::from("/dev/dri/renderD129")),4679+ preview_render: None,
4218- ..Default::default()4680+ dbus_interfaces_in_non_session_instances: false,
4681+ wait_for_frame_completion_before_queueing: false,
4682+ enable_overlay_planes: false,
4683+ disable_cursor_plane: false,
4684+ disable_direct_scanout: false,
4685+ restrict_primary_scanout_to_matching_format: false,
4686+ render_drm_device: Some(
4687+ "/dev/dri/renderD129",
4688+ ),
4689+ force_pipewire_invalid_modifier: false,
4690+ emulate_zero_presentation_time: false,
4691+ disable_resize_throttling: false,
4692+ disable_transactions: false,
4693+ keep_laptop_panel_on_when_lid_is_closed: false,
4694+ disable_monitor_names: false,
4695+ strict_new_window_focus_policy: false,
4219 },4696 },
4220- },4697+ workspaces: [
4221- );4698+ Workspace {
4699+ name: WorkspaceName(
4700+ "workspace-1",
4701+ ),
4702+ open_on_output: Some(
4703+ "eDP-1",
4704+ ),
4705+ },
4706+ Workspace {
4707+ name: WorkspaceName(
4708+ "workspace-2",
4709+ ),
4710+ open_on_output: None,
4711+ },
4712+ Workspace {
4713+ name: WorkspaceName(
4714+ "workspace-3",
4715+ ),
4716+ open_on_output: None,
4717+ },
4718+ ],
4719+ }
4720+ "#);
4222 }4721 }
4223 4722
4224 #[test]4723 #[test]