aboutsummaryrefslogtreecommitdiff
path: root/src/layout.rs
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2023-08-14 18:34:39 +0400
committerIvan Molodetskikh <yalterz@gmail.com>2023-08-14 18:37:33 +0400
commitc05326d1b6dba32bc681b24ca178f471ae9e8044 (patch)
treef27b919ae8566780f2e7321052e5ec5ee56749f5 /src/layout.rs
parent2a163bb4b54954614ab07e1ce8b06abada169c7e (diff)
downloadniri-c05326d1b6dba32bc681b24ca178f471ae9e8044.tar.gz
niri-c05326d1b6dba32bc681b24ca178f471ae9e8044.tar.bz2
niri-c05326d1b6dba32bc681b24ca178f471ae9e8044.zip
Add Mod+F to maximize
Diffstat (limited to 'src/layout.rs')
-rw-r--r--src/layout.rs30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/layout.rs b/src/layout.rs
index 6e4d9306..c4ab517b 100644
--- a/src/layout.rs
+++ b/src/layout.rs
@@ -759,6 +759,13 @@ impl<W: LayoutElement> MonitorSet<W> {
};
monitor.toggle_width();
}
+
+ pub fn toggle_full_width(&mut self) {
+ let Some(monitor) = self.active_monitor() else {
+ return;
+ };
+ monitor.toggle_full_width();
+ }
}
impl MonitorSet<Window> {
@@ -976,6 +983,10 @@ impl<W: LayoutElement> Monitor<W> {
fn toggle_width(&mut self) {
self.active_workspace().toggle_width();
}
+
+ fn toggle_full_width(&mut self) {
+ self.active_workspace().toggle_full_width();
+ }
}
impl Monitor<Window> {
@@ -1392,6 +1403,14 @@ impl<W: LayoutElement> Workspace<W> {
self.columns[self.active_column_idx].toggle_width(self.view_size);
}
+
+ fn toggle_full_width(&mut self) {
+ if self.columns.is_empty() {
+ return;
+ }
+
+ self.columns[self.active_column_idx].toggle_full_width(self.view_size);
+ }
}
impl Workspace<Window> {
@@ -1555,6 +1574,17 @@ impl<W: LayoutElement> Column<W> {
let width = ColumnWidth::PresetProportion(idx);
self.set_width(view_size, width);
}
+
+ fn toggle_full_width(&mut self, view_size: Size<i32, Logical>) {
+ let width = match self.width {
+ ColumnWidth::Proportion(1.) => {
+ // FIXME: would be good to restore to previous width here.
+ ColumnWidth::default()
+ }
+ _ => ColumnWidth::Proportion(1.),
+ };
+ self.set_width(view_size, width);
+ }
}
pub fn output_size(output: &Output) -> Size<i32, Logical> {