tony / oxwm

Fixed bug where fullscreen was global and not per monitor. also, added st to test config. Browse files
tonybtw committed 2025-11-04 parent ef90096 commit 1dc1e2743267462b4d25cab7fe6225edd4ca12e9
Showing 3 changed files with 32 additions and 32 deletions. UnifiedSplit
+1 −1 resources/test-config.ron
@@ -2,7 +2,7 @@
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" 5 +#DEFINE $terminal = "st"
6 #DEFINE $color_blue = 0x6dade3 6 #DEFINE $color_blue = 0x6dade3
7 #DEFINE $color_grey = 0xbbbbbb 7 #DEFINE $color_grey = 0xbbbbbb
8 #DEFINE $color_green = 0x9ece6a 8 #DEFINE $color_green = 0x9ece6a
+2 −0 src/monitor.rs
@@ -13,6 +13,7 @@ pub struct Monitor {
13 pub height: u32, 13 pub height: u32,
14 pub selected_tags: u32, 14 pub selected_tags: u32,
15 pub focused_window: Option<Window>, 15 pub focused_window: Option<Window>,
16 + pub fullscreen_enabled: bool,
16 } 17 }
17 18
18 impl Monitor { 19 impl Monitor {
@@ -24,6 +25,7 @@ impl Monitor {
24 height, 25 height,
25 selected_tags: 1, 26 selected_tags: 1,
26 focused_window: None, 27 focused_window: None,
28 + fullscreen_enabled: false,
27 } 29 }
28 } 30 }
29 31
+29 −31 src/window_manager.rs
@@ -59,7 +59,6 @@ pub struct WindowManager {
59 window_monitor: std::collections::HashMap<Window, usize>, 59 window_monitor: std::collections::HashMap<Window, usize>,
60 window_geometries: std::collections::HashMap<Window, (i16, i16, u16, u16)>, 60 window_geometries: std::collections::HashMap<Window, (i16, i16, u16, u16)>,
61 gaps_enabled: bool, 61 gaps_enabled: bool,
62 - fullscreen_enabled: bool,
63 floating_windows: HashSet<Window>, 62 floating_windows: HashSet<Window>,
64 bars: Vec<Bar>, 63 bars: Vec<Bar>,
65 monitors: Vec<Monitor>, 64 monitors: Vec<Monitor>,
@@ -168,7 +167,6 @@ impl WindowManager {
168 window_monitor: std::collections::HashMap::new(), 167 window_monitor: std::collections::HashMap::new(),
169 window_geometries: std::collections::HashMap::new(), 168 window_geometries: std::collections::HashMap::new(),
170 gaps_enabled, 169 gaps_enabled,
171 - fullscreen_enabled: false,
172 floating_windows: HashSet::new(), 170 floating_windows: HashSet::new(),
173 bars, 171 bars,
174 monitors, 172 monitors,
@@ -757,19 +755,19 @@ impl WindowManager {
757 } 755 }
758 756
759 fn toggle_fullscreen(&mut self) -> WmResult<()> { 757 fn toggle_fullscreen(&mut self) -> WmResult<()> {
760 - self.fullscreen_enabled = !self.fullscreen_enabled; 758 + if let Some(monitor) = self.monitors.get_mut(self.selected_monitor) {
759 + monitor.fullscreen_enabled = !monitor.fullscreen_enabled;
761 760
762 - if self.fullscreen_enabled { 761 + if let Some(bar) = self.bars.get(self.selected_monitor) {
763 - for bar in &self.bars { 762 + if monitor.fullscreen_enabled {
764 - self.connection.unmap_window(bar.window())?; 763 + self.connection.unmap_window(bar.window())?;
765 - } 764 + } else {
766 - } else { 765 + self.connection.map_window(bar.window())?;
767 - for bar in &self.bars { 766 + }
768 - self.connection.map_window(bar.window())?;
769 } 767 }
770 - }
771 768
772 - self.apply_layout()?; 769 + self.apply_layout()?;
770 + }
773 Ok(()) 771 Ok(())
774 } 772 }
775 773
@@ -1606,25 +1604,25 @@ impl WindowManager {
1606 return Ok(()); 1604 return Ok(());
1607 } 1605 }
1608 1606
1609 - let border_width = if self.fullscreen_enabled { 0 } else { self.config.border_width };
1610 -
1611 - let gaps = if self.gaps_enabled && !self.fullscreen_enabled {
1612 - GapConfig {
1613 - inner_horizontal: self.config.gap_inner_horizontal,
1614 - inner_vertical: self.config.gap_inner_vertical,
1615 - outer_horizontal: self.config.gap_outer_horizontal,
1616 - outer_vertical: self.config.gap_outer_vertical,
1617 - }
1618 - } else {
1619 - GapConfig {
1620 - inner_horizontal: 0,
1621 - inner_vertical: 0,
1622 - outer_horizontal: 0,
1623 - outer_vertical: 0,
1624 - }
1625 - };
1626 -
1627 for (monitor_index, monitor) in self.monitors.iter().enumerate() { 1607 for (monitor_index, monitor) in self.monitors.iter().enumerate() {
1608 + let border_width = if monitor.fullscreen_enabled { 0 } else { self.config.border_width };
1609 +
1610 + let gaps = if self.gaps_enabled && !monitor.fullscreen_enabled {
1611 + GapConfig {
1612 + inner_horizontal: self.config.gap_inner_horizontal,
1613 + inner_vertical: self.config.gap_inner_vertical,
1614 + outer_horizontal: self.config.gap_outer_horizontal,
1615 + outer_vertical: self.config.gap_outer_vertical,
1616 + }
1617 + } else {
1618 + GapConfig {
1619 + inner_horizontal: 0,
1620 + inner_vertical: 0,
1621 + outer_horizontal: 0,
1622 + outer_vertical: 0,
1623 + }
1624 + };
1625 +
1628 let visible: Vec<Window> = self 1626 let visible: Vec<Window> = self
1629 .windows 1627 .windows
1630 .iter() 1628 .iter()
@@ -1645,7 +1643,7 @@ impl WindowManager {
1645 .copied() 1643 .copied()
1646 .collect(); 1644 .collect();
1647 1645
1648 - let bar_height = if self.fullscreen_enabled { 1646 + let bar_height = if monitor.fullscreen_enabled {
1649 0 1647 0
1650 } else { 1648 } else {
1651 self.bars 1649 self.bars