Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Lint (fmt)
  • Loading branch information
Antiz96 committed Apr 26, 2026
commit 42bff797fe8c2f7c114f32f9d7ac1551863a4349
18 changes: 13 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,7 @@ fn main() -> anyhow::Result<()> {
// Run in "maximizing-to-edges" mode if the -E / --edges-maximizing arg is passed
let edges_maximizing = has_arg("-E") || has_arg("--edges-maximizing");
if edges_maximizing {
info!(
"Running in maximize-to-edges mode: Maximize windows to edges"
);
info!("Running in maximize-to-edges mode: Maximize windows to edges");
}

// Set pixel tolerances for window/output size comparison
Expand Down Expand Up @@ -126,15 +124,25 @@ fn main() -> anyhow::Result<()> {
1 => {
let first_window = windows[0];
if !is_maximized(&state, &outputs, first_window, tol_h, tol_w) {
maximize_window(&mut action_socket, &state, first_window, edges_maximizing)?;
maximize_window(
&mut action_socket,
&state,
first_window,
edges_maximizing,
)?;
}
}

// If running in tiling layout mode, un-maximize the first window when a second one is opened
2 if tiling_layout => {
let first_window = windows[0];
if is_maximized(&state, &outputs, first_window, tol_h, tol_w) {
maximize_window(&mut action_socket, &state, first_window, edges_maximizing)?;
maximize_window(
&mut action_socket,
&state,
first_window,
edges_maximizing,
)?;
}
}
_ => {}
Expand Down
8 changes: 3 additions & 5 deletions src/maximize_window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@ pub fn maximize_window(
edges_maximizing: bool,
) -> anyhow::Result<()> {
if edges_maximizing {
let _ = socket.send(Request::Action(
niri_ipc::Action::MaximizeWindowToEdges {
id: Some(window_id),
},
));
let _ = socket.send(Request::Action(niri_ipc::Action::MaximizeWindowToEdges {
id: Some(window_id),
}));
info!("Maximized window to edges {}", window_id);
} else {
// We need this information to restore focus state after maximizing @window_id
Expand Down