mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-24 02:01:18 +07:00
Add Mod+F to maximize
This commit is contained in:
@@ -66,6 +66,7 @@ The general system is: if a hotkey switches somewhere, then adding <kbd>Ctrl</kb
|
|||||||
| <kbd>Mod</kbd><kbd>,</kbd> | Consume the window to the right into the focused column |
|
| <kbd>Mod</kbd><kbd>,</kbd> | Consume the window to the right into the focused column |
|
||||||
| <kbd>Mod</kbd><kbd>.</kbd> | Expel the focused window into its own column |
|
| <kbd>Mod</kbd><kbd>.</kbd> | Expel the focused window into its own column |
|
||||||
| <kbd>Mod</kbd><kbd>R</kbd> | Toggle between preset window widths |
|
| <kbd>Mod</kbd><kbd>R</kbd> | Toggle between preset window widths |
|
||||||
|
| <kbd>Mod</kbd><kbd>F</kbd> | Maximize window |
|
||||||
| <kbd>Mod</kbd><kbd>Shift</kbd><kbd>E</kbd> | Exit niri |
|
| <kbd>Mod</kbd><kbd>Shift</kbd><kbd>E</kbd> | Exit niri |
|
||||||
|
|
||||||
[PaperWM]: https://github.com/paperwm/PaperWM
|
[PaperWM]: https://github.com/paperwm/PaperWM
|
||||||
|
|||||||
+6
-1
@@ -33,6 +33,7 @@ enum Action {
|
|||||||
MoveToWorkspaceDown,
|
MoveToWorkspaceDown,
|
||||||
MoveToWorkspaceUp,
|
MoveToWorkspaceUp,
|
||||||
ToggleWidth,
|
ToggleWidth,
|
||||||
|
ToggleFullWidth,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub enum CompositorMod {
|
pub enum CompositorMod {
|
||||||
@@ -74,7 +75,7 @@ fn action(comp_mod: CompositorMod, keysym: KeysymHandle, mods: ModifiersState) -
|
|||||||
KEY_E => Action::Quit,
|
KEY_E => Action::Quit,
|
||||||
KEY_t => Action::SpawnTerminal,
|
KEY_t => Action::SpawnTerminal,
|
||||||
KEY_q => Action::CloseWindow,
|
KEY_q => Action::CloseWindow,
|
||||||
KEY_f => Action::ToggleFullscreen,
|
KEY_F => Action::ToggleFullscreen,
|
||||||
KEY_h | KEY_Left if mods.ctrl => Action::MoveLeft,
|
KEY_h | KEY_Left if mods.ctrl => Action::MoveLeft,
|
||||||
KEY_l | KEY_Right if mods.ctrl => Action::MoveRight,
|
KEY_l | KEY_Right if mods.ctrl => Action::MoveRight,
|
||||||
KEY_j | KEY_Down if mods.ctrl => Action::MoveDown,
|
KEY_j | KEY_Down if mods.ctrl => Action::MoveDown,
|
||||||
@@ -90,6 +91,7 @@ fn action(comp_mod: CompositorMod, keysym: KeysymHandle, mods: ModifiersState) -
|
|||||||
KEY_comma => Action::ConsumeIntoColumn,
|
KEY_comma => Action::ConsumeIntoColumn,
|
||||||
KEY_period => Action::ExpelFromColumn,
|
KEY_period => Action::ExpelFromColumn,
|
||||||
KEY_r => Action::ToggleWidth,
|
KEY_r => Action::ToggleWidth,
|
||||||
|
KEY_f => Action::ToggleFullWidth,
|
||||||
_ => Action::None,
|
_ => Action::None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -230,6 +232,9 @@ impl Niri {
|
|||||||
Action::ToggleWidth => {
|
Action::ToggleWidth => {
|
||||||
self.monitor_set.toggle_width();
|
self.monitor_set.toggle_width();
|
||||||
}
|
}
|
||||||
|
Action::ToggleFullWidth => {
|
||||||
|
self.monitor_set.toggle_full_width();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -759,6 +759,13 @@ impl<W: LayoutElement> MonitorSet<W> {
|
|||||||
};
|
};
|
||||||
monitor.toggle_width();
|
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> {
|
impl MonitorSet<Window> {
|
||||||
@@ -976,6 +983,10 @@ impl<W: LayoutElement> Monitor<W> {
|
|||||||
fn toggle_width(&mut self) {
|
fn toggle_width(&mut self) {
|
||||||
self.active_workspace().toggle_width();
|
self.active_workspace().toggle_width();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn toggle_full_width(&mut self) {
|
||||||
|
self.active_workspace().toggle_full_width();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Monitor<Window> {
|
impl Monitor<Window> {
|
||||||
@@ -1392,6 +1403,14 @@ impl<W: LayoutElement> Workspace<W> {
|
|||||||
|
|
||||||
self.columns[self.active_column_idx].toggle_width(self.view_size);
|
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> {
|
impl Workspace<Window> {
|
||||||
@@ -1555,6 +1574,17 @@ impl<W: LayoutElement> Column<W> {
|
|||||||
let width = ColumnWidth::PresetProportion(idx);
|
let width = ColumnWidth::PresetProportion(idx);
|
||||||
self.set_width(view_size, width);
|
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> {
|
pub fn output_size(output: &Output) -> Size<i32, Logical> {
|
||||||
|
|||||||
Reference in New Issue
Block a user