tony / oxwm

Branch: 35a51b2
Switch branches/tags
master
tonybtw Updated justfile and config.rs -> default_config.rs 98a1994 2025-10-09
190 lines · 6.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 = 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 = false;
18 pub const GAP_INNER_HORIZONTAL: u32 = 3;
19 pub const GAP_INNER_VERTICAL: u32 = 3;
20 pub const GAP_OUTER_HORIZONTAL: u32 = 3;
21 pub const GAP_OUTER_VERTICAL: u32 = 3;
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, SHIFT], keycodes::F, KeyAction::ToggleFullScreen, Arg::None),
103 Key::new(&[MODKEY], keycodes::A, KeyAction::ToggleGaps, Arg::None),
104 Key::new(&[MODKEY, SHIFT], keycodes::Q, KeyAction::Quit, Arg::None),
105 Key::new(&[MODKEY, SHIFT], keycodes::R, KeyAction::Restart, Arg::None),
106 Key::new(&[MODKEY], keycodes::J, KeyAction::FocusStack, Arg::Int(-1)),
107 Key::new(&[MODKEY], keycodes::K, KeyAction::FocusStack, Arg::Int(1)),
108
109 Key::new(&[MODKEY], keycodes::KEY_1, KeyAction::ViewTag, Arg::Int(0)),
110 Key::new(&[MODKEY], keycodes::KEY_2, KeyAction::ViewTag, Arg::Int(1)),
111 Key::new(&[MODKEY], keycodes::KEY_3, KeyAction::ViewTag, Arg::Int(2)),
112 Key::new(&[MODKEY], keycodes::KEY_4, KeyAction::ViewTag, Arg::Int(3)),
113 Key::new(&[MODKEY], keycodes::KEY_5, KeyAction::ViewTag, Arg::Int(4)),
114 Key::new(&[MODKEY], keycodes::KEY_6, KeyAction::ViewTag, Arg::Int(5)),
115 Key::new(&[MODKEY], keycodes::KEY_7, KeyAction::ViewTag, Arg::Int(6)),
116 Key::new(&[MODKEY], keycodes::KEY_8, KeyAction::ViewTag, Arg::Int(7)),
117 Key::new(&[MODKEY], keycodes::KEY_9, KeyAction::ViewTag, Arg::Int(8)),
118
119 Key::new(&[MODKEY, SHIFT], keycodes::KEY_1, KeyAction::MoveToTag, Arg::Int(0)),
120 Key::new(&[MODKEY, SHIFT], keycodes::KEY_2, KeyAction::MoveToTag, Arg::Int(1)),
121 Key::new(&[MODKEY, SHIFT], keycodes::KEY_3, KeyAction::MoveToTag, Arg::Int(2)),
122 Key::new(&[MODKEY, SHIFT], keycodes::KEY_4, KeyAction::MoveToTag, Arg::Int(3)),
123 Key::new(&[MODKEY, SHIFT], keycodes::KEY_5, KeyAction::MoveToTag, Arg::Int(4)),
124 Key::new(&[MODKEY, SHIFT], keycodes::KEY_6, KeyAction::MoveToTag, Arg::Int(5)),
125 Key::new(&[MODKEY, SHIFT], keycodes::KEY_7, KeyAction::MoveToTag, Arg::Int(6)),
126 Key::new(&[MODKEY, SHIFT], keycodes::KEY_8, KeyAction::MoveToTag, Arg::Int(7)),
127 Key::new(&[MODKEY, SHIFT], keycodes::KEY_9, KeyAction::MoveToTag, Arg::Int(8)),
128 ];
129
130 // ========================================
131 // STATUS BAR BLOCKS
132 // ========================================
133 pub const STATUS_BLOCKS: &[BlockConfig] = &[
134 BlockConfig {
135 format: "",
136 command: BlockCommand::Battery {
137 format_charging: "󰂄 Bat: {}%",
138 format_discharging: "󰁹 Bat:{}%",
139 format_full: "󰁹 Bat: {}%",
140 },
141 interval_secs: 30,
142 color: GREEN,
143 underline: true,
144 },
145 BlockConfig {
146 format: " │ ",
147 command: BlockCommand::Static(""),
148 interval_secs: u64::MAX,
149 color: GRAY_SEP,
150 underline: false,
151 },
152 BlockConfig {
153 format: "󰍛 {used}/{total} GB",
154 command: BlockCommand::Ram,
155 interval_secs: 5,
156 color: BLUE,
157 underline: true,
158 },
159 BlockConfig {
160 format: " │ ",
161 command: BlockCommand::Static(""),
162 interval_secs: u64::MAX,
163 color: GRAY_SEP,
164 underline: false,
165 },
166 BlockConfig {
167 format: " {}",
168 command: BlockCommand::Shell("uname -r"),
169 interval_secs: u64::MAX,
170 color: RED,
171 underline: true,
172 },
173 BlockConfig {
174 format: " │ ",
175 command: BlockCommand::Static(""),
176 interval_secs: u64::MAX,
177 color: GRAY_SEP,
178 underline: false,
179 },
180 BlockConfig {
181 format: "󰸘 {}",
182 command: BlockCommand::DateTime("%a, %b %d - %-I:%M %P"),
183 interval_secs: 1,
184 color: CYAN,
185 underline: true,
186 },
187 ];
188
189 const SHIFT: KeyButMask = KeyButMask::SHIFT;
190 pub const WM_BINARY: &str = concat!(env!("CARGO_MANIFEST_DIR"), "/target/release/oxwm");