tony / oxwm

Branch: da4d6dc
Switch branches/tags
master
tonybtw Added colors similar to dwm with scheme selected, scheme occupied, etc. da4d6dc 2025-10-03
102 lines · 3.8 KB Raw Blame History
1 use crate::keyboard::handlers::Key;
2 use crate::keyboard::{Arg, KeyAction, keycodes};
3 use x11rb::protocol::xproto::KeyButMask;
4
5 // ========================================
6 // APPEARANCE
7 // ========================================
8 pub const BORDER_WIDTH: u32 = 1;
9 pub const BORDER_FOCUSED: u32 = 0x6dade3;
10 pub const BORDER_UNFOCUSED: u32 = 0xbbbbbb;
11
12 // ========================================
13 // DEFAULTS
14 // ========================================
15 pub const TERMINAL: &str = "alacritty";
16 pub const MODKEY: KeyButMask = KeyButMask::MOD1;
17
18 // ========================================
19 // BAR COLORS
20 // ========================================
21
22 // Base colors
23 const GRAY_DARK: u32 = 0x222222;
24 const GRAY_MID: u32 = 0x444444;
25 const GRAY_LIGHT: u32 = 0xbbbbbb;
26 const GRAY_LIGHTEST: u32 = 0xeeeeee;
27 const CYAN: u32 = 0x6dade3;
28
29 pub struct ColorScheme {
30 pub foreground: u32,
31 pub background: u32,
32 pub border: u32,
33 }
34
35 pub const SCHEME_NORMAL: ColorScheme = ColorScheme {
36 foreground: GRAY_LIGHT,
37 background: GRAY_DARK,
38 border: GRAY_MID,
39 };
40
41 pub const SCHEME_SELECTED: ColorScheme = ColorScheme {
42 foreground: GRAY_LIGHTEST,
43 background: CYAN,
44 border: CYAN,
45 };
46
47 pub const SCHEME_OCCUPIED: ColorScheme = ColorScheme {
48 foreground: GRAY_LIGHTEST,
49 background: GRAY_DARK,
50 border: GRAY_MID,
51 };
52
53 // ========================================
54 // Commands
55 // ========================================
56 const SCREENSHOT_CMD: &[&str] = &[
57 "sh",
58 "-c",
59 "maim ~/screenshots/screenshot_$(date +%Y%m%d_%H%M%S).png",
60 ];
61
62 // ========================================
63 // TAGS
64 // ========================================
65 pub const TAG_COUNT: usize = 9;
66 pub const TAGS: [&str; TAG_COUNT] = ["1", "2", "3", "4", "5", "6", "7", "8", "9"];
67
68 // ========================================
69 // KEYBINDINGS
70 // ========================================
71 #[rustfmt::skip]
72 pub const KEYBINDINGS: &[Key] = &[
73 Key::new(&[MODKEY], keycodes::RETURN, KeyAction::Spawn, Arg::Str(TERMINAL)),
74
75 Key::new(&[MODKEY], keycodes::S, KeyAction::Spawn, Arg::Array(SCREENSHOT_CMD)),
76 Key::new(&[MODKEY], keycodes::Q, KeyAction::KillClient, Arg::None),
77 Key::new(&[MODKEY, SHIFT], keycodes::Q, KeyAction::Quit, Arg::None),
78 Key::new(&[MODKEY], keycodes::J, KeyAction::FocusStack, Arg::Int(-1)),
79 Key::new(&[MODKEY], keycodes::K, KeyAction::FocusStack, Arg::Int(1)),
80
81 Key::new(&[MODKEY], keycodes::KEY_1, KeyAction::ViewTag, Arg::Int(0)),
82 Key::new(&[MODKEY], keycodes::KEY_2, KeyAction::ViewTag, Arg::Int(1)),
83 Key::new(&[MODKEY], keycodes::KEY_3, KeyAction::ViewTag, Arg::Int(2)),
84 Key::new(&[MODKEY], keycodes::KEY_4, KeyAction::ViewTag, Arg::Int(3)),
85 Key::new(&[MODKEY], keycodes::KEY_5, KeyAction::ViewTag, Arg::Int(4)),
86 Key::new(&[MODKEY], keycodes::KEY_6, KeyAction::ViewTag, Arg::Int(5)),
87 Key::new(&[MODKEY], keycodes::KEY_7, KeyAction::ViewTag, Arg::Int(6)),
88 Key::new(&[MODKEY], keycodes::KEY_8, KeyAction::ViewTag, Arg::Int(7)),
89 Key::new(&[MODKEY], keycodes::KEY_9, KeyAction::ViewTag, Arg::Int(8)),
90
91 Key::new(&[MODKEY, SHIFT], keycodes::KEY_1, KeyAction::MoveToTag, Arg::Int(0)),
92 Key::new(&[MODKEY, SHIFT], keycodes::KEY_2, KeyAction::MoveToTag, Arg::Int(1)),
93 Key::new(&[MODKEY, SHIFT], keycodes::KEY_3, KeyAction::MoveToTag, Arg::Int(2)),
94 Key::new(&[MODKEY, SHIFT], keycodes::KEY_4, KeyAction::MoveToTag, Arg::Int(3)),
95 Key::new(&[MODKEY, SHIFT], keycodes::KEY_5, KeyAction::MoveToTag, Arg::Int(4)),
96 Key::new(&[MODKEY, SHIFT], keycodes::KEY_6, KeyAction::MoveToTag, Arg::Int(5)),
97 Key::new(&[MODKEY, SHIFT], keycodes::KEY_7, KeyAction::MoveToTag, Arg::Int(6)),
98 Key::new(&[MODKEY, SHIFT], keycodes::KEY_8, KeyAction::MoveToTag, Arg::Int(7)),
99 Key::new(&[MODKEY, SHIFT], keycodes::KEY_9, KeyAction::MoveToTag, Arg::Int(8)),
100 ];
101
102 const SHIFT: KeyButMask = KeyButMask::SHIFT;