diff --git a/Cargo.lock b/Cargo.lock index 73b94e6f..86e121e6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -943,7 +943,7 @@ dependencies = [ [[package]] name = "cosmic-settings-config" version = "0.1.0" -source = "git+https://github.com/pop-os/cosmic-settings-daemon#243c36e9e66dcbec83fa63cb3adaceb3bea166a4" +source = "git+https://github.com/pop-os/cosmic-settings-daemon#54b4418e1e7757d965166ae9dc00c522aebf4451" dependencies = [ "cosmic-config", "ron", diff --git a/data/keybindings.ron b/data/keybindings.ron index b6705285..953db443 100644 --- a/data/keybindings.ron +++ b/data/keybindings.ron @@ -86,6 +86,7 @@ (modifiers: [Super], key: "x"): SwapWindow, (modifiers: [Super], key: "m"): Maximize, + (modifiers: [Super], key: "F11"): Fullscreen, (modifiers: [Super], key: "r"): Resizing(Outwards), (modifiers: [Super, Shift], key: "r"): Resizing(Inwards), diff --git a/src/input/actions.rs b/src/input/actions.rs index e83d83d8..65e4f1df 100644 --- a/src/input/actions.rs +++ b/src/input/actions.rs @@ -868,6 +868,33 @@ impl State { } } + Action::Fullscreen => { + let Some(focused_output) = seat.focused_output() else { + return; + }; + let mut shell = self.common.shell.write(); + let workspace = shell.active_space(&focused_output).unwrap(); + let focus_stack = workspace.focus_stack.get(seat); + let focused_window = focus_stack.last().cloned(); + match focused_window { + Some(FocusTarget::Window(window)) => { + let output = workspace.output.clone(); + if let Some(target) = shell.fullscreen_request( + &window.active_window(), + output, + &self.common.event_loop_handle, + ) { + std::mem::drop(shell); + Shell::set_focus(self, Some(&target), seat, Some(serial), true); + } + } + Some(FocusTarget::Fullscreen(surface)) => { + shell.unfullscreen_request(&surface, &self.common.event_loop_handle); + } + _ => {} + } + } + Action::Resizing(direction) => self.common.shell.write().set_resize_mode( Some((pattern, direction)), &self.common.config, diff --git a/src/shell/grabs/menu/default.rs b/src/shell/grabs/menu/default.rs index 94c8c4da..f623dbfb 100644 --- a/src/shell/grabs/menu/default.rs +++ b/src/shell/grabs/menu/default.rs @@ -233,6 +233,7 @@ pub fn window_items( ) -> impl Iterator { let minimize_clone = window.clone(); let maximize_clone = window.clone(); + let fullscreen_clone = window.clone(); let tile_clone = window.clone(); let move_prev_clone = window.clone(); let move_next_clone = window.clone(); @@ -290,6 +291,26 @@ pub fn window_items( .shortcut(config.shortcut_for_action(&Action::Maximize)) .toggled(window.is_maximized(false)), ), + Some( + Item::new(fl!("window-menu-fullscreen"), move |handle| { + let mapped = fullscreen_clone.clone(); + let _ = handle.insert_idle(move |state| { + let mut shell = state.common.shell.write(); + let seat = shell.seats.last_active().clone(); + let output = seat.active_output(); + if let Some(target) = shell.fullscreen_request( + &mapped.active_window(), + output, + &state.common.event_loop_handle, + ) { + std::mem::drop(shell); + Shell::set_focus(state, Some(&target), &seat, None, false); + } + }); + }) + .shortcut(config.shortcut_for_action(&Action::Fullscreen)) + .toggled(false), + ), (tiling_enabled && !is_sticky).then_some( Item::new(fl!("window-menu-tiled"), move |handle| { let tile_clone = tile_clone.clone();