tony / oxwm

Branch: 8abb99f
Switch branches/tags
master
tonybtw Fixed justfile to point to .local/bin 4e7d825 2025-10-10
212 lines · 7.5 KB Raw Blame History
1 use oxwm::ColorScheme;
2 use oxwm::prelude::*;
3
4 // ========================================
5 // APPEARANCE
6 // ========================================
7 pub const BORDER_WIDTH: u32 = 2;
8 pub const BORDER_FOCUSED: u32 = 0x6dade3;
9 pub const BORDER_UNFOCUSED: u32 = 0xbbbbbb;
10 pub const FONT: &str = "JetBrainsMono Nerd Font:style=Bold:size=12";
11
12 // ========================================
13 // GAPS (Vanity Gaps)
14 // ========================================
15 pub const GAPS_ENABLED: bool = false;
16 pub const GAP_INNER_HORIZONTAL: u32 = 3;
17 pub const GAP_INNER_VERTICAL: u32 = 3;
18 pub const GAP_OUTER_HORIZONTAL: u32 = 3;
19 pub const GAP_OUTER_VERTICAL: u32 = 3;
20
21 // ========================================
22 // DEFAULTS
23 // ========================================
24 pub const TERMINAL: &str = "st";
25 pub const MODKEY: KeyButMask = KeyButMask::MOD4;
26
27 // ========================================
28 // TAGS (Workspaces)
29 // ========================================
30 pub const TAG_COUNT: usize = 9;
31 pub const TAGS: [&str; TAG_COUNT] = ["1", "2", "3", "4", "5", "6", "7", "8", "9"];
32
33 // Alternative tag styles you can use:
34 // pub const TAGS: [&str; TAG_COUNT] = ["", "󰊯", "", "", "󰙯", "󱇤", "", "󱘶", "󰧮"];
35 // pub const TAGS: [&str; TAG_COUNT] = ["DEV", "WWW", "SYS", "DOC", "VBOX", "CHAT", "MUS", "VID", "MISC"];
36
37 // ========================================
38 // BAR COLORS
39 // ========================================
40 const GRAY_DARK: u32 = 0x1a1b26;
41 const GRAY_SEP: u32 = 0xa9b1d6;
42 const GRAY_MID: u32 = 0x444444;
43 const GRAY_LIGHT: u32 = 0xbbbbbb;
44 const CYAN: u32 = 0x0db9d7;
45 const MAGENTA: u32 = 0xad8ee6;
46 const RED: u32 = 0xf7768e;
47 const GREEN: u32 = 0x9ece6a;
48 const BLUE: u32 = 0x7aa2f7;
49 const YELLOW: u32 = 0xe0af68;
50
51 pub const SCHEME_NORMAL: ColorScheme = ColorScheme {
52 foreground: GRAY_LIGHT,
53 background: GRAY_DARK,
54 underline: GRAY_MID,
55 };
56
57 pub const SCHEME_OCCUPIED: ColorScheme = ColorScheme {
58 foreground: CYAN,
59 background: GRAY_DARK,
60 underline: CYAN,
61 };
62
63 pub const SCHEME_SELECTED: ColorScheme = ColorScheme {
64 foreground: CYAN,
65 background: GRAY_DARK,
66 underline: MAGENTA,
67 };
68
69 // ========================================
70 // COMMANDS
71 // ========================================
72 const SCREENSHOT_CMD: &[&str] = &[
73 "sh",
74 "-c",
75 "maim -s | xclip -selection clipboard -t image/png",
76 ];
77
78 const DMENU_CMD: &[&str] = &["sh", "-c", "dmenu_run -l 10"];
79
80 // ========================================
81 // KEYBINDINGS
82 // ========================================
83 const SHIFT: KeyButMask = KeyButMask::SHIFT;
84
85 #[rustfmt::skip]
86 pub const KEYBINDINGS: &[Key] = &[
87 // Launch applications
88 Key::new(&[MODKEY], keycodes::RETURN, KeyAction::Spawn, Arg::Str(TERMINAL)),
89 Key::new(&[MODKEY], keycodes::F, KeyAction::Spawn, Arg::Str("xclock")),
90 Key::new(&[MODKEY], keycodes::S, KeyAction::Spawn, Arg::Array(SCREENSHOT_CMD)),
91 Key::new(&[MODKEY], keycodes::D, KeyAction::Spawn, Arg::Array(DMENU_CMD)),
92
93 // Window management
94 Key::new(&[MODKEY], keycodes::Q, KeyAction::KillClient, Arg::None),
95 Key::new(&[MODKEY, SHIFT], keycodes::F, KeyAction::ToggleFullScreen, Arg::None),
96 Key::new(&[MODKEY], keycodes::A, KeyAction::ToggleGaps, Arg::None),
97
98 // WM controls
99 Key::new(&[MODKEY, SHIFT], keycodes::Q, KeyAction::Quit, Arg::None),
100 Key::new(&[MODKEY, SHIFT], keycodes::R, KeyAction::Restart, Arg::None),
101 Key::new(&[MODKEY, SHIFT], keycodes::C, KeyAction::Recompile, Arg::None),
102
103 // Focus
104 Key::new(&[MODKEY], keycodes::J, KeyAction::FocusStack, Arg::Int(-1)),
105 Key::new(&[MODKEY], keycodes::K, KeyAction::FocusStack, Arg::Int(1)),
106
107 // View tags (workspaces)
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 // Move windows to tags
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 // ========================================
190 // BUILD CONFIG FROM CONSTANTS
191 // ========================================
192 pub fn build_config() -> oxwm::Config {
193 oxwm::Config {
194 border_width: BORDER_WIDTH,
195 border_focused: BORDER_FOCUSED,
196 border_unfocused: BORDER_UNFOCUSED,
197 font: FONT.to_string(),
198 gaps_enabled: GAPS_ENABLED,
199 gap_inner_horizontal: GAP_INNER_HORIZONTAL,
200 gap_inner_vertical: GAP_INNER_VERTICAL,
201 gap_outer_horizontal: GAP_OUTER_HORIZONTAL,
202 gap_outer_vertical: GAP_OUTER_VERTICAL,
203 terminal: TERMINAL.to_string(),
204 modkey: MODKEY,
205 tags: TAGS.iter().map(|s| s.to_string()).collect(),
206 keybindings: KEYBINDINGS.to_vec(),
207 status_blocks: STATUS_BLOCKS.to_vec(),
208 scheme_normal: SCHEME_NORMAL,
209 scheme_occupied: SCHEME_OCCUPIED,
210 scheme_selected: SCHEME_SELECTED,
211 }
212 }