Skip to content

Commit 7471cd5

Browse files
committed
screenshot_ui: add ctrl+a command to select entire output
1 parent e863f52 commit 7471cd5

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

src/input/mod.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1636,7 +1636,11 @@ impl State {
16361636
self.niri.queue_redraw_all();
16371637
}
16381638
Action::MaximizeColumn => {
1639-
self.niri.layout.toggle_full_width();
1639+
if self.niri.screenshot_ui.is_open() {
1640+
self.niri.screenshot_ui.select_entire_output();
1641+
} else {
1642+
self.niri.layout.toggle_full_width();
1643+
}
16401644
}
16411645
Action::MaximizeWindowToEdges => {
16421646
let focus = self.niri.layout.focus().map(|m| m.window.clone());
@@ -4570,6 +4574,7 @@ fn allowed_during_screenshot(action: &Action) -> bool {
45704574
| Action::SetWindowWidth(_)
45714575
| Action::SetWindowHeight(_)
45724576
| Action::SetColumnWidth(_)
4577+
| Action::MaximizeColumn
45734578
)
45744579
}
45754580

src/ui/screenshot_ui.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,25 @@ impl ScreenshotUi {
460460
self.update_buffers();
461461
}
462462

463+
pub fn select_entire_output(&mut self) {
464+
let Self::Open {
465+
selection,
466+
output_data,
467+
..
468+
} = self
469+
else {
470+
return;
471+
};
472+
473+
let current_data = &output_data[&selection.0];
474+
let size = current_data.size;
475+
476+
selection.1 = Point::new(0, 0);
477+
selection.2 = Point::new(size.w - 1, size.h - 1);
478+
479+
self.update_buffers();
480+
}
481+
463482
pub fn set_width(&mut self, change: SizeChange) {
464483
let Self::Open {
465484
selection: (output, a, b),

0 commit comments

Comments
 (0)