tony / oxwm

Branch: 06c6741
Switch branches/tags
master
tonybtw Restructured blocks to be more sane.. 06c6741 2025-10-04
151 lines · 5.2 KB Raw Blame History
1 use crate::bar::{BlockCommand, BlockConfig};
2 use crate::keyboard::handlers::Key;
3 use crate::keyboard::{Arg, KeyAction, keycodes};
4 use x11rb::protocol::xproto::KeyButMask;
5
6 // ========================================
7 // APPEARANCE
8 // ========================================
9 pub const BORDER_WIDTH: u32 = 1;
10 pub const BORDER_FOCUSED: u32 = 0x6dade3;
11 pub const BORDER_UNFOCUSED: u32 = 0xbbbbbb;
12 pub const FONT: &str = "JetBrainsMono Nerd Font:style=Bold:size=14";
13
14 // ========================================
15 // DEFAULTS
16 // ========================================
17 pub const TERMINAL: &str = "alacritty";
18 pub const MODKEY: KeyButMask = KeyButMask::MOD1;
19
20 // ========================================
21 // BAR COLORS
22 // ========================================
23
24 // Base colors
25 const GRAY_DARK: u32 = 0x222222;
26 const GRAY_MID: u32 = 0x444444;
27 const GRAY_LIGHT: u32 = 0xbbbbbb;
28 const CYAN: u32 = 0x0db9d7;
29 const MAGENTA: u32 = 0xad8ee6;
30 const RED: u32 = 0xf7768e;
31 const GREEN: u32 = 0x9ece6a;
32 const BLUE: u32 = 0x7aa2f7;
33 const YELLOW: u32 = 0xe0af68;
34
35 pub struct ColorScheme {
36 pub foreground: u32,
37 pub background: u32,
38 pub border: u32,
39 }
40
41 pub const SCHEME_NORMAL: ColorScheme = ColorScheme {
42 foreground: GRAY_LIGHT,
43 background: GRAY_DARK,
44 border: GRAY_MID,
45 };
46
47 pub const SCHEME_OCCUPIED: ColorScheme = ColorScheme {
48 foreground: CYAN,
49 background: GRAY_DARK,
50 border: CYAN,
51 };
52
53 pub const SCHEME_SELECTED: ColorScheme = ColorScheme {
54 foreground: CYAN,
55 background: GRAY_DARK,
56 border: MAGENTA,
57 };
58
59 // ========================================
60 // Commands
61 // ========================================
62 const SCREENSHOT_CMD: &[&str] = &[
63 "sh",
64 "-c",
65 "maim ~/screenshots/screenshot_$(date +%Y%m%d_%H%M%S).png",
66 ];
67
68 const DMENU_CMD: &[&str] = &["sh", "-c", "dmenu_run -l 10"];
69
70 // ========================================
71 // TAGS
72 // ========================================
73 pub const TAG_COUNT: usize = 9;
74 pub const TAGS: [&str; TAG_COUNT] = ["1", "2", "3", "4", "5", "6", "7", "8", "9"];
75
76 // ========================================
77 // KEYBINDINGS
78 // ========================================
79 #[rustfmt::skip]
80 pub const KEYBINDINGS: &[Key] = &[
81 Key::new(&[MODKEY], keycodes::RETURN, KeyAction::Spawn, Arg::Str(TERMINAL)),
82
83 Key::new(&[MODKEY], keycodes::S, KeyAction::Spawn, Arg::Array(SCREENSHOT_CMD)),
84 Key::new(&[MODKEY], keycodes::D, KeyAction::Spawn, Arg::Array(DMENU_CMD)),
85 Key::new(&[MODKEY], keycodes::Q, KeyAction::KillClient, Arg::None),
86 Key::new(&[MODKEY, SHIFT], keycodes::Q, KeyAction::Quit, Arg::None),
87 Key::new(&[MODKEY], keycodes::J, KeyAction::FocusStack, Arg::Int(-1)),
88 Key::new(&[MODKEY], keycodes::K, KeyAction::FocusStack, Arg::Int(1)),
89
90 Key::new(&[MODKEY], keycodes::KEY_1, KeyAction::ViewTag, Arg::Int(0)),
91 Key::new(&[MODKEY], keycodes::KEY_2, KeyAction::ViewTag, Arg::Int(1)),
92 Key::new(&[MODKEY], keycodes::KEY_3, KeyAction::ViewTag, Arg::Int(2)),
93 Key::new(&[MODKEY], keycodes::KEY_4, KeyAction::ViewTag, Arg::Int(3)),
94 Key::new(&[MODKEY], keycodes::KEY_5, KeyAction::ViewTag, Arg::Int(4)),
95 Key::new(&[MODKEY], keycodes::KEY_6, KeyAction::ViewTag, Arg::Int(5)),
96 Key::new(&[MODKEY], keycodes::KEY_7, KeyAction::ViewTag, Arg::Int(6)),
97 Key::new(&[MODKEY], keycodes::KEY_8, KeyAction::ViewTag, Arg::Int(7)),
98 Key::new(&[MODKEY], keycodes::KEY_9, KeyAction::ViewTag, Arg::Int(8)),
99
100 Key::new(&[MODKEY, SHIFT], keycodes::KEY_1, KeyAction::MoveToTag, Arg::Int(0)),
101 Key::new(&[MODKEY, SHIFT], keycodes::KEY_2, KeyAction::MoveToTag, Arg::Int(1)),
102 Key::new(&[MODKEY, SHIFT], keycodes::KEY_3, KeyAction::MoveToTag, Arg::Int(2)),
103 Key::new(&[MODKEY, SHIFT], keycodes::KEY_4, KeyAction::MoveToTag, Arg::Int(3)),
104 Key::new(&[MODKEY, SHIFT], keycodes::KEY_5, KeyAction::MoveToTag, Arg::Int(4)),
105 Key::new(&[MODKEY, SHIFT], keycodes::KEY_6, KeyAction::MoveToTag, Arg::Int(5)),
106 Key::new(&[MODKEY, SHIFT], keycodes::KEY_7, KeyAction::MoveToTag, Arg::Int(6)),
107 Key::new(&[MODKEY, SHIFT], keycodes::KEY_8, KeyAction::MoveToTag, Arg::Int(7)),
108 Key::new(&[MODKEY, SHIFT], keycodes::KEY_9, KeyAction::MoveToTag, Arg::Int(8)),
109 ];
110
111 // ========================================
112 // STATUS BAR BLOCKS
113 // ========================================
114 pub const STATUS_BLOCKS: &[BlockConfig] = &[
115 BlockConfig {
116 format: "",
117 command: BlockCommand::Battery {
118 format_charging: " 󰂄 Bat: {}%",
119 format_discharging: " 󰁹 Bat:{}%",
120 format_full: " 󰁹 Bat: {}%",
121 },
122 interval_secs: 30,
123 color: BLUE,
124 },
125 BlockConfig {
126 format: " | ",
127 command: BlockCommand::Static(""),
128 interval_secs: u64::MAX,
129 color: GRAY_LIGHT,
130 },
131 BlockConfig {
132 format: "  {}",
133 command: BlockCommand::Shell("uname -r"),
134 interval_secs: u64::MAX,
135 color: RED,
136 },
137 BlockConfig {
138 format: " | ",
139 command: BlockCommand::Static(""),
140 interval_secs: u64::MAX,
141 color: GRAY_LIGHT,
142 },
143 BlockConfig {
144 format: " 󰸘 {}",
145 command: BlockCommand::DateTime("%a, %b %d - %-I:%M %P"),
146 interval_secs: 1,
147 color: CYAN,
148 },
149 ];
150
151 const SHIFT: KeyButMask = KeyButMask::SHIFT;