Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 40 additions & 7 deletions src/layouts/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,29 @@ pub fn arrange_monitor(ctx: &mut WmCtx<'_>, monitor_id: MonitorId) {

apply_border_widths(ctx, monitor_id);
run_layout(ctx, monitor_id);
apply_fullscreen(ctx, monitor_id);
place_overlay(ctx, monitor_id);
}

fn apply_fullscreen(ctx: &mut WmCtx<'_>, monitor_id: MonitorId) {
let (mon_rect, clients, selected_tags) = match ctx.g().monitor(monitor_id) {
Some(m) => (m.monitor_rect, m.clients.clone(), m.selected_tags()),
None => return,
};

let fullscreen_windows: Vec<_> = clients
.into_iter()
.filter(|&win| {
ctx.client(win)
.is_some_and(|c| c.is_true_fullscreen() && c.is_visible_on_tags(selected_tags))
})
.collect();

for win in fullscreen_windows {
ctx.resize_client(win, mon_rect);
}
}

fn apply_border_widths(ctx: &mut WmCtx<'_>, monitor_id: MonitorId) {
let m = match ctx.g().monitor(monitor_id) {
Some(m) => m,
Expand All @@ -68,9 +88,10 @@ fn apply_border_widths(ctx: &mut WmCtx<'_>, monitor_id: MonitorId) {
return None;
}

let strip_border = !info.is_floating
&& !info.is_fullscreen
&& ((clientcount == 1 && is_tiling) || is_monocle);
let strip_border = info.is_true_fullscreen()
|| (!info.is_floating
&& !info.is_fullscreen
&& ((clientcount == 1 && is_tiling) || is_monocle));

let new_border = if strip_border {
0
Expand Down Expand Up @@ -152,11 +173,14 @@ pub fn restack(ctx: &mut WmCtx<'_>, monitor_id: MonitorId) {

let mut tiled_stack = Vec::new();
let mut floating_stack = Vec::new();
let mut fullscreen_stack = Vec::new();
if let Some(m) = ctx.g().monitor(monitor_id) {
for &win in &m.stack {
if let Some(c) = ctx.client(win) {
if c.is_visible_on_tags(selected_tags) {
if c.is_floating {
if c.is_true_fullscreen() {
fullscreen_stack.push(win);
} else if c.is_floating {
floating_stack.push(win);
} else {
tiled_stack.push(win);
Expand All @@ -166,7 +190,13 @@ pub fn restack(ctx: &mut WmCtx<'_>, monitor_id: MonitorId) {
}
}

if let Some(idx) = floating_stack
if let Some(idx) = fullscreen_stack
.iter()
.position(|&win| win == selected_window)
{
let selected = fullscreen_stack.remove(idx);
fullscreen_stack.push(selected);
} else if let Some(idx) = floating_stack
.iter()
.position(|&win| win == selected_window)
{
Expand All @@ -186,12 +216,15 @@ pub fn restack(ctx: &mut WmCtx<'_>, monitor_id: MonitorId) {
}
}

// Final z-order: tiled clients, then the bar, then floating clients.
// Final z-order: tiled clients, then the bar, then floating clients,
// and finally fullscreen clients.
// This keeps every floating window above tiled content while still
// keeping the selected window topmost within its own class.
// keeping the selected window topmost within its own class, and guarantees
// fullscreen windows sit above everything else.
let mut stack = tiled_stack;
stack.push(bar_win);
stack.extend(floating_stack);
stack.extend(fullscreen_stack);
ctx.restack(&stack);
ctx.flush();
}
Expand Down
3 changes: 2 additions & 1 deletion src/types/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,12 @@ impl Client {
///
/// Returns true if the client is:
/// - Not floating
/// - Not in true fullscreen mode
/// - Visible on the selected tags
/// - Not hidden
#[inline]
pub fn is_tiled(&self, selected_tags: u32) -> bool {
!self.is_floating && self.is_visible_on_tags(selected_tags) && !self.is_hidden
!self.is_floating && !self.is_true_fullscreen() && self.is_visible_on_tags(selected_tags) && !self.is_hidden
}

/// Check if the client is in true fullscreen mode (not fake fullscreen).
Expand Down
Loading