tony / oxwm

Added colors similar to dwm with scheme selected, scheme occupied, etc. Browse files
tonybtw committed 2025-10-03 parent 7843d4c commit da4d6dc6de1d437c223aa5d12da1ee5325961889
Showing 3 changed files with 87 additions and 24 deletions. UnifiedSplit
+26 −0 readme.org
@@ -1,6 +1,32 @@
1 1 #+AUTHOR: Tony
2 2 #+STARTUP: overview
3 3
4 +* Table of Contents :toc:
5 +- [[#oxwm--dwm-but-better-and-oxidized][OXWM — DWM but Better (and oxidized)]]
6 +- [[#project-structure][Project Structure]]
7 +- [[#event-flow][Event Flow]]
8 +- [[#key-bindings][Key Bindings]]
9 +- [[#-installation--running-with-nix-flakes][⚙ Installation — Running with Nix Flakes]]
10 +- [[#testing-xephyr-with-justfile][Testing Xephyr with Justfile]]
11 +- [[#current-status][Current Status]]
12 + - [[#working-features][Working Features]]
13 + - [[#immediate-next-steps][Immediate Next Steps]]
14 + - [[#long-term-roadmap][Long Term Roadmap]]
15 +- [[#oxwm-development-todo][OXWM Development Todo]]
16 + - [[#core-window-management-22][Core Window Management]]
17 + - [[#tag-system-33][Tag System]]
18 + - [[#status-bar-22][Status Bar]]
19 + - [[#in-progress-bar-enhancements-03][IN PROGRESS Bar Enhancements]]
20 + - [[#key-system-improvements-02][Key System Improvements]]
21 + - [[#layout-system-04][Layout System]]
22 + - [[#advanced-features-03][Advanced Features]]
23 + - [[#polish--features][Polish & Features]]
24 +- [[#architecture-notes][Architecture Notes]]
25 + - [[#tag-system][Tag System]]
26 + - [[#bar-design][Bar Design]]
27 + - [[#configuration-philosophy][Configuration Philosophy]]
28 +- [[#license][License]]
29 +
4 30 * OXWM — DWM but Better (and oxidized)
5 31 A dynamic window manager written in Rust, inspired by dwm but designed to evolve
6 32 on its own. Configuration is done in Rust source code, keeping with the suckless
+23 −21 src/bar/bar.rs
@@ -1,5 +1,5 @@
1 1 use super::BAR_HEIGHT;
2 -use crate::config::TAGS;
2 +use crate::config::{SCHEME_NORMAL, SCHEME_OCCUPIED, SCHEME_SELECTED, TAGS};
3 3 use anyhow::Result;
4 4 use x11rb::COPY_DEPTH_FROM_PARENT;
5 5 use x11rb::connection::Connection;
@@ -35,7 +35,7 @@ impl Bar {
35 35 WindowClass::INPUT_OUTPUT,
36 36 screen.root_visual,
37 37 &CreateWindowAux::new()
38 - .background_pixel(screen.black_pixel)
38 + .background_pixel(SCHEME_NORMAL.background)
39 39 .event_mask(EventMask::EXPOSURE | EventMask::BUTTON_PRESS)
40 40 .override_redirect(1),
41 41 )?;
@@ -44,8 +44,8 @@ impl Bar {
44 44 graphics_context,
45 45 window,
46 46 &CreateGCAux::new()
47 - .foreground(screen.white_pixel)
48 - .background(screen.black_pixel),
47 + .foreground(SCHEME_NORMAL.foreground)
48 + .background(SCHEME_NORMAL.background),
49 49 )?;
50 50
51 51 connection.map_window(window)?;
@@ -86,6 +86,10 @@ impl Bar {
86 86 return Ok(());
87 87 }
88 88
89 + connection.change_gc(
90 + self.graphics_context,
91 + &ChangeGCAux::new().foreground(SCHEME_NORMAL.background),
92 + )?;
89 93 connection.poly_fill_rectangle(
90 94 self.window,
91 95 self.graphics_context,
@@ -106,10 +110,18 @@ impl Bar {
106 110
107 111 let tag_width = self.tag_widths[tag_index];
108 112
113 + let scheme = if is_selected {
114 + &SCHEME_SELECTED
115 + } else if is_occupied {
116 + &SCHEME_OCCUPIED
117 + } else {
118 + &SCHEME_NORMAL
119 + };
120 +
109 121 if is_selected {
110 122 connection.change_gc(
111 123 self.graphics_context,
112 - &ChangeGCAux::new().foreground(0xFFFFFF),
124 + &ChangeGCAux::new().foreground(scheme.background),
113 125 )?;
114 126 connection.poly_fill_rectangle(
115 127 self.window,
@@ -121,15 +133,10 @@ impl Bar {
121 133 height: self.height,
122 134 }],
123 135 )?;
124 -
125 - connection.change_gc(
126 - self.graphics_context,
127 - &ChangeGCAux::new().foreground(0x000000),
128 - )?;
129 136 } else if is_occupied {
130 137 connection.change_gc(
131 138 self.graphics_context,
132 - &ChangeGCAux::new().foreground(0x888888),
139 + &ChangeGCAux::new().foreground(scheme.border),
133 140 )?;
134 141 connection.poly_fill_rectangle(
135 142 self.window,
@@ -141,18 +148,13 @@ impl Bar {
141 148 height: 2,
142 149 }],
143 150 )?;
144 -
145 - connection.change_gc(
146 - self.graphics_context,
147 - &ChangeGCAux::new().foreground(0xFFFFFF),
148 - )?;
149 - } else {
150 - connection.change_gc(
151 - self.graphics_context,
152 - &ChangeGCAux::new().foreground(0x666666),
153 - )?;
154 151 }
155 152
153 + connection.change_gc(
154 + self.graphics_context,
155 + &ChangeGCAux::new().foreground(scheme.foreground),
156 + )?;
157 +
156 158 // TODO: Replace with actual font rendering later
157 159 connection.image_text8(
158 160 self.window,
+38 −3 src/config.rs
@@ -5,9 +5,9 @@ use x11rb::protocol::xproto::KeyButMask;
5 5 // ========================================
6 6 // APPEARANCE
7 7 // ========================================
8 -pub const BORDER_WIDTH: u32 = 2;
9 -pub const BORDER_FOCUSED: u32 = 0xff0000;
10 -pub const BORDER_UNFOCUSED: u32 = 0x888888;
8 +pub const BORDER_WIDTH: u32 = 1;
9 +pub const BORDER_FOCUSED: u32 = 0x6dade3;
10 +pub const BORDER_UNFOCUSED: u32 = 0xbbbbbb;
11 11
12 12 // ========================================
13 13 // DEFAULTS
@@ -15,6 +15,41 @@ pub const BORDER_UNFOCUSED: u32 = 0x888888;
15 15 pub const TERMINAL: &str = "alacritty";
16 16 pub const MODKEY: KeyButMask = KeyButMask::MOD1;
17 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 +
18 53 // ========================================
19 54 // Commands
20 55 // ========================================