tony / oxwm

Fixed merge conflicts. Updated config parser to include keychord implementation. Browse files
tonybtw committed 2025-10-31 parents c07ef11 334f1e8 commit aa4066d117fe65161fa232050aa9c771fecfae04
Showing 13 changed files with 223 additions and 105 deletions. UnifiedSplit
+1 −1 Cargo.lock
@@ -222,7 +222,7 @@ checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"
222 222
223 [[package]] 223 [[package]]
224 name = "oxwm" 224 name = "oxwm"
225 -version = "0.3.0" 225 +version = "0.4.0"
226 dependencies = [ 226 dependencies = [
227 "anyhow", 227 "anyhow",
228 "chrono", 228 "chrono",
+1 −1 Cargo.toml
@@ -1,6 +1,6 @@
1 [package] 1 [package]
2 name = "oxwm" 2 name = "oxwm"
3 -version = "0.3.0" 3 +version = "0.4.0"
4 edition = "2024" 4 edition = "2024"
5 5
6 [lib] 6 [lib]
+1 −1 PKGBUILD
@@ -1,7 +1,7 @@
1 # Maintainer: Tony, btw <tony@tonybtw.com> 1 # Maintainer: Tony, btw <tony@tonybtw.com>
2 pkgname='oxwm-git' 2 pkgname='oxwm-git'
3 _pkgname='oxwm' 3 _pkgname='oxwm'
4 -pkgver=0.3.0.25.g0b0d9e3 4 +pkgver=0.4.0.177.g6dc200c
5 pkgrel=1 5 pkgrel=1
6 arch=('x86_64') 6 arch=('x86_64')
7 url="https://github.com/tonybanters/oxwm" 7 url="https://github.com/tonybanters/oxwm"
+1 −1 default.nix
@@ -8,7 +8,7 @@
8 }: 8 }:
9 rustPlatform.buildRustPackage (finalAttrs: { 9 rustPlatform.buildRustPackage (finalAttrs: {
10 pname = "oxwm"; 10 pname = "oxwm";
11 - version = "0.3.0"; 11 + version = "0.4.0";
12 12
13 src = ./.; 13 src = ./.;
14 14
+1 −1 readme.org
@@ -154,7 +154,7 @@ startx
154 If using a display manager (LightDM, GDM, SDDM), OXWM should appear in the session list after installation. 154 If using a display manager (LightDM, GDM, SDDM), OXWM should appear in the session list after installation.
155 155
156 * Configuration 156 * Configuration
157 -OXWM was inspired by dwm, but ditched the suckless philosophy. This philosophy quite literally discourages users from using the software for the sake of 'elitism'. I find that quite nonsensical, so I went ahead and created this project to be user friendly. The configuration is done by editing =~/.config/oxwm/config.ron= and the binary can be reloaded with a hotkey (Super+Shift+R by efault). 157 +OXWM was inspired by dwm, but ditched the suckless philosophy. This philosophy quite literally discourages users from using the software for the sake of 'elitism'. I find that quite nonsensical, so I went ahead and created this project to be user friendly. The configuration is done by editing =~/.config/oxwm/config.ron= and the binary can be reloaded with a hotkey (Super+Shift+R by default).
158 158
159 Edit =~/.config/oxwm/config.ron= to customize: 159 Edit =~/.config/oxwm/config.ron= to customize:
160 - Keybindings 160 - Keybindings
+51 −1 src/config/mod.rs
@@ -4,6 +4,7 @@ use crate::keyboard::handlers::{KeyBinding, KeyPress};
4 use crate::keyboard::keycodes; 4 use crate::keyboard::keycodes;
5 use crate::keyboard::{Arg, KeyAction}; 5 use crate::keyboard::{Arg, KeyAction};
6 use serde::Deserialize; 6 use serde::Deserialize;
7 +use std::collections::HashMap;
7 use x11rb::protocol::xproto::{KeyButMask, Keycode}; 8 use x11rb::protocol::xproto::{KeyButMask, Keycode};
8 9
9 #[derive(Debug, Deserialize)] 10 #[derive(Debug, Deserialize)]
@@ -158,8 +159,57 @@ impl KeyData {
158 } 159 }
159 } 160 }
160 161
162 +fn preprocess_variables(input: &str) -> Result<String, ConfigError> {
163 + let mut variables: HashMap<String, String> = HashMap::new();
164 + let mut result = String::new();
165 +
166 + for line in input.lines() {
167 + let trimmed = line.trim();
168 +
169 + if trimmed.starts_with("#DEFINE") {
170 + let rest = trimmed.strip_prefix("#DEFINE").unwrap().trim();
171 +
172 + if let Some(eq_pos) = rest.find('=') {
173 + let var_name = rest[..eq_pos].trim();
174 + let value = rest[eq_pos + 1..].trim().trim_end_matches(',');
175 +
176 + if !var_name.starts_with('$') {
177 + return Err(ConfigError::InvalidVariableName(var_name.to_string()));
178 + }
179 +
180 + variables.insert(var_name.to_string(), value.to_string());
181 + } else {
182 + return Err(ConfigError::InvalidDefine(trimmed.to_string()));
183 + }
184 +
185 + result.push('\n');
186 + } else {
187 + let mut processed_line = line.to_string();
188 + for (var_name, value) in &variables {
189 + processed_line = processed_line.replace(var_name, value);
190 + }
191 + result.push_str(&processed_line);
192 + result.push('\n');
193 + }
194 + }
195 +
196 + for line in result.lines() {
197 + if let Some(var_start) = line.find('$') {
198 + let rest = &line[var_start..];
199 + let var_end = rest[1..]
200 + .find(|c: char| !c.is_alphanumeric() && c != '_')
201 + .unwrap_or(rest.len() - 1)
202 + + 1;
203 + let undefined_var = &rest[..var_end];
204 + return Err(ConfigError::UndefinedVariable(undefined_var.to_string()));
205 + }
206 + }
207 + Ok(result)
208 +}
209 +
161 pub fn parse_config(input: &str) -> Result<crate::Config, ConfigError> { 210 pub fn parse_config(input: &str) -> Result<crate::Config, ConfigError> {
162 - let config_data: ConfigData = ron::from_str(input)?; 211 + let preprocessed = preprocess_variables(input)?;
212 + let config_data: ConfigData = ron::from_str(&preprocessed)?;
163 config_data_to_config(config_data) 213 config_data_to_config(config_data)
164 } 214 }
165 215
+20 −0 src/errors.rs
@@ -26,6 +26,9 @@ pub enum ConfigError {
26 UnknownBlockCommand(String), 26 UnknownBlockCommand(String),
27 MissingCommandArg { command: String, field: String }, 27 MissingCommandArg { command: String, field: String },
28 ValidationError(String), 28 ValidationError(String),
29 + InvalidVariableName(String),
30 + InvalidDefine(String),
31 + UndefinedVariable(String),
29 } 32 }
30 33
31 impl std::fmt::Display for WmError { 34 impl std::fmt::Display for WmError {
@@ -69,6 +72,23 @@ impl std::fmt::Display for ConfigError {
69 write!(f, "{} command requires {}", command, field) 72 write!(f, "{} command requires {}", command, field)
70 } 73 }
71 Self::ValidationError(msg) => write!(f, "Config validation error: {}", msg), 74 Self::ValidationError(msg) => write!(f, "Config validation error: {}", msg),
75 + Self::InvalidVariableName(name) => {
76 + write!(f, "Invalid variable name '{}': must start with $", name)
77 + }
78 + Self::InvalidDefine(line) => {
79 + write!(
80 + f,
81 + "Invalid #DEFINE syntax: '{}'. Expected: #DEFINE $var_name = value",
82 + line
83 + )
84 + }
85 + Self::UndefinedVariable(var) => {
86 + write!(
87 + f,
88 + "Undefined variable '{}': define it with #DEFINE before use",
89 + var
90 + )
91 + }
72 } 92 }
73 } 93 }
74 } 94 }
+42 −13 src/layout/mod.rs
@@ -12,24 +12,53 @@ pub struct GapConfig {
12 pub outer_vertical: u32, 12 pub outer_vertical: u32,
13 } 13 }
14 14
15 -pub const TILING: &str = "tiling"; 15 +pub enum LayoutType {
16 -pub const NORMIE: &str = "normie"; 16 + Tiling,
17 -pub const FLOATING: &str = "floating"; 17 + Normie,
18 +}
18 19
19 -pub fn layout_from_str(s: &str) -> Result<LayoutBox, String> { 20 +impl LayoutType {
20 - match s.to_lowercase().as_str() { 21 + pub fn new(&self) -> LayoutBox {
21 - TILING => Ok(Box::new(tiling::TilingLayout)), 22 + match self {
22 - NORMIE | FLOATING => Ok(Box::new(normie::NormieLayout)), 23 + Self::Tiling => Box::new(tiling::TilingLayout),
23 - _ => Err(format!("Unknown layout: {}", s)), 24 + Self::Normie => Box::new(normie::NormieLayout),
25 + }
26 + }
27 +
28 + pub fn next(&self) -> Self {
29 + match self {
30 + Self::Tiling => Self::Normie,
31 + Self::Normie => Self::Tiling,
32 + }
33 + }
34 +
35 + pub fn as_str(&self) -> &'static str {
36 + match self {
37 + Self::Tiling => "tiling",
38 + Self::Normie => "normie",
39 + }
24 } 40 }
41 +
42 + pub fn from_str(s: &str) -> Result<Self, String> {
43 + match s.to_lowercase().as_str() {
44 + "tiling" => Ok(Self::Tiling),
45 + "normie" | "floating" => Ok(Self::Normie),
46 + _ => Err(format!("Invalid Layout Type: {}", s)),
47 + }
48 + }
49 +}
50 +
51 +pub fn layout_from_str(s: &str) -> Result<LayoutBox, String> {
52 + let layout_type = LayoutType::from_str(s)?;
53 + Ok(layout_type.new())
25 } 54 }
26 55
27 pub fn next_layout(current_name: &str) -> &'static str { 56 pub fn next_layout(current_name: &str) -> &'static str {
28 - match current_name { 57 + LayoutType::from_str(current_name)
29 - TILING => NORMIE, 58 + .ok()
30 - NORMIE => TILING, 59 + .map(|layout_type| layout_type.next())
31 - _ => TILING, 60 + .unwrap_or(LayoutType::Tiling)
32 - } 61 + .as_str()
33 } 62 }
34 63
35 pub trait Layout { 64 pub trait Layout {
+1 −1 src/layout/normie.rs
@@ -6,7 +6,7 @@ pub struct NormieLayout;
6 // This layout should return a no-op similar to DWM.C's "null" mode. 6 // This layout should return a no-op similar to DWM.C's "null" mode.
7 impl Layout for NormieLayout { 7 impl Layout for NormieLayout {
8 fn name(&self) -> &'static str { 8 fn name(&self) -> &'static str {
9 - super::NORMIE 9 + super::LayoutType::Normie.as_str()
10 } 10 }
11 11
12 fn symbol(&self) -> &'static str { 12 fn symbol(&self) -> &'static str {
+1 −1 src/layout/tiling.rs
@@ -5,7 +5,7 @@ pub struct TilingLayout;
5 5
6 impl Layout for TilingLayout { 6 impl Layout for TilingLayout {
7 fn name(&self) -> &'static str { 7 fn name(&self) -> &'static str {
8 - super::TILING 8 + super::LayoutType::Tiling.as_str()
9 } 9 }
10 10
11 fn symbol(&self) -> &'static str { 11 fn symbol(&self) -> &'static str {
+2 −2 src/window_manager.rs
@@ -4,7 +4,7 @@ use crate::errors::WmError;
4 use crate::keyboard::{self, Arg, KeyAction, handlers}; 4 use crate::keyboard::{self, Arg, KeyAction, handlers};
5 use crate::layout::GapConfig; 5 use crate::layout::GapConfig;
6 use crate::layout::tiling::TilingLayout; 6 use crate::layout::tiling::TilingLayout;
7 -use crate::layout::{Layout, LayoutBox, layout_from_str, next_layout}; 7 +use crate::layout::{Layout, LayoutBox, LayoutType, layout_from_str, next_layout};
8 use crate::monitor::{Monitor, detect_monitors}; 8 use crate::monitor::{Monitor, detect_monitors};
9 use std::collections::HashSet; 9 use std::collections::HashSet;
10 use x11rb::cursor::Handle as CursorHandle; 10 use x11rb::cursor::Handle as CursorHandle;
@@ -1557,7 +1557,7 @@ impl WindowManager {
1557 return Ok(()); 1557 return Ok(());
1558 } 1558 }
1559 1559
1560 - if self.layout.name() == crate::layout::NORMIE { 1560 + if self.layout.name() == LayoutType::Normie.as_str() {
1561 return Ok(()); 1561 return Ok(());
1562 } 1562 }
1563 1563
+73 −66 templates/config.ron
@@ -2,20 +2,35 @@
2 // OXWM Configuration File 2 // OXWM Configuration File
3 // Edit this file and reload with Mod+Shift+R (no compilation needed!) 3 // Edit this file and reload with Mod+Shift+R (no compilation needed!)
4 4
5 +#DEFINE $terminal = "st"
6 +#DEFINE $color_blue = 0x6dade3
7 +#DEFINE $color_grey = 0xbbbbbb
8 +#DEFINE $color_green = 0x9ece6a
9 +#DEFINE $color_red = 0xf7768e
10 +#DEFINE $color_cyan = 0x0db9d7
11 +#DEFINE $color_purple = 0xad8ee6
12 +#DEFINE $color_lavender = 0xa9b1d6
13 +#DEFINE $color_bg = 0x1a1b26
14 +#DEFINE $color_fg = 0xbbbbbb
15 +#DEFINE $color_light_blue = 0x7aa2f7
16 +#DEFINE $modkey = Mod4
17 +#DEFINE $secondary_modkey = Mod1
18 +
5 ( 19 (
6 border_width: 2, 20 border_width: 2,
7 - border_focused: 0x6dade3, 21 + border_focused: $color_blue,
8 - border_unfocused: 0xbbbbbb, 22 + border_unfocused: $color_grey,
9 font: "monospace:style=Bold:size=10", 23 font: "monospace:style=Bold:size=10",
10 - 24 +
11 gaps_enabled: true, 25 gaps_enabled: true,
12 gap_inner_horizontal: 5, 26 gap_inner_horizontal: 5,
13 gap_inner_vertical: 5, 27 gap_inner_vertical: 5,
14 gap_outer_horizontal: 5, 28 gap_outer_horizontal: 5,
15 gap_outer_vertical: 5, 29 gap_outer_vertical: 5,
16 30
17 - terminal: "st", 31 + modkey: $modkey,
18 - modkey: Mod4, 32 +
33 + terminal: $terminal,
19 34
20 tags: ["1", "2", "3", "4", "5", "6", "7", "8", "9"], 35 tags: ["1", "2", "3", "4", "5", "6", "7", "8", "9"],
21 layout_symbols: [ 36 layout_symbols: [
@@ -39,77 +54,69 @@
39 54
40 keybindings: [ 55 keybindings: [
41 // Basic keybindings (old format for backwards compatibility) 56 // Basic keybindings (old format for backwards compatibility)
42 - (modifiers: [Mod4], key: Return, action: Spawn, arg: "st"), 57 + (modifiers: [$modkey], key: Return, action: Spawn, arg: $terminal),
43 - (modifiers: [Mod4], key: D, action: Spawn, arg: ["sh", "-c", "dmenu_run -l 10"]), 58 + (modifiers: [$modkey], key: D, action: Spawn, arg: ["sh", "-c", "dmenu_run -l 10"]),
44 - (modifiers: [Mod4], key: S, action: Spawn, arg: ["sh", "-c", "maim -s | xclip -selection clipboard -t image/png"]), 59 + (modifiers: [$modkey], key: S, action: Spawn, arg: ["sh", "-c", "maim -s | xclip -selection clipboard -t image/png"]),
45 - (modifiers: [Mod4], key: Q, action: KillClient), 60 + (modifiers: [$modkey], key: Q, action: KillClient),
46 - (modifiers: [Mod4, Shift], key: F, action: ToggleFullScreen), 61 + (modifiers: [$modkey, Shift], key: F, action: ToggleFullScreen),
47 - (modifiers: [Mod4, Shift], key: Space, action: ToggleFloating), 62 + (modifiers: [$modkey, Shift], key: Space, action: ToggleFloating),
48 - (modifiers: [Mod4], key: F, action: ChangeLayout, arg: "normie"), 63 + (modifiers: [$modkey], key: F, action: ChangeLayout, arg: "normie"),
49 - (modifiers: [Mod4], key: C, action: ChangeLayout, arg: "tiling"), 64 + (modifiers: [$modkey], key: C, action: ChangeLayout, arg: "tiling"),
50 - (modifiers: [Mod1], key: N, action: CycleLayout), 65 + (modifiers: [$secondary_modkey], key: N, action: CycleLayout),
51 - (modifiers: [Mod4], key: A, action: ToggleGaps), 66 + (modifiers: [$modkey], key: A, action: ToggleGaps),
52 - (modifiers: [Mod4, Shift], key: Q, action: Quit), 67 + (modifiers: [$modkey, Shift], key: Q, action: Quit),
53 - (modifiers: [Mod4, Shift], key: R, action: Restart), 68 + (modifiers: [$modkey, Shift], key: R, action: Restart),
54 - (modifiers: [Mod4], key: J, action: FocusStack, arg: -1), 69 + (modifiers: [$modkey], key: J, action: FocusStack, arg: -1),
55 - (modifiers: [Mod4], key: K, action: FocusStack, arg: 1), 70 + (modifiers: [$modkey], key: K, action: FocusStack, arg: 1),
56 - (modifiers: [Mod4], key: Comma, action: FocusMonitor, arg: -1), 71 + (modifiers: [$modkey], key: Comma, action: FocusMonitor, arg: -1),
57 - (modifiers: [Mod4], key: Period, action: FocusMonitor, arg: 1), 72 + (modifiers: [$modkey], key: Period, action: FocusMonitor, arg: 1),
58 - (modifiers: [Mod4], key: Key1, action: ViewTag, arg: 0), 73 + (modifiers: [$modkey], key: Key1, action: ViewTag, arg: 0),
59 - (modifiers: [Mod4], key: Key2, action: ViewTag, arg: 1), 74 + (modifiers: [$modkey], key: Key2, action: ViewTag, arg: 1),
60 - (modifiers: [Mod4], key: Key3, action: ViewTag, arg: 2), 75 + (modifiers: [$modkey], key: Key3, action: ViewTag, arg: 2),
61 - (modifiers: [Mod4], key: Key4, action: ViewTag, arg: 3), 76 + (modifiers: [$modkey], key: Key4, action: ViewTag, arg: 3),
62 - (modifiers: [Mod4], key: Key5, action: ViewTag, arg: 4), 77 + (modifiers: [$modkey], key: Key5, action: ViewTag, arg: 4),
63 - (modifiers: [Mod4], key: Key6, action: ViewTag, arg: 5), 78 + (modifiers: [$modkey], key: Key6, action: ViewTag, arg: 5),
64 - (modifiers: [Mod4], key: Key7, action: ViewTag, arg: 6), 79 + (modifiers: [$modkey], key: Key7, action: ViewTag, arg: 6),
65 - (modifiers: [Mod4], key: Key8, action: ViewTag, arg: 7), 80 + (modifiers: [$modkey], key: Key8, action: ViewTag, arg: 7),
66 - (modifiers: [Mod4], key: Key9, action: ViewTag, arg: 8), 81 + (modifiers: [$modkey], key: Key9, action: ViewTag, arg: 8),
67 - (modifiers: [Mod4, Shift], key: Key1, action: MoveToTag, arg: 0), 82 + (modifiers: [$modkey, Shift], key: Key1, action: MoveToTag, arg: 0),
68 - (modifiers: [Mod4, Shift], key: Key2, action: MoveToTag, arg: 1), 83 + (modifiers: [$modkey, Shift], key: Key2, action: MoveToTag, arg: 1),
69 - (modifiers: [Mod4, Shift], key: Key3, action: MoveToTag, arg: 2), 84 + (modifiers: [$modkey, Shift], key: Key3, action: MoveToTag, arg: 2),
70 - (modifiers: [Mod4, Shift], key: Key4, action: MoveToTag, arg: 3), 85 + (modifiers: [$modkey, Shift], key: Key4, action: MoveToTag, arg: 3),
71 - (modifiers: [Mod4, Shift], key: Key5, action: MoveToTag, arg: 4), 86 + (modifiers: [$modkey, Shift], key: Key5, action: MoveToTag, arg: 4),
72 - (modifiers: [Mod4, Shift], key: Key6, action: MoveToTag, arg: 5), 87 + (modifiers: [$modkey, Shift], key: Key6, action: MoveToTag, arg: 5),
73 - (modifiers: [Mod4, Shift], key: Key7, action: MoveToTag, arg: 6), 88 + (modifiers: [$modkey, Shift], key: Key7, action: MoveToTag, arg: 6),
74 - (modifiers: [Mod4, Shift], key: Key8, action: MoveToTag, arg: 7), 89 + (modifiers: [$modkey, Shift], key: Key8, action: MoveToTag, arg: 7),
75 - (modifiers: [Mod4, Shift], key: Key9, action: MoveToTag, arg: 8), 90 + (modifiers: [$modkey, Shift], key: Key9, action: MoveToTag, arg: 8),
76 91
77 // Moving Windows 92 // Moving Windows
78 - (modifiers: [Mod4, Control], key: K, action: SmartMoveWin, arg: 0), // UP 93 + (modifiers: [$modkey, Control], key: K, action: SmartMoveWin, arg: 0), // UP
79 - (modifiers: [Mod4, Control], key: J, action: SmartMoveWin, arg: 1), // DOWN 94 + (modifiers: [$modkey, Control], key: J, action: SmartMoveWin, arg: 1), // DOWN
80 - (modifiers: [Mod4, Control], key: H, action: SmartMoveWin, arg: 2), // LEFT 95 + (modifiers: [$modkey, Control], key: H, action: SmartMoveWin, arg: 2), // LEFT
81 - (modifiers: [Mod4, Control], key: L, action: SmartMoveWin, arg: 3), // RIGHT 96 + (modifiers: [$modkey, Control], key: L, action: SmartMoveWin, arg: 3), // RIGHT
82 97
83 // Exchanging Clients 98 // Exchanging Clients
84 - (modifiers: [Mod4, Shift], key: K, action: ExchangeClient, arg: 0), // UP 99 + (modifiers: [$modkey, Shift], key: K, action: ExchangeClient, arg: 0), // UP
85 - (modifiers: [Mod4, Shift], key: J, action: ExchangeClient, arg: 1), // DOWN 100 + (modifiers: [$modkey, Shift], key: J, action: ExchangeClient, arg: 1), // DOWN
86 - (modifiers: [Mod4, Shift], key: H, action: ExchangeClient, arg: 2), // LEFT 101 + (modifiers: [$modkey, Shift], key: H, action: ExchangeClient, arg: 2), // LEFT
87 - (modifiers: [Mod4, Shift], key: L, action: ExchangeClient, arg: 3), // RIGHT 102 + (modifiers: [$modkey, Shift], key: L, action: ExchangeClient, arg: 3), // RIGHT
88 103
89 // Example keychord bindings (uncomment to use): 104 // Example keychord bindings (uncomment to use):
90 - // Press Mod4+Space, then f to spawn firefox 105 + // KEYCHORDS
91 - // (keys: [(modifiers: [Mod4], key: Space), (modifiers: [], key: F)], action: Spawn, arg: "firefox"),
92 -
93 // Press Mod4+Space, then t to spawn terminal 106 // Press Mod4+Space, then t to spawn terminal
94 - // (keys: [(modifiers: [Mod4], key: Space), (modifiers: [], key: T)], action: Spawn, arg: "st"), 107 + (keys: [(modifiers: [Mod4], key: Space), (modifiers: [], key: T)], action: Spawn, arg: $terminal),
95 -
96 - // Press Mod4+e, then e to spawn a text editor (same key twice)
97 - // (keys: [(modifiers: [Mod4], key: E), (modifiers: [], key: E)], action: Spawn, arg: "nvim"),
98 -
99 - // Press Mod4+x, then Shift+c to kill client (modifier on second key)
100 - // (keys: [(modifiers: [Mod4], key: X), (modifiers: [Shift], key: C)], action: KillClient),
101 ], 108 ],
102 109
103 status_blocks: [ 110 status_blocks: [
104 - (format: "Ram: {used}/{total} GB", command: "Ram", interval_secs: 5, color: 0x7aa2f7, underline: true), 111 + (format: "Ram: {used}/{total} GB", command: "Ram", interval_secs: 5, color: $color_light_blue, underline: true),
105 - (format: " │ ", command: "Static", interval_secs: 18446744073709551615, color: 0xa9b1d6, underline: false), 112 + (format: " │ ", command: "Static", interval_secs: 18446744073709551615, color: $color_lavender, underline: false),
106 - (format: "Kernel: {}", command: "Shell", command_arg: "uname -r", interval_secs: 18446744073709551615, color: 0xf7768e, underline: true), 113 + (format: "Kernel: {}", command: "Shell", command_arg: "uname -r", interval_secs: 18446744073709551615, color: $color_red, underline: true),
107 - (format: " │ ", command: "Static", interval_secs: 18446744073709551615, color: 0xa9b1d6, underline: false), 114 + (format: " │ ", command: "Static", interval_secs: 18446744073709551615, color: $color_lavender, underline: false),
108 - (format: "{}", command: "DateTime", command_arg: "%a, %b %d - %-I:%M %P", interval_secs: 1, color: 0x0db9d7, underline: true), 115 + (format: "{}", command: "DateTime", command_arg: "%a, %b %d - %-I:%M %P", interval_secs: 1, color: $color_cyan, underline: true),
109 ], 116 ],
110 - 117 +
111 - scheme_normal: (foreground: 0xbbbbbb, background: 0x1a1b26, underline: 0x444444), 118 + scheme_normal: (foreground: $color_fg, background: $color_bg, underline: 0x444444),
112 - scheme_occupied: (foreground: 0x0db9d7, background: 0x1a1b26, underline: 0x0db9d7), 119 + scheme_occupied: (foreground: $color_cyan, background: $color_bg, underline: $color_cyan),
113 - scheme_selected: (foreground: 0x0db9d7, background: 0x1a1b26, underline: 0xad8ee6), 120 + scheme_selected: (foreground: $color_cyan, background: $color_bg, underline: $color_purple),
114 ) 121 )
115 122
+28 −16 test-config.ron
@@ -2,19 +2,31 @@
2 // OXWM Configuration File 2 // OXWM Configuration File
3 // Edit this file and reload with Mod+Shift+R (no compilation needed!) 3 // Edit this file and reload with Mod+Shift+R (no compilation needed!)
4 4
5 +#DEFINE $terminal = "alacritty"
6 +#DEFINE $color_blue = 0x6dade3
7 +#DEFINE $color_grey = 0xbbbbbb
8 +#DEFINE $color_green = 0x9ece6a
9 +#DEFINE $color_red = 0xf7768e
10 +#DEFINE $color_cyan = 0x0db9d7
11 +#DEFINE $color_purple = 0xad8ee6
12 +#DEFINE $color_lavender = 0xa9b1d6
13 +#DEFINE $color_bg = 0x1a1b26
14 +#DEFINE $color_fg = 0xbbbbbb
15 +#DEFINE $color_light_blue = 0x7aa2f7
16 +
5 ( 17 (
6 border_width: 2, 18 border_width: 2,
7 - border_focused: 0x6dade3, 19 + border_focused: $color_blue,
8 - border_unfocused: 0xbbbbbb, 20 + border_unfocused: $color_grey,
9 font: "JetBrainsMono Nerd Font:style=Bold:size=12", 21 font: "JetBrainsMono Nerd Font:style=Bold:size=12",
10 - 22 +
11 gaps_enabled: true, 23 gaps_enabled: true,
12 gap_inner_horizontal: 5, 24 gap_inner_horizontal: 5,
13 gap_inner_vertical: 5, 25 gap_inner_vertical: 5,
14 gap_outer_horizontal: 5, 26 gap_outer_horizontal: 5,
15 gap_outer_vertical: 5, 27 gap_outer_vertical: 5,
16 - 28 +
17 - terminal: "st", 29 + terminal: $terminal,
18 modkey: Mod1, 30 modkey: Mod1,
19 tags: ["1", "2", "3", "4", "5", "6", "7", "8", "9"], 31 tags: ["1", "2", "3", "4", "5", "6", "7", "8", "9"],
20 32
@@ -30,8 +42,8 @@
30 ], 42 ],
31 43
32 keybindings: [ 44 keybindings: [
33 - (modifiers: [Mod1], key: Return, action: Spawn, arg: "st"),
34 (keys: [(modifiers: [Mod1], key: Space), (modifiers: [], key: T)], action: Spawn, arg: "st"), 45 (keys: [(modifiers: [Mod1], key: Space), (modifiers: [], key: T)], action: Spawn, arg: "st"),
46 + (modifiers: [Mod1], key: Return, action: Spawn, arg: $terminal),
35 (modifiers: [Mod1], key: D, action: Spawn, arg: ["sh", "-c", "dmenu_run -l 10"]), 47 (modifiers: [Mod1], key: D, action: Spawn, arg: ["sh", "-c", "dmenu_run -l 10"]),
36 (modifiers: [Mod1], key: S, action: Spawn, arg: ["sh", "-c", "maim -s | xclip -selection clipboard -t image/png"]), 48 (modifiers: [Mod1], key: S, action: Spawn, arg: ["sh", "-c", "maim -s | xclip -selection clipboard -t image/png"]),
37 (modifiers: [Mod1], key: Q, action: KillClient), 49 (modifiers: [Mod1], key: Q, action: KillClient),
@@ -85,7 +97,7 @@
85 full: "󰁹 Bat: {}%", 97 full: "󰁹 Bat: {}%",
86 ), 98 ),
87 interval_secs: 30, 99 interval_secs: 30,
88 - color: 0x9ece6a, 100 + color: $color_green,
89 underline: true, 101 underline: true,
90 ), 102 ),
91 103
@@ -94,7 +106,7 @@
94 format: " │ ", 106 format: " │ ",
95 command: "Static", 107 command: "Static",
96 interval_secs: 18446744073709551615, 108 interval_secs: 18446744073709551615,
97 - color: 0xa9b1d6, 109 + color: $color_lavender,
98 underline: false, 110 underline: false,
99 ), 111 ),
100 112
@@ -103,7 +115,7 @@
103 format: "󰍛 {used}/{total} GB", 115 format: "󰍛 {used}/{total} GB",
104 command: "Ram", 116 command: "Ram",
105 interval_secs: 5, 117 interval_secs: 5,
106 - color: 0x7aa2f7, 118 + color: $color_light_blue,
107 underline: true, 119 underline: true,
108 ), 120 ),
109 121
@@ -112,7 +124,7 @@
112 format: " │ ", 124 format: " │ ",
113 command: "Static", 125 command: "Static",
114 interval_secs: 18446744073709551615, 126 interval_secs: 18446744073709551615,
115 - color: 0xa9b1d6, 127 + color: $color_lavender,
116 underline: false, 128 underline: false,
117 ), 129 ),
118 130
@@ -122,7 +134,7 @@
122 command: "Shell", 134 command: "Shell",
123 command_arg: "uname -r", 135 command_arg: "uname -r",
124 interval_secs: 18446744073709551615, 136 interval_secs: 18446744073709551615,
125 - color: 0xf7768e, 137 + color: $color_red,
126 underline: true, 138 underline: true,
127 ), 139 ),
128 140
@@ -131,7 +143,7 @@
131 format: " │ ", 143 format: " │ ",
132 command: "Static", 144 command: "Static",
133 interval_secs: 18446744073709551615, 145 interval_secs: 18446744073709551615,
134 - color: 0xa9b1d6, 146 + color: $color_lavender,
135 underline: false, 147 underline: false,
136 ), 148 ),
137 149
@@ -141,13 +153,13 @@
141 command: "DateTime", 153 command: "DateTime",
142 command_arg: "%a, %b %d - %-I:%M %P", 154 command_arg: "%a, %b %d - %-I:%M %P",
143 interval_secs: 1, 155 interval_secs: 1,
144 - color: 0x0db9d7, 156 + color: $color_cyan,
145 underline: true, 157 underline: true,
146 ), 158 ),
147 ], 159 ],
148 160
149 - scheme_normal: (foreground: 0xbbbbbb, background: 0x1a1b26, underline: 0x444444), 161 + scheme_normal: (foreground: $color_fg, background: $color_bg, underline: 0x444444),
150 - scheme_occupied: (foreground: 0x0db9d7, background: 0x1a1b26, underline: 0x0db9d7), 162 + scheme_occupied: (foreground: $color_cyan, background: $color_bg, underline: $color_cyan),
151 - scheme_selected: (foreground: 0x0db9d7, background: 0x1a1b26, underline: 0xad8ee6), 163 + scheme_selected: (foreground: $color_cyan, background: $color_bg, underline: $color_purple),
152 ) 164 )
153 165