| 1 | pub mod bar; |
| 2 | pub mod keyboard; |
| 3 | pub mod layout; |
| 4 | pub mod window_manager; |
| 5 | |
| 6 | pub mod prelude { |
| 7 | pub use crate::ColorScheme; |
| 8 | pub use crate::bar::{BlockCommand, BlockConfig}; |
| 9 | pub use crate::keyboard::{Arg, KeyAction, handlers::Key, keycodes}; |
| 10 | pub use x11rb::protocol::xproto::KeyButMask; |
| 11 | } |
| 12 | |
| 13 | #[derive(Clone)] |
| 14 | pub struct Config { |
| 15 | // Appearance |
| 16 | pub border_width: u32, |
| 17 | pub border_focused: u32, |
| 18 | pub border_unfocused: u32, |
| 19 | pub font: String, |
| 20 | |
| 21 | // Gaps |
| 22 | pub gaps_enabled: bool, |
| 23 | pub gap_inner_horizontal: u32, |
| 24 | pub gap_inner_vertical: u32, |
| 25 | pub gap_outer_horizontal: u32, |
| 26 | pub gap_outer_vertical: u32, |
| 27 | |
| 28 | // Basics |
| 29 | pub terminal: String, |
| 30 | pub modkey: x11rb::protocol::xproto::KeyButMask, |
| 31 | |
| 32 | // Tags |
| 33 | pub tags: Vec<String>, |
| 34 | |
| 35 | // Keybindings |
| 36 | pub keybindings: Vec<crate::keyboard::handlers::Key>, |
| 37 | |
| 38 | // Status bar |
| 39 | pub status_blocks: Vec<crate::bar::BlockConfig>, |
| 40 | |
| 41 | // Bar color schemes |
| 42 | pub scheme_normal: ColorScheme, |
| 43 | pub scheme_occupied: ColorScheme, |
| 44 | pub scheme_selected: ColorScheme, |
| 45 | } |
| 46 | |
| 47 | #[derive(Clone, Copy)] |
| 48 | pub struct ColorScheme { |
| 49 | pub foreground: u32, |
| 50 | pub background: u32, |
| 51 | pub underline: u32, |
| 52 | } |
| 53 | |
| 54 | impl Default for Config { |
| 55 | fn default() -> Self { |
| 56 | Self { |
| 57 | border_width: 2, |
| 58 | border_focused: 0x6dade3, |
| 59 | border_unfocused: 0xbbbbbb, |
| 60 | font: "monospace:size=12".to_string(), |
| 61 | gaps_enabled: false, |
| 62 | gap_inner_horizontal: 0, |
| 63 | gap_inner_vertical: 0, |
| 64 | gap_outer_horizontal: 0, |
| 65 | gap_outer_vertical: 0, |
| 66 | terminal: "xterm".to_string(), |
| 67 | modkey: x11rb::protocol::xproto::KeyButMask::MOD4, |
| 68 | tags: vec!["1", "2", "3", "4", "5", "6", "7", "8", "9"] |
| 69 | .into_iter() |
| 70 | .map(String::from) |
| 71 | .collect(), |
| 72 | keybindings: Vec::new(), |
| 73 | status_blocks: Vec::new(), |
| 74 | scheme_normal: ColorScheme { |
| 75 | foreground: 0xbbbbbb, |
| 76 | background: 0x1a1b26, |
| 77 | underline: 0x444444, |
| 78 | }, |
| 79 | scheme_occupied: ColorScheme { |
| 80 | foreground: 0x0db9d7, |
| 81 | background: 0x1a1b26, |
| 82 | underline: 0x0db9d7, |
| 83 | }, |
| 84 | scheme_selected: ColorScheme { |
| 85 | foreground: 0x0db9d7, |
| 86 | background: 0x1a1b26, |
| 87 | underline: 0xad8ee6, |
| 88 | }, |
| 89 | } |
| 90 | } |
| 91 | } |