config: Extract debug
Browse files at this commit66584ab466dfb0563708ac80a5f10dbc9fcde562Parent: 3c110043 changed files +54 -50
- niri-config/src/debug.rs +49 -0
- niri-config/src/lib.rs +2 -48
- src/niri.rs +3 -2
niri-config/src/debug.rsadded+49 -0
| @@ -0,0 +1,49 @@ | |||
| 1 | +use std::path::PathBuf; | ||
| 2 | + | ||
| 3 | +#[derive(knuffel::Decode, Debug, Default, PartialEq)] | ||
| 4 | +pub struct DebugConfig { | ||
| 5 | + #[knuffel(child, unwrap(argument))] | ||
| 6 | + pub preview_render: Option<PreviewRender>, | ||
| 7 | + #[knuffel(child)] | ||
| 8 | + pub dbus_interfaces_in_non_session_instances: bool, | ||
| 9 | + #[knuffel(child)] | ||
| 10 | + pub wait_for_frame_completion_before_queueing: bool, | ||
| 11 | + #[knuffel(child)] | ||
| 12 | + pub enable_overlay_planes: bool, | ||
| 13 | + #[knuffel(child)] | ||
| 14 | + pub disable_cursor_plane: bool, | ||
| 15 | + #[knuffel(child)] | ||
| 16 | + pub disable_direct_scanout: bool, | ||
| 17 | + #[knuffel(child)] | ||
| 18 | + pub keep_max_bpc_unchanged: bool, | ||
| 19 | + #[knuffel(child)] | ||
| 20 | + pub restrict_primary_scanout_to_matching_format: bool, | ||
| 21 | + #[knuffel(child, unwrap(argument))] | ||
| 22 | + pub render_drm_device: Option<PathBuf>, | ||
| 23 | + #[knuffel(child)] | ||
| 24 | + pub force_pipewire_invalid_modifier: bool, | ||
| 25 | + #[knuffel(child)] | ||
| 26 | + pub emulate_zero_presentation_time: bool, | ||
| 27 | + #[knuffel(child)] | ||
| 28 | + pub disable_resize_throttling: bool, | ||
| 29 | + #[knuffel(child)] | ||
| 30 | + pub disable_transactions: bool, | ||
| 31 | + #[knuffel(child)] | ||
| 32 | + pub keep_laptop_panel_on_when_lid_is_closed: bool, | ||
| 33 | + #[knuffel(child)] | ||
| 34 | + pub disable_monitor_names: bool, | ||
| 35 | + #[knuffel(child)] | ||
| 36 | + pub strict_new_window_focus_policy: bool, | ||
| 37 | + #[knuffel(child)] | ||
| 38 | + pub honor_xdg_activation_with_invalid_serial: bool, | ||
| 39 | + #[knuffel(child)] | ||
| 40 | + pub deactivate_unfocused_windows: bool, | ||
| 41 | + #[knuffel(child)] | ||
| 42 | + pub skip_cursor_only_updates_during_vrr: bool, | ||
| 43 | +} | ||
| 44 | + | ||
| 45 | +#[derive(knuffel::DecodeScalar, Debug, Clone, Copy, PartialEq, Eq)] | ||
| 46 | +pub enum PreviewRender { | ||
| 47 | + Screencast, | ||
| 48 | + ScreenCapture, | ||
| 49 | +} | ||
niri-config/src/lib.rsmodified+2 -48
| @@ -21,6 +21,7 @@ use smithay::input::keyboard::Keysym; | |||
| 21 | 21 | ||
| 22 | pub mod animations; | 22 | pub mod animations; |
| 23 | pub mod appearance; | 23 | pub mod appearance; |
| 24 | +pub mod debug; | ||
| 24 | pub mod gestures; | 25 | pub mod gestures; |
| 25 | pub mod input; | 26 | pub mod input; |
| 26 | pub mod layer_rule; | 27 | pub mod layer_rule; |
| @@ -33,6 +34,7 @@ pub use crate::animations::{ | |||
| 33 | Animation, AnimationCurve, AnimationKind, Animations, EasingParams, SpringParams, | 34 | Animation, AnimationCurve, AnimationKind, Animations, EasingParams, SpringParams, |
| 34 | }; | 35 | }; |
| 35 | pub use crate::appearance::*; | 36 | pub use crate::appearance::*; |
| 37 | +pub use crate::debug::DebugConfig; | ||
| 36 | pub use crate::gestures::Gestures; | 38 | pub use crate::gestures::Gestures; |
| 37 | pub use crate::input::{Input, ModKey, ScrollMethod, TrackLayout, WarpMouseToFocusMode, Xkb}; | 39 | pub use crate::input::{Input, ModKey, ScrollMethod, TrackLayout, WarpMouseToFocusMode, Xkb}; |
| 38 | pub use crate::layer_rule::LayerRule; | 40 | pub use crate::layer_rule::LayerRule; |
| @@ -938,54 +940,6 @@ impl<S: knuffel::traits::ErrorSpan, const MIN: i32, const MAX: i32> knuffel::Dec | |||
| 938 | } | 940 | } |
| 939 | } | 941 | } |
| 940 | 942 | ||
| 941 | -#[derive(knuffel::Decode, Debug, Default, PartialEq)] | ||
| 942 | -pub struct DebugConfig { | ||
| 943 | - #[knuffel(child, unwrap(argument))] | ||
| 944 | - pub preview_render: Option<PreviewRender>, | ||
| 945 | - #[knuffel(child)] | ||
| 946 | - pub dbus_interfaces_in_non_session_instances: bool, | ||
| 947 | - #[knuffel(child)] | ||
| 948 | - pub wait_for_frame_completion_before_queueing: bool, | ||
| 949 | - #[knuffel(child)] | ||
| 950 | - pub enable_overlay_planes: bool, | ||
| 951 | - #[knuffel(child)] | ||
| 952 | - pub disable_cursor_plane: bool, | ||
| 953 | - #[knuffel(child)] | ||
| 954 | - pub disable_direct_scanout: bool, | ||
| 955 | - #[knuffel(child)] | ||
| 956 | - pub keep_max_bpc_unchanged: bool, | ||
| 957 | - #[knuffel(child)] | ||
| 958 | - pub restrict_primary_scanout_to_matching_format: bool, | ||
| 959 | - #[knuffel(child, unwrap(argument))] | ||
| 960 | - pub render_drm_device: Option<PathBuf>, | ||
| 961 | - #[knuffel(child)] | ||
| 962 | - pub force_pipewire_invalid_modifier: bool, | ||
| 963 | - #[knuffel(child)] | ||
| 964 | - pub emulate_zero_presentation_time: bool, | ||
| 965 | - #[knuffel(child)] | ||
| 966 | - pub disable_resize_throttling: bool, | ||
| 967 | - #[knuffel(child)] | ||
| 968 | - pub disable_transactions: bool, | ||
| 969 | - #[knuffel(child)] | ||
| 970 | - pub keep_laptop_panel_on_when_lid_is_closed: bool, | ||
| 971 | - #[knuffel(child)] | ||
| 972 | - pub disable_monitor_names: bool, | ||
| 973 | - #[knuffel(child)] | ||
| 974 | - pub strict_new_window_focus_policy: bool, | ||
| 975 | - #[knuffel(child)] | ||
| 976 | - pub honor_xdg_activation_with_invalid_serial: bool, | ||
| 977 | - #[knuffel(child)] | ||
| 978 | - pub deactivate_unfocused_windows: bool, | ||
| 979 | - #[knuffel(child)] | ||
| 980 | - pub skip_cursor_only_updates_during_vrr: bool, | ||
| 981 | -} | ||
| 982 | - | ||
| 983 | -#[derive(knuffel::DecodeScalar, Debug, Clone, Copy, PartialEq, Eq)] | ||
| 984 | -pub enum PreviewRender { | ||
| 985 | - Screencast, | ||
| 986 | - ScreenCapture, | ||
| 987 | -} | ||
| 988 | - | ||
| 989 | #[derive(Debug, Clone)] | 943 | #[derive(Debug, Clone)] |
| 990 | pub enum ConfigPath { | 944 | pub enum ConfigPath { |
| 991 | /// Explicitly set config path. | 945 | /// Explicitly set config path. |
src/niri.rsmodified+3 -2
| @@ -13,9 +13,10 @@ use std::{env, mem, thread}; | |||
| 13 | use _server_decoration::server::org_kde_kwin_server_decoration_manager::Mode as KdeDecorationsMode; | 13 | use _server_decoration::server::org_kde_kwin_server_decoration_manager::Mode as KdeDecorationsMode; |
| 14 | use anyhow::{bail, ensure, Context}; | 14 | use anyhow::{bail, ensure, Context}; |
| 15 | use calloop::futures::Scheduler; | 15 | use calloop::futures::Scheduler; |
| 16 | +use niri_config::debug::PreviewRender; | ||
| 16 | use niri_config::{ | 17 | use niri_config::{ |
| 17 | - Config, FloatOrInt, Key, Modifiers, OutputName, PreviewRender, TrackLayout, | 18 | + Config, FloatOrInt, Key, Modifiers, OutputName, TrackLayout, WarpMouseToFocusMode, |
| 18 | - WarpMouseToFocusMode, WorkspaceReference, Xkb, | 19 | + WorkspaceReference, Xkb, |
| 19 | }; | 20 | }; |
| 20 | use smithay::backend::allocator::Fourcc; | 21 | use smithay::backend::allocator::Fourcc; |
| 21 | use smithay::backend::input::Keycode; | 22 | use smithay::backend::input::Keycode; |