Add F11 support

This commit is contained in:
liberodark 2025-06-19 06:38:57 +02:00 committed by Jeremy Soller
parent cf9c0c51ae
commit a90e55f1f0
2 changed files with 9 additions and 0 deletions

View file

@ -34,6 +34,7 @@ pub fn key_binds() -> HashMap<KeyBind, Action> {
bind!([Shift], Key::Named(Named::Insert), PastePrimary);
bind!([Ctrl, Shift], Key::Character("W".into()), TabClose);
bind!([Ctrl], Key::Character(",".into()), Settings);
bind!([], Key::Named(Named::F11), ToggleFullscreen);
// Ctrl+Alt+D splits horizontally, Ctrl+Alt+R splits vertically, Ctrl+Shift+X maximizes split
//TODO: Adjust bindings as desired by UX

View file

@ -258,6 +258,7 @@ pub enum Action {
TabNewNoProfile,
TabNext,
TabPrev,
ToggleFullscreen,
WindowClose,
WindowNew,
ZoomIn,
@ -305,6 +306,7 @@ impl Action {
Self::TabNewNoProfile => Message::TabNewNoProfile,
Self::TabNext => Message::TabNext,
Self::TabPrev => Message::TabPrev,
Self::ToggleFullscreen => Message::ToggleFullscreen,
Self::WindowClose => Message::WindowClose,
Self::WindowNew => Message::WindowNew,
Self::ZoomIn => Message::ZoomIn,
@ -398,6 +400,7 @@ pub enum Message {
TabPrev,
TermEvent(pane_grid::Pane, segmented_button::Entity, TermEvent),
TermEventTx(mpsc::UnboundedSender<(pane_grid::Pane, segmented_button::Entity, TermEvent)>),
ToggleFullscreen,
ToggleContextPage(ContextPage),
UpdateDefaultProfile((bool, ProfileId)),
UseBrightBold(bool),
@ -1892,6 +1895,11 @@ impl Application for App {
}
return self.update_focus();
}
Message::ToggleFullscreen => {
if let Some(window_id) = self.core.main_window_id() {
return cosmic::command::toggle_maximize(window_id);
}
}
Message::CopyPrimary(entity_opt) => {
if let Some(tab_model) = self.pane_model.active() {
let entity = entity_opt.unwrap_or_else(|| tab_model.active());