tony / oxwm

Branch: a3977f8
Switch branches/tags
master
tonybtw Debugging sigtem restart a3977f8 2025-10-05
158 lines · 5.5 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, SHIFT], keycodes::R, KeyAction::Restart, Arg::None),
88 Key::new(&[MODKEY], keycodes::J, KeyAction::FocusStack, Arg::Int(-1)),
89 Key::new(&[MODKEY], keycodes::K, KeyAction::FocusStack, Arg::Int(1)),
90
91 Key::new(&[MODKEY], keycodes::KEY_1, KeyAction::ViewTag, Arg::Int(0)),
92 Key::new(&[MODKEY], keycodes::KEY_2, KeyAction::ViewTag, Arg::Int(1)),
93 Key::new(&[MODKEY], keycodes::KEY_3, KeyAction::ViewTag, Arg::Int(2)),
94 Key::new(&[MODKEY], keycodes::KEY_4, KeyAction::ViewTag, Arg::Int(3)),
95 Key::new(&[MODKEY], keycodes::KEY_5, KeyAction::ViewTag, Arg::Int(4)),
96 Key::new(&[MODKEY], keycodes::KEY_6, KeyAction::ViewTag, Arg::Int(5)),
97 Key::new(&[MODKEY], keycodes::KEY_7, KeyAction::ViewTag, Arg::Int(6)),
98 Key::new(&[MODKEY], keycodes::KEY_8, KeyAction::ViewTag, Arg::Int(7)),
99 Key::new(&[MODKEY], keycodes::KEY_9, KeyAction::ViewTag, Arg::Int(8)),
100
101 Key::new(&[MODKEY, SHIFT], keycodes::KEY_1, KeyAction::MoveToTag, Arg::Int(0)),
102 Key::new(&[MODKEY, SHIFT], keycodes::KEY_2, KeyAction::MoveToTag, Arg::Int(1)),
103 Key::new(&[MODKEY, SHIFT], keycodes::KEY_3, KeyAction::MoveToTag, Arg::Int(2)),
104 Key::new(&[MODKEY, SHIFT], keycodes::KEY_4, KeyAction::MoveToTag, Arg::Int(3)),
105 Key::new(&[MODKEY, SHIFT], keycodes::KEY_5, KeyAction::MoveToTag, Arg::Int(4)),
106 Key::new(&[MODKEY, SHIFT], keycodes::KEY_6, KeyAction::MoveToTag, Arg::Int(5)),
107 Key::new(&[MODKEY, SHIFT], keycodes::KEY_7, KeyAction::MoveToTag, Arg::Int(6)),
108 Key::new(&[MODKEY, SHIFT], keycodes::KEY_8, KeyAction::MoveToTag, Arg::Int(7)),
109 Key::new(&[MODKEY, SHIFT], keycodes::KEY_9, KeyAction::MoveToTag, Arg::Int(8)),
110 ];
111
112 // ========================================
113 // STATUS BAR BLOCKS
114 // ========================================
115 pub const STATUS_BLOCKS: &[BlockConfig] = &[
116 BlockConfig {
117 format: "",
118 command: BlockCommand::Battery {
119 format_charging: "󰂄 Bat: {}%",
120 format_discharging: "󰁹 Bat:{}%",
121 format_full: "󰁹 Bat: {}%",
122 },
123 interval_secs: 30,
124 color: BLUE,
125 underline: true,
126 },
127 BlockConfig {
128 format: " | ",
129 command: BlockCommand::Static(""),
130 interval_secs: u64::MAX,
131 color: GRAY_LIGHT,
132 underline: false,
133 },
134 BlockConfig {
135 format: " {}",
136 command: BlockCommand::Shell("uname -r"),
137 interval_secs: u64::MAX,
138 color: RED,
139 underline: true,
140 },
141 BlockConfig {
142 format: " | ",
143 command: BlockCommand::Static(""),
144 interval_secs: u64::MAX,
145 color: GRAY_LIGHT,
146 underline: false,
147 },
148 BlockConfig {
149 format: "󰸘 {}",
150 command: BlockCommand::DateTime("%a, %b %d - %-I:%M %P"),
151 interval_secs: 1,
152 color: CYAN,
153 underline: true,
154 },
155 ];
156
157 const SHIFT: KeyButMask = KeyButMask::SHIFT;
158 pub const WM_BINARY: &str = concat!(env!("CARGO_MANIFEST_DIR"), "/target/release/oxwm");