tony / oxwm

implement Debug for Config Browse files
emzywastaken committed 2025-12-12 parent bb500f4 commit e0b781ffdaee6982a31f591096ff7972bd9e81ca
Showing 3 changed files with 18 additions and 9 deletions. UnifiedSplit
+2 −2 src/bar/blocks/mod.rs
@@ -17,7 +17,7 @@ pub trait Block {
17 17 fn color(&self) -> u32;
18 18 }
19 19
20 -#[derive(Clone)]
20 +#[derive(Debug, Clone)]
21 21 pub struct BlockConfig {
22 22 pub format: String,
23 23 pub command: BlockCommand,
@@ -26,7 +26,7 @@ pub struct BlockConfig {
26 26 pub underline: bool,
27 27 }
28 28
29 -#[derive(Clone)]
29 +#[derive(Debug, Clone)]
30 30 pub enum BlockCommand {
31 31 Shell(String),
32 32 DateTime(String),
+12 −3 src/keyboard/handlers.rs
@@ -5,7 +5,7 @@ use x11rb::connection::Connection;
5 5 use x11rb::protocol::xproto::*;
6 6
7 7 use crate::errors::X11Error;
8 -use crate::keyboard::keysyms::{self, Keysym};
8 +use crate::keyboard::keysyms::{self, Keysym, format_keysym};
9 9
10 10 #[derive(Debug, Copy, Clone, Deserialize, PartialEq)]
11 11 pub enum KeyAction {
@@ -47,13 +47,22 @@ impl Arg {
47 47 }
48 48 }
49 49
50 -#[derive(Clone, Debug)]
50 +#[derive(Clone)]
51 51 pub struct KeyPress {
52 52 pub(crate) modifiers: Vec<KeyButMask>,
53 53 pub(crate) keysym: Keysym,
54 54 }
55 55
56 -#[derive(Clone)]
56 +impl std::fmt::Debug for KeyPress {
57 + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
58 + f.debug_struct("KeyPress")
59 + .field("modifiers", &self.modifiers)
60 + .field("keysym", &format_keysym(self.keysym))
61 + .finish()
62 + }
63 +}
64 +
65 +#[derive(Debug, Clone)]
57 66 pub struct KeyBinding {
58 67 pub(crate) keys: Vec<KeyPress>,
59 68 pub(crate) func: KeyAction,
+4 −4 src/lib.rs
@@ -20,13 +20,13 @@ pub mod prelude {
20 20 pub use x11rb::protocol::xproto::KeyButMask;
21 21 }
22 22
23 -#[derive(Clone)]
23 +#[derive(Debug, Clone)]
24 24 pub struct LayoutSymbolOverride {
25 25 pub name: String,
26 26 pub symbol: String,
27 27 }
28 28
29 -#[derive(Clone)]
29 +#[derive(Debug, Clone)]
30 30 pub struct WindowRule {
31 31 pub class: Option<String>,
32 32 pub instance: Option<String>,
@@ -54,7 +54,7 @@ impl WindowRule {
54 54 }
55 55 }
56 56
57 -#[derive(Clone)]
57 +#[derive(Debug, Clone)]
58 58 pub struct Config {
59 59 // Appearance
60 60 pub border_width: u32,
@@ -98,7 +98,7 @@ pub struct Config {
98 98 pub autostart: Vec<String>,
99 99 }
100 100
101 -#[derive(Clone, Copy)]
101 +#[derive(Debug, Clone, Copy)]
102 102 pub struct ColorScheme {
103 103 pub foreground: u32,
104 104 pub background: u32,