tony / oxwm

Merge remote-tracking branch 'origin/master' into optimizations-multi-monitor Browse files
tonybtw committed 2025-10-23 parents bc73085 0b23d5f commit eb9146625135f10b3c1d0115d045c8d4240a55ed
Showing 2 changed files with 21 additions and 7 deletions. UnifiedSplit
+4 −5 src/bin/main.rs
@@ -1,4 +1,4 @@
1 -use anyhow::Result; 1 +use anyhow::{Context, Result};
2 use std::path::PathBuf; 2 use std::path::PathBuf;
3 3
4 fn main() -> Result<()> { 4 fn main() -> Result<()> {
@@ -59,11 +59,10 @@ fn load_config(custom_path: Option<PathBuf>) -> Result<oxwm::Config> {
59 default_path 59 default_path
60 }; 60 };
61 61
62 - let config_str = std::fs::read_to_string(&config_path) 62 + let config_str =
63 - .map_err(|e| anyhow::anyhow!("Failed to read config file: {}", e))?; 63 + std::fs::read_to_string(&config_path).with_context(|| "Failed to read config file")?;
64 64
65 - oxwm::config::parse_config(&config_str) 65 + oxwm::config::parse_config(&config_str).with_context(|| "Failed to parse config")
66 - .map_err(|e| anyhow::anyhow!("Failed to parse config: {}", e))
67 } 66 }
68 67
69 fn init_config() -> Result<()> { 68 fn init_config() -> Result<()> {
+17 −2 src/window_manager.rs
@@ -381,11 +381,26 @@ impl WindowManager {
381 self.floating_windows.remove(&focused); 381 self.floating_windows.remove(&focused);
382 self.apply_layout()?; 382 self.apply_layout()?;
383 } else { 383 } else {
384 - self.floating_windows.insert(focused); 384 + let float_width = (self.screen.width_in_pixels / 2) as u32;
385 + let float_height = (self.screen.height_in_pixels / 2) as u32;
386 +
387 + let border_width = self.config.border_width;
388 +
389 + let center_width = ((self.screen.width_in_pixels - float_width as u16)/2) as i32;
390 + let center_height = ((self.screen.height_in_pixels - float_height as u16)/2) as i32;
391 +
385 self.connection.configure_window( 392 self.connection.configure_window(
386 focused, 393 focused,
387 - &ConfigureWindowAux::new().stack_mode(StackMode::ABOVE), 394 + &ConfigureWindowAux::new()
395 + .x(center_width)
396 + .y(center_height)
397 + .width(float_width)
398 + .height(float_height)
399 + .border_width(border_width)
400 + .stack_mode(StackMode::ABOVE),
388 )?; 401 )?;
402 +
403 + self.floating_windows.insert(focused);
389 self.apply_layout()?; 404 self.apply_layout()?;
390 self.connection.flush()?; 405 self.connection.flush()?;
391 } 406 }