tony / oxwm

Branch: 303f7c2
Switch branches/tags
master
tonybtw updated separators 303f7c2 2025-10-08
189 lines · 6.6 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 = 2;
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=12";
13
14 // ========================================
15 // GAPS (Vanity Gaps)
16 // ========================================
17 pub const GAPS_ENABLED: bool = true;
18 pub const GAP_INNER_HORIZONTAL: u32 = 6;
19 pub const GAP_INNER_VERTICAL: u32 = 6;
20 pub const GAP_OUTER_HORIZONTAL: u32 = 6;
21 pub const GAP_OUTER_VERTICAL: u32 = 6;
22
23 // ========================================
24 // DEFAULTS
25 // ========================================
26 pub const TERMINAL: &str = "st";
27 pub const XCLOCK: &str = "xclock";
28 pub const MODKEY: KeyButMask = KeyButMask::MOD4;
29
30 // ========================================
31 // BAR COLORS
32 // ========================================
33
34 // Base colors
35 const GRAY_DARK: u32 = 0x1a1b26;
36 const GRAY_SEP: u32 = 0xa9b1d6;
37 const GRAY_MID: u32 = 0x444444;
38 const GRAY_LIGHT: u32 = 0xbbbbbb;
39 const CYAN: u32 = 0x0db9d7;
40 const MAGENTA: u32 = 0xad8ee6;
41 const RED: u32 = 0xf7768e;
42 const GREEN: u32 = 0x9ece6a;
43 const BLUE: u32 = 0x7aa2f7;
44 const YELLOW: u32 = 0xe0af68;
45
46 pub struct ColorScheme {
47 pub foreground: u32,
48 pub background: u32,
49 pub underline: u32,
50 }
51
52 pub const SCHEME_NORMAL: ColorScheme = ColorScheme {
53 foreground: GRAY_LIGHT,
54 background: GRAY_DARK,
55 underline: GRAY_MID,
56 };
57
58 pub const SCHEME_OCCUPIED: ColorScheme = ColorScheme {
59 foreground: CYAN,
60 background: GRAY_DARK,
61 underline: CYAN,
62 };
63
64 pub const SCHEME_SELECTED: ColorScheme = ColorScheme {
65 foreground: CYAN,
66 background: GRAY_DARK,
67 underline: MAGENTA,
68 };
69
70 // ========================================
71 // Commands
72 // ========================================
73 const SCREENSHOT_CMD: &[&str] = &[
74 "sh",
75 "-c",
76 "maim -s | xclip -selection clipboard -t image/png",
77 ];
78
79 const DMENU_CMD: &[&str] = &["sh", "-c", "dmenu_run -l 10"];
80
81 // ========================================
82 // TAGS
83 // ========================================
84 pub const TAG_COUNT: usize = 9;
85 pub const TAGS: [&str; TAG_COUNT] = ["1", "2", "3", "4", "5", "6", "7", "8", "9"];
86 // pub const TAGS: [&str; TAG_COUNT] = ["", "󰊯", "", "", "󰙯", "󱇤", "", "󱘶", "󰧮"];
87 // pub const TAGS: [&str; TAG_COUNT] = [
88 // "DEV", "WWW", "SYS", "DOC", "VBOX", "CHAT", "MUS", "VID", "MISC",
89 // ];
90
91 // ========================================
92 // KEYBINDINGS
93 // ========================================
94 #[rustfmt::skip]
95 pub const KEYBINDINGS: &[Key] = &[
96 Key::new(&[MODKEY], keycodes::RETURN, KeyAction::Spawn, Arg::Str(TERMINAL)),
97 Key::new(&[MODKEY], keycodes::F, KeyAction::Spawn, Arg::Str(XCLOCK)),
98
99 Key::new(&[MODKEY], keycodes::S, KeyAction::Spawn, Arg::Array(SCREENSHOT_CMD)),
100 Key::new(&[MODKEY], keycodes::D, KeyAction::Spawn, Arg::Array(DMENU_CMD)),
101 Key::new(&[MODKEY], keycodes::Q, KeyAction::KillClient, Arg::None),
102 Key::new(&[MODKEY], keycodes::A, KeyAction::ToggleGaps, Arg::None),
103 Key::new(&[MODKEY, SHIFT], keycodes::Q, KeyAction::Quit, Arg::None),
104 Key::new(&[MODKEY, SHIFT], keycodes::R, KeyAction::Restart, Arg::None),
105 Key::new(&[MODKEY], keycodes::J, KeyAction::FocusStack, Arg::Int(-1)),
106 Key::new(&[MODKEY], keycodes::K, KeyAction::FocusStack, Arg::Int(1)),
107
108 Key::new(&[MODKEY], keycodes::KEY_1, KeyAction::ViewTag, Arg::Int(0)),
109 Key::new(&[MODKEY], keycodes::KEY_2, KeyAction::ViewTag, Arg::Int(1)),
110 Key::new(&[MODKEY], keycodes::KEY_3, KeyAction::ViewTag, Arg::Int(2)),
111 Key::new(&[MODKEY], keycodes::KEY_4, KeyAction::ViewTag, Arg::Int(3)),
112 Key::new(&[MODKEY], keycodes::KEY_5, KeyAction::ViewTag, Arg::Int(4)),
113 Key::new(&[MODKEY], keycodes::KEY_6, KeyAction::ViewTag, Arg::Int(5)),
114 Key::new(&[MODKEY], keycodes::KEY_7, KeyAction::ViewTag, Arg::Int(6)),
115 Key::new(&[MODKEY], keycodes::KEY_8, KeyAction::ViewTag, Arg::Int(7)),
116 Key::new(&[MODKEY], keycodes::KEY_9, KeyAction::ViewTag, Arg::Int(8)),
117
118 Key::new(&[MODKEY, SHIFT], keycodes::KEY_1, KeyAction::MoveToTag, Arg::Int(0)),
119 Key::new(&[MODKEY, SHIFT], keycodes::KEY_2, KeyAction::MoveToTag, Arg::Int(1)),
120 Key::new(&[MODKEY, SHIFT], keycodes::KEY_3, KeyAction::MoveToTag, Arg::Int(2)),
121 Key::new(&[MODKEY, SHIFT], keycodes::KEY_4, KeyAction::MoveToTag, Arg::Int(3)),
122 Key::new(&[MODKEY, SHIFT], keycodes::KEY_5, KeyAction::MoveToTag, Arg::Int(4)),
123 Key::new(&[MODKEY, SHIFT], keycodes::KEY_6, KeyAction::MoveToTag, Arg::Int(5)),
124 Key::new(&[MODKEY, SHIFT], keycodes::KEY_7, KeyAction::MoveToTag, Arg::Int(6)),
125 Key::new(&[MODKEY, SHIFT], keycodes::KEY_8, KeyAction::MoveToTag, Arg::Int(7)),
126 Key::new(&[MODKEY, SHIFT], keycodes::KEY_9, KeyAction::MoveToTag, Arg::Int(8)),
127 ];
128
129 // ========================================
130 // STATUS BAR BLOCKS
131 // ========================================
132 pub const STATUS_BLOCKS: &[BlockConfig] = &[
133 BlockConfig {
134 format: "",
135 command: BlockCommand::Battery {
136 format_charging: "󰂄 Bat: {}%",
137 format_discharging: "󰁹 Bat:{}%",
138 format_full: "󰁹 Bat: {}%",
139 },
140 interval_secs: 30,
141 color: GREEN,
142 underline: true,
143 },
144 BlockConfig {
145 format: " │ ",
146 command: BlockCommand::Static(""),
147 interval_secs: u64::MAX,
148 color: GRAY_SEP,
149 underline: false,
150 },
151 BlockConfig {
152 format: "󰍛 {used}/{total} GB",
153 command: BlockCommand::Ram,
154 interval_secs: 5,
155 color: BLUE,
156 underline: true,
157 },
158 BlockConfig {
159 format: " │ ",
160 command: BlockCommand::Static(""),
161 interval_secs: u64::MAX,
162 color: GRAY_SEP,
163 underline: false,
164 },
165 BlockConfig {
166 format: " {}",
167 command: BlockCommand::Shell("uname -r"),
168 interval_secs: u64::MAX,
169 color: RED,
170 underline: true,
171 },
172 BlockConfig {
173 format: " │ ",
174 command: BlockCommand::Static(""),
175 interval_secs: u64::MAX,
176 color: GRAY_SEP,
177 underline: false,
178 },
179 BlockConfig {
180 format: "󰸘 {}",
181 command: BlockCommand::DateTime("%a, %b %d - %-I:%M %P"),
182 interval_secs: 1,
183 color: CYAN,
184 underline: true,
185 },
186 ];
187
188 const SHIFT: KeyButMask = KeyButMask::SHIFT;
189 pub const WM_BINARY: &str = concat!(env!("CARGO_MANIFEST_DIR"), "/target/release/oxwm");