config: Extract debug

This commit is contained in:
Ivan Molodetskikh
2025-08-27 10:36:45 +03:00
parent 3c11004515
commit 66584ab466
3 changed files with 54 additions and 50 deletions

49
niri-config/src/debug.rs Normal file
View File

@@ -0,0 +1,49 @@
use std::path::PathBuf;
#[derive(knuffel::Decode, Debug, Default, PartialEq)]
pub struct DebugConfig {
#[knuffel(child, unwrap(argument))]
pub preview_render: Option<PreviewRender>,
#[knuffel(child)]
pub dbus_interfaces_in_non_session_instances: bool,
#[knuffel(child)]
pub wait_for_frame_completion_before_queueing: bool,
#[knuffel(child)]
pub enable_overlay_planes: bool,
#[knuffel(child)]
pub disable_cursor_plane: bool,
#[knuffel(child)]
pub disable_direct_scanout: bool,
#[knuffel(child)]
pub keep_max_bpc_unchanged: bool,
#[knuffel(child)]
pub restrict_primary_scanout_to_matching_format: bool,
#[knuffel(child, unwrap(argument))]
pub render_drm_device: Option<PathBuf>,
#[knuffel(child)]
pub force_pipewire_invalid_modifier: bool,
#[knuffel(child)]
pub emulate_zero_presentation_time: bool,
#[knuffel(child)]
pub disable_resize_throttling: bool,
#[knuffel(child)]
pub disable_transactions: bool,
#[knuffel(child)]
pub keep_laptop_panel_on_when_lid_is_closed: bool,
#[knuffel(child)]
pub disable_monitor_names: bool,
#[knuffel(child)]
pub strict_new_window_focus_policy: bool,
#[knuffel(child)]
pub honor_xdg_activation_with_invalid_serial: bool,
#[knuffel(child)]
pub deactivate_unfocused_windows: bool,
#[knuffel(child)]
pub skip_cursor_only_updates_during_vrr: bool,
}
#[derive(knuffel::DecodeScalar, Debug, Clone, Copy, PartialEq, Eq)]
pub enum PreviewRender {
Screencast,
ScreenCapture,
}

View File

@@ -21,6 +21,7 @@ use smithay::input::keyboard::Keysym;
pub mod animations;
pub mod appearance;
pub mod debug;
pub mod gestures;
pub mod input;
pub mod layer_rule;
@@ -33,6 +34,7 @@ pub use crate::animations::{
Animation, AnimationCurve, AnimationKind, Animations, EasingParams, SpringParams,
};
pub use crate::appearance::*;
pub use crate::debug::DebugConfig;
pub use crate::gestures::Gestures;
pub use crate::input::{Input, ModKey, ScrollMethod, TrackLayout, WarpMouseToFocusMode, Xkb};
pub use crate::layer_rule::LayerRule;
@@ -938,54 +940,6 @@ impl<S: knuffel::traits::ErrorSpan, const MIN: i32, const MAX: i32> knuffel::Dec
}
}
#[derive(knuffel::Decode, Debug, Default, PartialEq)]
pub struct DebugConfig {
#[knuffel(child, unwrap(argument))]
pub preview_render: Option<PreviewRender>,
#[knuffel(child)]
pub dbus_interfaces_in_non_session_instances: bool,
#[knuffel(child)]
pub wait_for_frame_completion_before_queueing: bool,
#[knuffel(child)]
pub enable_overlay_planes: bool,
#[knuffel(child)]
pub disable_cursor_plane: bool,
#[knuffel(child)]
pub disable_direct_scanout: bool,
#[knuffel(child)]
pub keep_max_bpc_unchanged: bool,
#[knuffel(child)]
pub restrict_primary_scanout_to_matching_format: bool,
#[knuffel(child, unwrap(argument))]
pub render_drm_device: Option<PathBuf>,
#[knuffel(child)]
pub force_pipewire_invalid_modifier: bool,
#[knuffel(child)]
pub emulate_zero_presentation_time: bool,
#[knuffel(child)]
pub disable_resize_throttling: bool,
#[knuffel(child)]
pub disable_transactions: bool,
#[knuffel(child)]
pub keep_laptop_panel_on_when_lid_is_closed: bool,
#[knuffel(child)]
pub disable_monitor_names: bool,
#[knuffel(child)]
pub strict_new_window_focus_policy: bool,
#[knuffel(child)]
pub honor_xdg_activation_with_invalid_serial: bool,
#[knuffel(child)]
pub deactivate_unfocused_windows: bool,
#[knuffel(child)]
pub skip_cursor_only_updates_during_vrr: bool,
}
#[derive(knuffel::DecodeScalar, Debug, Clone, Copy, PartialEq, Eq)]
pub enum PreviewRender {
Screencast,
ScreenCapture,
}
#[derive(Debug, Clone)]
pub enum ConfigPath {
/// Explicitly set config path.

View File

@@ -13,9 +13,10 @@ use std::{env, mem, thread};
use _server_decoration::server::org_kde_kwin_server_decoration_manager::Mode as KdeDecorationsMode;
use anyhow::{bail, ensure, Context};
use calloop::futures::Scheduler;
use niri_config::debug::PreviewRender;
use niri_config::{
Config, FloatOrInt, Key, Modifiers, OutputName, PreviewRender, TrackLayout,
WarpMouseToFocusMode, WorkspaceReference, Xkb,
Config, FloatOrInt, Key, Modifiers, OutputName, TrackLayout, WarpMouseToFocusMode,
WorkspaceReference, Xkb,
};
use smithay::backend::allocator::Fourcc;
use smithay::backend::input::Keycode;