oxwm

https://git.tonybtw.com/oxwm.git git://git.tonybtw.com/oxwm.git

Added colors similar to dwm with scheme selected, scheme occupied, etc.

Commit
da4d6dc6de1d437c223aa5d12da1ee5325961889
Parent
7843d4c
Author
tonybtw <tonybtw@tonybtw.com>
Date
2025-10-03 09:18:04

Diff

diff --git a/readme.org b/readme.org
index 90f0d7f..d3c0834 100644
--- a/readme.org
+++ b/readme.org
@@ -1,6 +1,32 @@
 #+AUTHOR: Tony
 #+STARTUP: overview
 
+* Table of Contents :toc:
+- [[#oxwm--dwm-but-better-and-oxidized][OXWM — DWM but Better (and oxidized)]]
+- [[#project-structure][Project Structure]]
+- [[#event-flow][Event Flow]]
+- [[#key-bindings][Key Bindings]]
+- [[#-installation--running-with-nix-flakes][⚙ Installation — Running with Nix Flakes]]
+- [[#testing-xephyr-with-justfile][Testing Xephyr with Justfile]]
+- [[#current-status][Current Status]]
+  - [[#working-features][Working Features]]
+  - [[#immediate-next-steps][Immediate Next Steps]]
+  - [[#long-term-roadmap][Long Term Roadmap]]
+- [[#oxwm-development-todo][OXWM Development Todo]]
+  - [[#core-window-management-22][Core Window Management]]
+  - [[#tag-system-33][Tag System]]
+  - [[#status-bar-22][Status Bar]]
+  - [[#in-progress-bar-enhancements-03][IN PROGRESS Bar Enhancements]]
+  - [[#key-system-improvements-02][Key System Improvements]]
+  - [[#layout-system-04][Layout System]]
+  - [[#advanced-features-03][Advanced Features]]
+  - [[#polish--features][Polish & Features]]
+- [[#architecture-notes][Architecture Notes]]
+  - [[#tag-system][Tag System]]
+  - [[#bar-design][Bar Design]]
+  - [[#configuration-philosophy][Configuration Philosophy]]
+- [[#license][License]]
+
 * OXWM — DWM but Better (and oxidized)
 A dynamic window manager written in Rust, inspired by dwm but designed to evolve
 on its own. Configuration is done in Rust source code, keeping with the suckless
diff --git a/src/bar/bar.rs b/src/bar/bar.rs
index 05970c2..7abbc43 100644
--- a/src/bar/bar.rs
+++ b/src/bar/bar.rs
@@ -1,5 +1,5 @@
 use super::BAR_HEIGHT;
-use crate::config::TAGS;
+use crate::config::{SCHEME_NORMAL, SCHEME_OCCUPIED, SCHEME_SELECTED, TAGS};
 use anyhow::Result;
 use x11rb::COPY_DEPTH_FROM_PARENT;
 use x11rb::connection::Connection;
@@ -35,7 +35,7 @@ impl Bar {
             WindowClass::INPUT_OUTPUT,
             screen.root_visual,
             &CreateWindowAux::new()
-                .background_pixel(screen.black_pixel)
+                .background_pixel(SCHEME_NORMAL.background)
                 .event_mask(EventMask::EXPOSURE | EventMask::BUTTON_PRESS)
                 .override_redirect(1),
         )?;
@@ -44,8 +44,8 @@ impl Bar {
             graphics_context,
             window,
             &CreateGCAux::new()
-                .foreground(screen.white_pixel)
-                .background(screen.black_pixel),
+                .foreground(SCHEME_NORMAL.foreground)
+                .background(SCHEME_NORMAL.background),
         )?;
 
         connection.map_window(window)?;
@@ -86,6 +86,10 @@ impl Bar {
             return Ok(());
         }
 
+        connection.change_gc(
+            self.graphics_context,
+            &ChangeGCAux::new().foreground(SCHEME_NORMAL.background),
+        )?;
         connection.poly_fill_rectangle(
             self.window,
             self.graphics_context,
@@ -106,10 +110,18 @@ impl Bar {
 
             let tag_width = self.tag_widths[tag_index];
 
+            let scheme = if is_selected {
+                &SCHEME_SELECTED
+            } else if is_occupied {
+                &SCHEME_OCCUPIED
+            } else {
+                &SCHEME_NORMAL
+            };
+
             if is_selected {
                 connection.change_gc(
                     self.graphics_context,
-                    &ChangeGCAux::new().foreground(0xFFFFFF),
+                    &ChangeGCAux::new().foreground(scheme.background),
                 )?;
                 connection.poly_fill_rectangle(
                     self.window,
@@ -121,15 +133,10 @@ impl Bar {
                         height: self.height,
                     }],
                 )?;
-
-                connection.change_gc(
-                    self.graphics_context,
-                    &ChangeGCAux::new().foreground(0x000000),
-                )?;
             } else if is_occupied {
                 connection.change_gc(
                     self.graphics_context,
-                    &ChangeGCAux::new().foreground(0x888888),
+                    &ChangeGCAux::new().foreground(scheme.border),
                 )?;
                 connection.poly_fill_rectangle(
                     self.window,
@@ -141,18 +148,13 @@ impl Bar {
                         height: 2,
                     }],
                 )?;
-
-                connection.change_gc(
-                    self.graphics_context,
-                    &ChangeGCAux::new().foreground(0xFFFFFF),
-                )?;
-            } else {
-                connection.change_gc(
-                    self.graphics_context,
-                    &ChangeGCAux::new().foreground(0x666666),
-                )?;
             }
 
+            connection.change_gc(
+                self.graphics_context,
+                &ChangeGCAux::new().foreground(scheme.foreground),
+            )?;
+
             // TODO: Replace with actual font rendering later
             connection.image_text8(
                 self.window,
diff --git a/src/config.rs b/src/config.rs
index a09609b..6639819 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -5,9 +5,9 @@ use x11rb::protocol::xproto::KeyButMask;
 // ========================================
 // APPEARANCE
 // ========================================
-pub const BORDER_WIDTH: u32 = 2;
-pub const BORDER_FOCUSED: u32 = 0xff0000;
-pub const BORDER_UNFOCUSED: u32 = 0x888888;
+pub const BORDER_WIDTH: u32 = 1;
+pub const BORDER_FOCUSED: u32 = 0x6dade3;
+pub const BORDER_UNFOCUSED: u32 = 0xbbbbbb;
 
 // ========================================
 // DEFAULTS
@@ -15,6 +15,41 @@ pub const BORDER_UNFOCUSED: u32 = 0x888888;
 pub const TERMINAL: &str = "alacritty";
 pub const MODKEY: KeyButMask = KeyButMask::MOD1;
 
+// ========================================
+// BAR COLORS
+// ========================================
+
+// Base colors
+const GRAY_DARK: u32 = 0x222222;
+const GRAY_MID: u32 = 0x444444;
+const GRAY_LIGHT: u32 = 0xbbbbbb;
+const GRAY_LIGHTEST: u32 = 0xeeeeee;
+const CYAN: u32 = 0x6dade3;
+
+pub struct ColorScheme {
+    pub foreground: u32,
+    pub background: u32,
+    pub border: u32,
+}
+
+pub const SCHEME_NORMAL: ColorScheme = ColorScheme {
+    foreground: GRAY_LIGHT,
+    background: GRAY_DARK,
+    border: GRAY_MID,
+};
+
+pub const SCHEME_SELECTED: ColorScheme = ColorScheme {
+    foreground: GRAY_LIGHTEST,
+    background: CYAN,
+    border: CYAN,
+};
+
+pub const SCHEME_OCCUPIED: ColorScheme = ColorScheme {
+    foreground: GRAY_LIGHTEST,
+    background: GRAY_DARK,
+    border: GRAY_MID,
+};
+
 // ========================================
 // Commands
 // ========================================