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 {
34943494 use super::*;
34953495
34963496 #[track_caller]
3497- fn check(text: &str, expected: Config) {
3497+ fn do_parse(text: &str) -> Config {
34983498 let _ = set_miette_hook();
34993499
3500- let parsed = Config::parse("test.kdl", text)
3500+ Config::parse("test.kdl", text)
35013501 .map_err(miette::Report::new)
3502- .unwrap();
3503- assert_eq!(parsed, expected);
3502+ .unwrap()
35043503 }
35053504
35063505 #[test]
35073506 fn parse() {
3508- check(
3507+ let parsed = do_parse(
35093508 r##"
35103509 input {
35113510 keyboard {
@@ -3748,17 +3747,25 @@ mod tests {
37483747 workspace "workspace-2"
37493748 workspace "workspace-3"
37503749 "##,
3750+ );
3751+
3752+ assert_debug_snapshot!(parsed, @r#"
37513753 Config {
37523754 input: Input {
37533755 keyboard: Keyboard {
37543756 xkb: Xkb {
3755- layout: "us,ru".to_owned(),
3756- options: Some("grp:win_space_toggle".to_owned()),
3757- ..Default::default()
3757+ rules: "",
3758+ model: "",
3759+ layout: "us,ru",
3760+ variant: "",
3761+ options: Some(
3762+ "grp:win_space_toggle",
3763+ ),
3764+ file: None,
37583765 },
37593766 repeat_delay: 600,
37603767 repeat_rate: 25,
3761- track_layout: TrackLayout::Window,
3768+ track_layout: Window,
37623769 },
37633770 touchpad: Touchpad {
37643771 off: false,
@@ -3766,169 +3773,380 @@ mod tests {
37663773 dwt: true,
37673774 dwtp: true,
37683775 drag_lock: false,
3769- click_method: Some(ClickMethod::Clickfinger),
37703776 natural_scroll: false,
3777+ click_method: Some(
3778+ Clickfinger,
3779+ ),
37713780 accel_speed: 0.2,
3772- accel_profile: Some(AccelProfile::Flat),
3773- scroll_method: Some(ScrollMethod::TwoFinger),
3774- scroll_button: Some(272),
3775- tap_button_map: Some(TapButtonMap::LeftMiddleRight),
3781+ accel_profile: Some(
3782+ Flat,
3783+ ),
3784+ scroll_method: Some(
3785+ TwoFinger,
3786+ ),
3787+ scroll_button: Some(
3788+ 272,
3789+ ),
3790+ tap_button_map: Some(
3791+ LeftMiddleRight,
3792+ ),
37763793 left_handed: false,
37773794 disabled_on_external_mouse: true,
37783795 middle_emulation: false,
3779- scroll_factor: Some(FloatOrInt(0.9)),
3796+ scroll_factor: Some(
3797+ FloatOrInt(
3798+ 0.9,
3799+ ),
3800+ ),
37803801 },
37813802 mouse: Mouse {
37823803 off: false,
37833804 natural_scroll: true,
37843805 accel_speed: 0.4,
3785- accel_profile: Some(AccelProfile::Flat),
3786- scroll_method: Some(ScrollMethod::NoScroll),
3787- scroll_button: Some(273),
3806+ accel_profile: Some(
3807+ Flat,
3808+ ),
3809+ scroll_method: Some(
3810+ NoScroll,
3811+ ),
3812+ scroll_button: Some(
3813+ 273,
3814+ ),
37883815 left_handed: false,
37893816 middle_emulation: true,
3790- scroll_factor: Some(FloatOrInt(0.2)),
3817+ scroll_factor: Some(
3818+ FloatOrInt(
3819+ 0.2,
3820+ ),
3821+ ),
37913822 },
37923823 trackpoint: Trackpoint {
37933824 off: true,
37943825 natural_scroll: true,
37953826 accel_speed: 0.0,
3796- accel_profile: Some(AccelProfile::Flat),
3797- scroll_method: Some(ScrollMethod::OnButtonDown),
3798- scroll_button: Some(274),
3827+ accel_profile: Some(
3828+ Flat,
3829+ ),
3830+ scroll_method: Some(
3831+ OnButtonDown,
3832+ ),
3833+ scroll_button: Some(
3834+ 274,
3835+ ),
37993836 middle_emulation: false,
38003837 },
38013838 trackball: Trackball {
38023839 off: true,
38033840 natural_scroll: true,
38043841 accel_speed: 0.0,
3805- accel_profile: Some(AccelProfile::Flat),
3806- scroll_method: Some(ScrollMethod::Edge),
3807- scroll_button: Some(275),
3842+ accel_profile: Some(
3843+ Flat,
3844+ ),
3845+ scroll_method: Some(
3846+ Edge,
3847+ ),
3848+ scroll_button: Some(
3849+ 275,
3850+ ),
38083851 left_handed: true,
38093852 middle_emulation: true,
38103853 },
38113854 tablet: Tablet {
38123855 off: false,
3813- calibration_matrix: Some(vec![1., 2., 3.,
3814- 4., 5., 6.]),
3815- map_to_output: Some("eDP-1".to_owned()),
3856+ calibration_matrix: Some(
3857+ [
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+ ),
38163869 left_handed: false,
38173870 },
38183871 touch: Touch {
3819- map_to_output: Some("eDP-1".to_owned()),
3872+ map_to_output: Some(
3873+ "eDP-1",
3874+ ),
38203875 },
38213876 disable_power_key_handling: true,
38223877 warp_mouse_to_focus: true,
3823- focus_follows_mouse: Some(FocusFollowsMouse {
3824- max_scroll_amount: None,
3825- }),
3878+ focus_follows_mouse: Some(
3879+ FocusFollowsMouse {
3880+ max_scroll_amount: None,
3881+ },
3882+ ),
38263883 workspace_auto_back_and_forth: true,
38273884 },
3828- outputs: Outputs(vec![Output {
3829- off: false,
3830- name: "eDP-1".to_owned(),
3831- scale: Some(FloatOrInt(2.)),
3832- transform: Transform::Flipped90,
3833- position: Some(Position { x: 10, y: 20 }),
3834- mode: Some(ConfiguredMode {
3835- width: 1920,
3836- height: 1080,
3837- refresh: Some(144.),
3838- }),
3839- variable_refresh_rate: Some(Vrr { on_demand: true }),
3840- background_color: Color::from_rgba8_unpremul(25, 25, 102, 255),
3841- }]),
3885+ outputs: Outputs(
3886+ [
3887+ Output {
3888+ off: false,
3889+ name: "eDP-1",
3890+ scale: Some(
3891+ FloatOrInt(
3892+ 2.0,
3893+ ),
3894+ ),
3895+ transform: Flipped90,
3896+ position: Some(
3897+ Position {
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+ ],
38423934 layout: Layout {
38433935 focus_ring: FocusRing {
38443936 off: false,
3845- width: FloatOrInt(5.),
3846- active_color: Color::from_rgba8_unpremul(0, 100, 200, 255),
3847- inactive_color: Color::from_rgba8_unpremul(255, 200, 100, 0),
3848- active_gradient: Some(Gradient {
3849- from: Color::from_rgba8_unpremul(10, 20, 30, 255),
3850- to: Color::from_rgba8_unpremul(0, 128, 255, 255),
3851- angle: 180,
3852- relative_to: GradientRelativeTo::WorkspaceView,
3853- in_: GradientInterpolation {
3854- color_space: GradientColorSpace::Srgb,
3855- hue_interpolation: HueInterpolation::Shorter,
3937+ width: FloatOrInt(
3938+ 5.0,
3939+ ),
3940+ active_color: Color {
3941+ r: 0.0,
3942+ g: 0.39215687,
3943+ b: 0.78431374,
3944+ a: 1.0,
3945+ },
3946+ inactive_color: Color {
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+ },
38563972 },
3857- }),
3973+ ),
38583974 inactive_gradient: None,
38593975 },
38603976 border: Border {
38613977 off: false,
3862- width: FloatOrInt(3.),
3863- active_color: Color::from_rgba8_unpremul(255, 200, 127, 255),
3864- inactive_color: Color::from_rgba8_unpremul(255, 200, 100, 0),
3978+ width: FloatOrInt(
3979+ 3.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+ },
38653993 active_gradient: None,
38663994 inactive_gradient: None,
38673995 },
38683996 shadow: Shadow {
3997+ on: false,
38693998 offset: ShadowOffset {
3870- x: FloatOrInt(10.),
3871- y: FloatOrInt(-20.),
3999+ x: FloatOrInt(
4000+ 10.0,
4001+ ),
4002+ y: FloatOrInt(
4003+ -20.0,
4004+ ),
38724005 },
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,
38744020 },
38754021 tab_indicator: TabIndicator {
3876- width: FloatOrInt(10.),
3877- position: TabIndicatorPosition::Top,
3878- ..Default::default()
4022+ off: false,
4023+ hide_when_single_tab: false,
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,
38794047 },
38804048 insert_hint: InsertHint {
38814049 off: false,
3882- color: Color::from_rgba8_unpremul(255, 200, 127, 255),
3883- gradient: Some(Gradient {
3884- from: Color::from_rgba8_unpremul(10, 20, 30, 255),
3885- to: Color::from_rgba8_unpremul(0, 128, 255, 255),
3886- angle: 180,
3887- relative_to: GradientRelativeTo::WorkspaceView,
3888- in_: GradientInterpolation {
3889- color_space: GradientColorSpace::Srgb,
3890- hue_interpolation: HueInterpolation::Shorter,
4050+ color: Color {
4051+ r: 1.0,
4052+ g: 0.78431374,
4053+ b: 0.49803922,
4054+ a: 1.0,
4055+ },
4056+ gradient: Some(
4057+ Gradient {
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+ },
38914076 },
3892- }),
4077+ ),
38934078 },
3894- preset_column_widths: vec![
3895- PresetSize::Proportion(0.25),
3896- PresetSize::Proportion(0.5),
3897- PresetSize::Fixed(960),
3898- PresetSize::Fixed(1280),
4079+ preset_column_widths: [
4080+ Proportion(
4081+ 0.25,
4082+ ),
4083+ Proportion(
4084+ 0.5,
4085+ ),
4086+ Fixed(
4087+ 960,
4088+ ),
4089+ Fixed(
4090+ 1280,
4091+ ),
38994092 ],
3900- default_column_width: Some(DefaultPresetSize(Some(PresetSize::Proportion(
3901- 0.25,
3902- )))),
3903- preset_window_heights: vec![
3904- PresetSize::Proportion(0.25),
3905- PresetSize::Proportion(0.5),
3906- PresetSize::Fixed(960),
3907- PresetSize::Fixed(1280),
4093+ default_column_width: Some(
4094+ DefaultPresetSize(
4095+ Some(
4096+ Proportion(
4097+ 0.25,
4098+ ),
4099+ ),
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+ ),
39084115 ],
3909- gaps: FloatOrInt(8.),
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,
4116+ center_focused_column: OnOverflow,
39184117 always_center_single_column: false,
39194118 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+ },
39204137 },
3921- spawn_at_startup: vec![SpawnAtStartup {
3922- command: vec!["alacritty".to_owned(), "-e".to_owned(), "fish".to_owned()],
3923- }],
39244138 prefer_no_csd: true,
39254139 cursor: Cursor {
3926- xcursor_theme: String::from("breeze_cursors"),
4140+ xcursor_theme: "breeze_cursors",
39274141 xcursor_size: 16,
39284142 hide_when_typing: true,
3929- hide_after_inactive_ms: Some(3000),
4143+ hide_after_inactive_ms: Some(
4144+ 3000,
4145+ ),
39304146 },
3931- screenshot_path: Some(String::from("~/Screenshots/screenshot.png")),
4147+ screenshot_path: Some(
4148+ "~/Screenshots/screenshot.png",
4149+ ),
39324150 clipboard: Clipboard {
39334151 disable_primary: true,
39344152 },
@@ -3936,289 +4154,570 @@ mod tests {
39364154 skip_at_startup: true,
39374155 },
39384156 animations: Animations {
3939- slowdown: 2.,
3940- workspace_switch: WorkspaceSwitchAnim(Animation {
3941- off: false,
3942- kind: AnimationKind::Spring(SpringParams {
3943- damping_ratio: 1.,
3944- stiffness: 1000,
3945- epsilon: 0.0001,
3946- }),
3947- }),
3948- horizontal_view_movement: HorizontalViewMovementAnim(Animation {
3949- off: false,
3950- kind: AnimationKind::Easing(EasingParams {
3951- duration_ms: 100,
3952- curve: AnimationCurve::EaseOutExpo,
3953- }),
3954- }),
4157+ off: false,
4158+ slowdown: 2.0,
4159+ workspace_switch: WorkspaceSwitchAnim(
4160+ Animation {
4161+ off: false,
4162+ kind: Spring(
4163+ SpringParams {
4164+ damping_ratio: 1.0,
4165+ stiffness: 1000,
4166+ epsilon: 0.0001,
4167+ },
4168+ ),
4169+ },
4170+ ),
39554171 window_open: WindowOpenAnim {
39564172 anim: Animation {
39574173 off: true,
3958- ..WindowOpenAnim::default().anim
4174+ kind: Easing(
4175+ EasingParams {
4176+ duration_ms: 150,
4177+ curve: EaseOutExpo,
4178+ },
4179+ ),
39594180 },
39604181 custom_shader: None,
39614182 },
3962- ..Default::default()
3963- },
3964- environment: Environment(vec![
3965- EnvironmentVariable {
3966- name: String::from("QT_QPA_PLATFORM"),
3967- value: Some(String::from("wayland")),
4183+ window_close: WindowCloseAnim {
4184+ anim: Animation {
4185+ off: false,
4186+ kind: Easing(
4187+ EasingParams {
4188+ duration_ms: 150,
4189+ curve: EaseOutQuad,
4190+ },
4191+ ),
4192+ },
4193+ custom_shader: None,
39684194 },
3969- EnvironmentVariable {
3970- name: String::from("DISPLAY"),
3971- value: None,
4195+ horizontal_view_movement: HorizontalViewMovementAnim(
4196+ Animation {
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,
39724230 },
3973- ]),
3974- window_rules: vec![WindowRule {
3975- matches: vec![Match {
3976- app_id: Some(RegexEq::from_str(".*alacritty").unwrap()),
3977- title: None,
3978- is_active: None,
3979- is_focused: None,
3980- is_active_in_column: None,
3981- is_floating: None,
3982- is_window_cast_target: None,
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,
4231+ config_notification_open_close: ConfigNotificationOpenCloseAnim(
4232+ Animation {
4233+ off: false,
4234+ kind: Spring(
4235+ SpringParams {
4236+ damping_ratio: 0.6,
4237+ stiffness: 1000,
4238+ epsilon: 0.001,
4239+ },
4240+ ),
39954241 },
3996- Match {
3997- app_id: None,
3998- title: None,
3999- is_active: Some(true),
4000- is_focused: Some(false),
4001- is_active_in_column: None,
4002- is_floating: None,
4003- is_window_cast_target: None,
4004- at_startup: None,
4242+ ),
4243+ screenshot_ui_open: ScreenshotUiOpenAnim(
4244+ Animation {
4245+ off: false,
4246+ kind: Easing(
4247+ EasingParams {
4248+ duration_ms: 200,
4249+ curve: EaseOutQuad,
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,
40054266 },
40064267 ],
4007- open_on_output: Some("eDP-1".to_owned()),
4008- open_maximized: Some(true),
4009- open_fullscreen: Some(false),
4010- open_floating: Some(false),
4011- open_focused: Some(true),
4012- default_window_height: Some(DefaultPresetSize(Some(PresetSize::Fixed(500)))),
4013- default_column_display: Some(ColumnDisplay::Tabbed),
4014- default_floating_position: Some(FloatingPosition {
4015- x: FloatOrInt(100.),
4016- y: FloatOrInt(-200.),
4017- relative_to: RelativeTo::BottomLeft,
4018- }),
4019- focus_ring: BorderRule {
4020- off: true,
4021- width: Some(FloatOrInt(3.)),
4022- ..Default::default()
4023- },
4024- border: BorderRule {
4025- on: true,
4026- width: Some(FloatOrInt(8.5)),
4027- ..Default::default()
4028- },
4029- tab_indicator: TabIndicatorRule {
4030- active_color: Some(Color::from_rgba8_unpremul(255, 0, 0, 255)),
4031- ..Default::default()
4268+ ),
4269+ window_rules: [
4270+ WindowRule {
4271+ matches: [
4272+ Match {
4273+ app_id: Some(
4274+ RegexEq(
4275+ Regex(
4276+ ".*alacritty",
4277+ ),
4278+ ),
4279+ ),
4280+ title: None,
4281+ is_active: None,
4282+ is_focused: None,
4283+ is_active_in_column: None,
4284+ is_floating: None,
4285+ is_window_cast_target: None,
4286+ at_startup: None,
4287+ },
4288+ ],
4289+ excludes: [
4290+ Match {
4291+ app_id: None,
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,
40324422 },
4033- ..Default::default()
4034- }],
4035- layer_rules: vec![
4423+ ],
4424+ layer_rules: [
40364425 LayerRule {
4037- matches: vec![layer_rule::Match {
4038- namespace: Some(RegexEq::from_str("^notifications$").unwrap()),
4039- at_startup: None,
4040- }],
4041- excludes: vec![],
4426+ matches: [
4427+ Match {
4428+ namespace: Some(
4429+ RegexEq(
4430+ Regex(
4431+ "^notifications$",
4432+ ),
4433+ ),
4434+ ),
4435+ at_startup: None,
4436+ },
4437+ ],
4438+ excludes: [],
40424439 opacity: None,
4043- block_out_from: Some(BlockOutFrom::Screencast),
4044- shadow: ShadowRule::default(),
4440+ block_out_from: Some(
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+ },
40454453 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,
40604454 },
40614455 ],
4062- binds: Binds(vec![
4063- Bind {
4064- key: Key {
4065- trigger: Trigger::Keysym(Keysym::Escape),
4066- modifiers: Modifiers::COMPOSITOR,
4456+ binds: Binds(
4457+ [
4458+ Bind {
4459+ key: Key {
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+ ),
40674477 },
4068- action: Action::ToggleKeyboardShortcutsInhibit,
4069- repeat: true,
4070- cooldown: None,
4071- allow_when_locked: false,
4072- allow_inhibiting: false,
4073- hotkey_overlay_title: Some(Some("Inhibit".to_owned())),
4074- },
4075- Bind {
4076- key: Key {
4077- trigger: Trigger::Keysym(Keysym::Escape),
4078- modifiers: Modifiers::COMPOSITOR | Modifiers::SHIFT,
4478+ Bind {
4479+ key: Key {
4480+ trigger: Keysym(
4481+ XK_Escape,
4482+ ),
4483+ modifiers: Modifiers(
4484+ SHIFT | COMPOSITOR,
4485+ ),
4486+ },
4487+ action: ToggleKeyboardShortcutsInhibit,
4488+ repeat: true,
4489+ cooldown: None,
4490+ allow_when_locked: false,
4491+ allow_inhibiting: false,
4492+ hotkey_overlay_title: None,
40794493 },
4080- action: Action::ToggleKeyboardShortcutsInhibit,
4081- repeat: true,
4082- cooldown: None,
4083- allow_when_locked: false,
4084- allow_inhibiting: false,
4085- hotkey_overlay_title: None,
4086- },
4087- Bind {
4088- key: Key {
4089- trigger: Trigger::Keysym(Keysym::t),
4090- modifiers: Modifiers::COMPOSITOR,
4494+ Bind {
4495+ key: Key {
4496+ trigger: Keysym(
4497+ XK_t,
4498+ ),
4499+ modifiers: Modifiers(
4500+ COMPOSITOR,
4501+ ),
4502+ },
4503+ action: Spawn(
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,
40914513 },
4092- action: Action::Spawn(vec!["alacritty".to_owned()]),
4093- repeat: true,
4094- cooldown: None,
4095- allow_when_locked: true,
4096- allow_inhibiting: true,
4097- hotkey_overlay_title: None,
4098- },
4099- Bind {
4100- key: Key {
4101- trigger: Trigger::Keysym(Keysym::q),
4102- modifiers: Modifiers::COMPOSITOR,
4514+ Bind {
4515+ key: Key {
4516+ trigger: Keysym(
4517+ XK_q,
4518+ ),
4519+ modifiers: Modifiers(
4520+ COMPOSITOR,
4521+ ),
4522+ },
4523+ action: CloseWindow,
4524+ repeat: true,
4525+ cooldown: None,
4526+ allow_when_locked: false,
4527+ allow_inhibiting: true,
4528+ hotkey_overlay_title: Some(
4529+ None,
4530+ ),
41034531 },
4104- action: Action::CloseWindow,
4105- repeat: true,
4106- cooldown: None,
4107- allow_when_locked: false,
4108- allow_inhibiting: true,
4109- hotkey_overlay_title: Some(None),
4110- },
4111- Bind {
4112- key: Key {
4113- trigger: Trigger::Keysym(Keysym::h),
4114- modifiers: Modifiers::COMPOSITOR | Modifiers::SHIFT,
4532+ Bind {
4533+ key: Key {
4534+ trigger: Keysym(
4535+ XK_h,
4536+ ),
4537+ modifiers: Modifiers(
4538+ SHIFT | COMPOSITOR,
4539+ ),
4540+ },
4541+ action: FocusMonitorLeft,
4542+ repeat: true,
4543+ cooldown: None,
4544+ allow_when_locked: false,
4545+ allow_inhibiting: true,
4546+ hotkey_overlay_title: None,
41154547 },
4116- action: Action::FocusMonitorLeft,
4117- repeat: true,
4118- cooldown: None,
4119- allow_when_locked: false,
4120- allow_inhibiting: true,
4121- hotkey_overlay_title: None,
4122- },
4123- Bind {
4124- key: Key {
4125- trigger: Trigger::Keysym(Keysym::l),
4126- modifiers: Modifiers::COMPOSITOR | Modifiers::SHIFT | Modifiers::CTRL,
4548+ Bind {
4549+ key: Key {
4550+ trigger: Keysym(
4551+ XK_l,
4552+ ),
4553+ modifiers: Modifiers(
4554+ CTRL | SHIFT | COMPOSITOR,
4555+ ),
4556+ },
4557+ action: MoveWindowToMonitorRight,
4558+ repeat: true,
4559+ cooldown: None,
4560+ allow_when_locked: false,
4561+ allow_inhibiting: true,
4562+ hotkey_overlay_title: None,
41274563 },
4128- action: Action::MoveWindowToMonitorRight,
4129- repeat: true,
4130- cooldown: None,
4131- allow_when_locked: false,
4132- allow_inhibiting: true,
4133- hotkey_overlay_title: None,
4134- },
4135- Bind {
4136- key: Key {
4137- trigger: Trigger::Keysym(Keysym::comma),
4138- modifiers: Modifiers::COMPOSITOR,
4564+ Bind {
4565+ key: Key {
4566+ trigger: Keysym(
4567+ XK_comma,
4568+ ),
4569+ modifiers: Modifiers(
4570+ COMPOSITOR,
4571+ ),
4572+ },
4573+ action: ConsumeWindowIntoColumn,
4574+ repeat: true,
4575+ cooldown: None,
4576+ allow_when_locked: false,
4577+ allow_inhibiting: true,
4578+ hotkey_overlay_title: None,
41394579 },
4140- action: Action::ConsumeWindowIntoColumn,
4141- repeat: true,
4142- cooldown: None,
4143- allow_when_locked: false,
4144- allow_inhibiting: true,
4145- hotkey_overlay_title: None,
4146- },
4147- Bind {
4148- key: Key {
4149- trigger: Trigger::Keysym(Keysym::_1),
4150- modifiers: Modifiers::COMPOSITOR,
4580+ Bind {
4581+ key: Key {
4582+ trigger: Keysym(
4583+ XK_1,
4584+ ),
4585+ modifiers: Modifiers(
4586+ COMPOSITOR,
4587+ ),
4588+ },
4589+ action: FocusWorkspace(
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,
41514599 },
4152- action: Action::FocusWorkspace(WorkspaceReference::Index(1)),
4153- repeat: true,
4154- cooldown: None,
4155- allow_when_locked: false,
4156- allow_inhibiting: true,
4157- hotkey_overlay_title: None,
4158- },
4159- Bind {
4160- key: Key {
4161- trigger: Trigger::Keysym(Keysym::_1),
4162- modifiers: Modifiers::COMPOSITOR | Modifiers::SHIFT,
4600+ Bind {
4601+ key: Key {
4602+ trigger: Keysym(
4603+ XK_1,
4604+ ),
4605+ modifiers: Modifiers(
4606+ SHIFT | COMPOSITOR,
4607+ ),
4608+ },
4609+ action: FocusWorkspace(
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,
41634619 },
4164- action: Action::FocusWorkspace(WorkspaceReference::Name(
4165- "workspace-1".to_string(),
4166- )),
4167- repeat: true,
4168- cooldown: None,
4169- allow_when_locked: false,
4170- allow_inhibiting: true,
4171- hotkey_overlay_title: None,
4172- },
4173- Bind {
4174- key: Key {
4175- trigger: Trigger::Keysym(Keysym::e),
4176- modifiers: Modifiers::COMPOSITOR | Modifiers::SHIFT,
4620+ Bind {
4621+ key: Key {
4622+ trigger: Keysym(
4623+ XK_e,
4624+ ),
4625+ modifiers: Modifiers(
4626+ SHIFT | COMPOSITOR,
4627+ ),
4628+ },
4629+ action: Quit(
4630+ true,
4631+ ),
4632+ repeat: true,
4633+ cooldown: None,
4634+ allow_when_locked: false,
4635+ allow_inhibiting: false,
4636+ hotkey_overlay_title: None,
41774637 },
4178- action: Action::Quit(true),
4179- repeat: true,
4180- cooldown: None,
4181- allow_when_locked: false,
4182- allow_inhibiting: false,
4183- hotkey_overlay_title: None,
4184- },
4185- Bind {
4186- key: Key {
4187- trigger: Trigger::WheelScrollDown,
4188- modifiers: Modifiers::COMPOSITOR,
4638+ Bind {
4639+ key: Key {
4640+ trigger: WheelScrollDown,
4641+ modifiers: Modifiers(
4642+ COMPOSITOR,
4643+ ),
4644+ },
4645+ action: FocusWorkspaceDown,
4646+ repeat: true,
4647+ cooldown: Some(
4648+ 150ms,
4649+ ),
4650+ allow_when_locked: false,
4651+ allow_inhibiting: true,
4652+ hotkey_overlay_title: None,
41894653 },
4190- action: Action::FocusWorkspaceDown,
4191- repeat: true,
4192- cooldown: Some(Duration::from_millis(150)),
4193- allow_when_locked: false,
4194- allow_inhibiting: true,
4195- hotkey_overlay_title: None,
4196- },
4197- ]),
4654+ ],
4655+ ),
41984656 switch_events: SwitchBinds {
41994657 lid_open: None,
42004658 lid_close: None,
4201- tablet_mode_on: Some(SwitchAction {
4202- spawn: vec![
4203- "bash".to_owned(),
4204- "-c".to_owned(),
4205- "gsettings set org.gnome.desktop.a11y.applications screen-keyboard-enabled true".to_owned(),
4206- ],
4207- }),
4208- tablet_mode_off: Some(SwitchAction {
4209- spawn: vec![
4210- "bash".to_owned(),
4211- "-c".to_owned(),
4212- "gsettings set org.gnome.desktop.a11y.applications screen-keyboard-enabled false".to_owned(),
4213- ],
4214- }),
4659+ tablet_mode_on: Some(
4660+ SwitchAction {
4661+ spawn: [
4662+ "bash",
4663+ "-c",
4664+ "gsettings set org.gnome.desktop.a11y.applications screen-keyboard-enabled true",
4665+ ],
4666+ },
4667+ ),
4668+ tablet_mode_off: Some(
4669+ SwitchAction {
4670+ spawn: [
4671+ "bash",
4672+ "-c",
4673+ "gsettings set org.gnome.desktop.a11y.applications screen-keyboard-enabled false",
4674+ ],
4675+ },
4676+ ),
42154677 },
42164678 debug: DebugConfig {
4217- render_drm_device: Some(PathBuf::from("/dev/dri/renderD129")),
4218- ..Default::default()
4679+ preview_render: None,
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,
42194696 },
4220- },
4221- );
4697+ workspaces: [
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+ "#);
42224721 }
42234722
42244723 #[test]