oxwm

https://git.tonybtw.com/oxwm.git git://git.tonybtw.com/oxwm.git

implement Debug for Config

Commit
e0b781ffdaee6982a31f591096ff7972bd9e81ca
Parent
bb500f4
Author
emzywastaken <amiamemetoo@gmail.com>
Date
2025-12-12 20:25:15

Diff

diff --git a/src/bar/blocks/mod.rs b/src/bar/blocks/mod.rs
index b6d9a9c..b941529 100644
--- a/src/bar/blocks/mod.rs
+++ b/src/bar/blocks/mod.rs
@@ -17,7 +17,7 @@ pub trait Block {
     fn color(&self) -> u32;
 }
 
-#[derive(Clone)]
+#[derive(Debug, Clone)]
 pub struct BlockConfig {
     pub format: String,
     pub command: BlockCommand,
@@ -26,7 +26,7 @@ pub struct BlockConfig {
     pub underline: bool,
 }
 
-#[derive(Clone)]
+#[derive(Debug, Clone)]
 pub enum BlockCommand {
     Shell(String),
     DateTime(String),
diff --git a/src/keyboard/handlers.rs b/src/keyboard/handlers.rs
index 8ae083a..52a4a4f 100644
--- a/src/keyboard/handlers.rs
+++ b/src/keyboard/handlers.rs
@@ -5,7 +5,7 @@ use x11rb::connection::Connection;
 use x11rb::protocol::xproto::*;
 
 use crate::errors::X11Error;
-use crate::keyboard::keysyms::{self, Keysym};
+use crate::keyboard::keysyms::{self, Keysym, format_keysym};
 
 #[derive(Debug, Copy, Clone, Deserialize, PartialEq)]
 pub enum KeyAction {
@@ -47,13 +47,22 @@ impl Arg {
     }
 }
 
-#[derive(Clone, Debug)]
+#[derive(Clone)]
 pub struct KeyPress {
     pub(crate) modifiers: Vec<KeyButMask>,
     pub(crate) keysym: Keysym,
 }
 
-#[derive(Clone)]
+impl std::fmt::Debug for KeyPress {
+    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+        f.debug_struct("KeyPress")
+            .field("modifiers", &self.modifiers)
+            .field("keysym", &format_keysym(self.keysym))
+            .finish()
+    }
+}
+
+#[derive(Debug, Clone)]
 pub struct KeyBinding {
     pub(crate) keys: Vec<KeyPress>,
     pub(crate) func: KeyAction,
diff --git a/src/lib.rs b/src/lib.rs
index 2dbe786..4621da7 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -20,13 +20,13 @@ pub mod prelude {
     pub use x11rb::protocol::xproto::KeyButMask;
 }
 
-#[derive(Clone)]
+#[derive(Debug, Clone)]
 pub struct LayoutSymbolOverride {
     pub name: String,
     pub symbol: String,
 }
 
-#[derive(Clone)]
+#[derive(Debug, Clone)]
 pub struct WindowRule {
     pub class: Option<String>,
     pub instance: Option<String>,
@@ -54,7 +54,7 @@ impl WindowRule {
     }
 }
 
-#[derive(Clone)]
+#[derive(Debug, Clone)]
 pub struct Config {
     // Appearance
     pub border_width: u32,
@@ -98,7 +98,7 @@ pub struct Config {
     pub autostart: Vec<String>,
 }
 
-#[derive(Clone, Copy)]
+#[derive(Debug, Clone, Copy)]
 pub struct ColorScheme {
     pub foreground: u32,
     pub background: u32,