tony / oxwm

Branch: 99cb352
Switch branches/tags
master
tonybtw fixed reloadsig for now.. 99cb352 2025-10-05
160 lines · 5.7 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 XCLOCK: &str = "xclock";
19 pub const MODKEY: KeyButMask = KeyButMask::MOD1;
20
21 // ========================================
22 // BAR COLORS
23 // ========================================
24
25 // Base colors
26 const GRAY_DARK: u32 = 0x222222;
27 const GRAY_MID: u32 = 0x444444;
28 const GRAY_LIGHT: u32 = 0xbbbbbb;
29 const CYAN: u32 = 0x0db9d7;
30 const MAGENTA: u32 = 0xad8ee6;
31 const RED: u32 = 0xf7768e;
32 const GREEN: u32 = 0x9ece6a;
33 const BLUE: u32 = 0x7aa2f7;
34 const YELLOW: u32 = 0xe0af68;
35
36 pub struct ColorScheme {
37 pub foreground: u32,
38 pub background: u32,
39 pub border: u32,
40 }
41
42 pub const SCHEME_NORMAL: ColorScheme = ColorScheme {
43 foreground: GRAY_LIGHT,
44 background: GRAY_DARK,
45 border: GRAY_MID,
46 };
47
48 pub const SCHEME_OCCUPIED: ColorScheme = ColorScheme {
49 foreground: CYAN,
50 background: GRAY_DARK,
51 border: CYAN,
52 };
53
54 pub const SCHEME_SELECTED: ColorScheme = ColorScheme {
55 foreground: CYAN,
56 background: GRAY_DARK,
57 border: MAGENTA,
58 };
59
60 // ========================================
61 // Commands
62 // ========================================
63 const SCREENSHOT_CMD: &[&str] = &[
64 "sh",
65 "-c",
66 "maim ~/screenshots/screenshot_$(date +%Y%m%d_%H%M%S).png",
67 ];
68
69 const DMENU_CMD: &[&str] = &["sh", "-c", "dmenu_run -l 10"];
70
71 // ========================================
72 // TAGS
73 // ========================================
74 pub const TAG_COUNT: usize = 9;
75 pub const TAGS: [&str; TAG_COUNT] = ["1", "2", "3", "4", "5", "6", "7", "8", "9"];
76
77 // ========================================
78 // KEYBINDINGS
79 // ========================================
80 #[rustfmt::skip]
81 pub const KEYBINDINGS: &[Key] = &[
82 Key::new(&[MODKEY], keycodes::RETURN, KeyAction::Spawn, Arg::Str(TERMINAL)),
83 Key::new(&[MODKEY], keycodes::F, KeyAction::Spawn, Arg::Str(XCLOCK)),
84
85 Key::new(&[MODKEY], keycodes::S, KeyAction::Spawn, Arg::Array(SCREENSHOT_CMD)),
86 Key::new(&[MODKEY], keycodes::D, KeyAction::Spawn, Arg::Array(DMENU_CMD)),
87 Key::new(&[MODKEY], keycodes::Q, KeyAction::KillClient, Arg::None),
88 Key::new(&[MODKEY, SHIFT], keycodes::Q, KeyAction::Quit, Arg::None),
89 Key::new(&[MODKEY, SHIFT], keycodes::R, KeyAction::Restart, Arg::None),
90 Key::new(&[MODKEY], keycodes::J, KeyAction::FocusStack, Arg::Int(-1)),
91 Key::new(&[MODKEY], keycodes::K, KeyAction::FocusStack, Arg::Int(1)),
92
93 Key::new(&[MODKEY], keycodes::KEY_1, KeyAction::ViewTag, Arg::Int(0)),
94 Key::new(&[MODKEY], keycodes::KEY_2, KeyAction::ViewTag, Arg::Int(1)),
95 Key::new(&[MODKEY], keycodes::KEY_3, KeyAction::ViewTag, Arg::Int(2)),
96 Key::new(&[MODKEY], keycodes::KEY_4, KeyAction::ViewTag, Arg::Int(3)),
97 Key::new(&[MODKEY], keycodes::KEY_5, KeyAction::ViewTag, Arg::Int(4)),
98 Key::new(&[MODKEY], keycodes::KEY_6, KeyAction::ViewTag, Arg::Int(5)),
99 Key::new(&[MODKEY], keycodes::KEY_7, KeyAction::ViewTag, Arg::Int(6)),
100 Key::new(&[MODKEY], keycodes::KEY_8, KeyAction::ViewTag, Arg::Int(7)),
101 Key::new(&[MODKEY], keycodes::KEY_9, KeyAction::ViewTag, Arg::Int(8)),
102
103 Key::new(&[MODKEY, SHIFT], keycodes::KEY_1, KeyAction::MoveToTag, Arg::Int(0)),
104 Key::new(&[MODKEY, SHIFT], keycodes::KEY_2, KeyAction::MoveToTag, Arg::Int(1)),
105 Key::new(&[MODKEY, SHIFT], keycodes::KEY_3, KeyAction::MoveToTag, Arg::Int(2)),
106 Key::new(&[MODKEY, SHIFT], keycodes::KEY_4, KeyAction::MoveToTag, Arg::Int(3)),
107 Key::new(&[MODKEY, SHIFT], keycodes::KEY_5, KeyAction::MoveToTag, Arg::Int(4)),
108 Key::new(&[MODKEY, SHIFT], keycodes::KEY_6, KeyAction::MoveToTag, Arg::Int(5)),
109 Key::new(&[MODKEY, SHIFT], keycodes::KEY_7, KeyAction::MoveToTag, Arg::Int(6)),
110 Key::new(&[MODKEY, SHIFT], keycodes::KEY_8, KeyAction::MoveToTag, Arg::Int(7)),
111 Key::new(&[MODKEY, SHIFT], keycodes::KEY_9, KeyAction::MoveToTag, Arg::Int(8)),
112 ];
113
114 // ========================================
115 // STATUS BAR BLOCKS
116 // ========================================
117 pub const STATUS_BLOCKS: &[BlockConfig] = &[
118 BlockConfig {
119 format: "",
120 command: BlockCommand::Battery {
121 format_charging: "󰂄 Bat: {}%",
122 format_discharging: "󰁹 Bat:{}%",
123 format_full: "󰁹 Bat: {}%",
124 },
125 interval_secs: 30,
126 color: BLUE,
127 underline: true,
128 },
129 BlockConfig {
130 format: " | ",
131 command: BlockCommand::Static(""),
132 interval_secs: u64::MAX,
133 color: GRAY_LIGHT,
134 underline: false,
135 },
136 BlockConfig {
137 format: " {}",
138 command: BlockCommand::Shell("uname -r"),
139 interval_secs: u64::MAX,
140 color: RED,
141 underline: true,
142 },
143 BlockConfig {
144 format: " | ",
145 command: BlockCommand::Static(""),
146 interval_secs: u64::MAX,
147 color: GRAY_LIGHT,
148 underline: false,
149 },
150 BlockConfig {
151 format: "󰸘 {}",
152 command: BlockCommand::DateTime("%a, %b %d - %-I:%M %P"),
153 interval_secs: 1,
154 color: CYAN,
155 underline: true,
156 },
157 ];
158
159 const SHIFT: KeyButMask = KeyButMask::SHIFT;
160 pub const WM_BINARY: &str = concat!(env!("CARGO_MANIFEST_DIR"), "/target/release/oxwm");