From a0917edef0d01656effacd63ced0686280b9d382 Mon Sep 17 00:00:00 2001 From: Dirk Van Haerenborgh Date: Sun, 28 Jan 2024 10:31:19 +0100 Subject: [PATCH] initial support for tabs --- LICENSE | 6 +- README.md | 7 +- data/io.github.vhdirk.Terms.gschema.xml.in | 233 +++++++++--------- data/resources/resources.gresource.xml | 4 +- data/resources/style.css | 4 +- data/resources/ui/help_overlay.ui | 58 ++--- src/application.rs | 91 ++----- src/components/header_bar/header_bar.rs | 64 ++++- src/components/header_bar/header_bar.ui | 126 +++++----- src/components/mod.rs | 8 +- .../preferences_window/preferences_window.rs | 6 + .../preferences_window/preferences_window.ui | 5 + .../process_manager/process_manager.rs | 4 +- .../search_toolbar/search_toolbar.rs | 4 + src/components/session/session.rs | 87 ------- src/components/shortcut_row/shortcut_row.rs | 1 + .../shortcuts_preferences_page.ui | 122 ++++----- src/components/terminal/mod.rs | 11 +- src/components/terminal/terminal.rs | 181 ++++++++++---- src/components/terminal/terminal.ui | 4 +- .../{terminal_frame => terminal_panel}/mod.rs | 14 +- .../terminal_panel.rs} | 37 +-- .../terminal_panel.ui} | 10 +- .../terminal_preferences_page.ui | 2 +- .../{session => terminal_tab}/mod.rs | 18 +- src/components/terminal_tab/terminal_tab.rs | 102 ++++++++ .../terminal_tab.ui} | 2 +- src/components/window/mod.rs | 18 +- src/components/window/window.rs | 87 +++++-- src/components/window/window.ui | 18 +- src/components/zoom_controls/mod.rs | 51 ++++ src/services/sandbox.rs | 6 +- 32 files changed, 825 insertions(+), 566 deletions(-) delete mode 100644 src/components/session/session.rs rename src/components/{terminal_frame => terminal_panel}/mod.rs (63%) rename src/components/{terminal_frame/terminal_frame.rs => terminal_panel/terminal_panel.rs} (67%) rename src/components/{terminal_frame/terminal_frame.ui => terminal_panel/terminal_panel.ui} (53%) rename src/components/{session => terminal_tab}/mod.rs (59%) create mode 100644 src/components/terminal_tab/terminal_tab.rs rename src/components/{session/session.ui => terminal_tab/terminal_tab.ui} (79%) create mode 100644 src/components/zoom_controls/mod.rs diff --git a/LICENSE b/LICENSE index f288702..ca521d3 100644 --- a/LICENSE +++ b/LICENSE @@ -220,7 +220,7 @@ terms of section 4, provided that you also meet all of these conditions: "keep intact all notices". c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This + License to anyone who comes into postab of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no @@ -317,7 +317,7 @@ modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the +part of a transaction in which the right of postab and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied @@ -456,7 +456,7 @@ organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the +give under the previous paragraph, plus a right to postab of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. diff --git a/README.md b/README.md index ae3bdd3..458ecc5 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,8 @@ Terms uses GTK4 and is written in Rust. The latter has no added value aside from ## Status -- [x] Single terminal mode. No tiling, no tabs. +Terms is still very much in development. The following features are present but may still need some work to stabilize. + - [x] Multiple windows - [x] Drag/drop support - [x] href/mailto regex matching @@ -40,10 +41,10 @@ Terms uses GTK4 and is written in Rust. The latter has no added value aside from - [x] Theming. Compatible with Gogh - [x] Flatpak support - [x] Shortcuts -- [ ] Tabs +- [x] Tabs - [ ] Tiling - [ ] Profiles -- [ ] Store and load sessions like Tilix does +- [ ] Store and load session like Tilix and Prompt do - [ ] iTerm2-like support for tmux diff --git a/data/io.github.vhdirk.Terms.gschema.xml.in b/data/io.github.vhdirk.Terms.gschema.xml.in index faf4ea1..fb55a2c 100644 --- a/data/io.github.vhdirk.Terms.gschema.xml.in +++ b/data/io.github.vhdirk.Terms.gschema.xml.in @@ -47,6 +47,7 @@ true Whether or not to show scrollbars + true Whether overlay scrolling should be enabled @@ -101,6 +102,10 @@ true Whether the headerbar should be shown or not + + true + Whether the tab bar should be integrated in the headerbar + true If enabled, the header bar will be colored differently for root and ssh contexts @@ -305,103 +310,103 @@ Reset Zoom The shortcut to reset zoom - + ['<ctrl><shift>o'] - Session Overview - The shortcut to show the session overview + Tab Overview + The shortcut to show the tab overview - + ['<Shift><Control>t'] - New Session - The shortcut to create a new session in the current window + New Tab + The shortcut to create a new tab in the current window - + ['<Shift><Control>w'] - Close Session - Shortcut to close the current session + Close Tab + Shortcut to close the current tab - + [] - Close Other Sessions - Shortcut to close all session in the window but the current one + Close Other Tabs + Shortcut to close all tab in the window but the current one - + ['<Shift><Control>r'] - Rename Session - Shortcut to rename the current session + Rename Tab + Shortcut to rename the current tab - + ['<Control>Tab'] - WinFocusNextSession + WinFocusNextTab - + ['<Shift><Control>Tab'] - WinFocusPreviousSession + WinFocusPreviousTab - + ['<Alt>1'] - Focus Session 1 - Shortcut to focus session 1 + Focus Tab 1 + Shortcut to focus tab 1 - + ['<Alt>2'] - Focus Session 2 - Shortcut to focus session 2 + Focus Tab 2 + Shortcut to focus tab 2 - + ['<Alt>3'] - Focus Session 3 - Shortcut to focus session 3 + Focus Tab 3 + Shortcut to focus tab 3 - + ['<Alt>4'] - Focus Session 4 - Shortcut to focus session 4 + Focus Tab 4 + Shortcut to focus tab 4 - + ['<Alt>5'] - Focus Session 5 - Shortcut to focus session 5 + Focus Tab 5 + Shortcut to focus tab 5 - + ['<Alt>6'] - Focus Session 6 - Shortcut to focus session 6 + Focus Tab 6 + Shortcut to focus tab 6 - + ['<Alt>7'] - Focus Session 7 - Shortcut to focus session 7 + Focus Tab 7 + Shortcut to focus tab 7 - + ['<Alt>8'] - Focus Session 8 - Shortcut to focus session 8 + Focus Tab 8 + Shortcut to focus tab 8 - + ['<Alt>9'] - Focus Session 9 - Shortcut to focus session 9 + Focus Tab 9 + Shortcut to focus tab 9 - + [] - Focus First Session - Shortcut to focus the first session + Focus First Tab + Shortcut to focus the first tab - + ['<Alt>0'] - Focus Last Session - Shortcut to focus the last session + Focus Last Tab + Shortcut to focus the last tab - + ['<ctrl><shift>Page_Up'] - Move Session Left - Shortcut to move the current session to the left one position + Move Tab Left + Shortcut to move the current tab to the left one position - + ['<ctrl><shift>Page_Down'] - Move Session Right - Shortcut to move the current session to the right one position + Move Tab Right + Shortcut to move the current tab to the right one position ['<Shift><Control>f'] @@ -418,27 +423,27 @@ Select None Shortcut to clear the terminal selection - + [] - Keyboard shortcut to synchronize input for the session + Keyboard shortcut to synchronize input for the tab - + ['<ctrl><shift><alt>t'] - Undo Close Session - Undo closing of last session + Undo Close Tab + Undo closing of last tab - + [] Move Tab to New Window Shortcut to move the current tab into a new window - + ['<Shift><Ctrl>o'] - Keyboard shortcut to open a previously saved session + Keyboard shortcut to open a previously saved tab - + ['<Shift><Ctrl>s'] - Keyboard shortcut to save the current session + Keyboard shortcut to save the current tab ['<shift>F10'] @@ -447,129 +452,129 @@
- new-session - New _Session - win.new-session - ('default','') - + new-tab + New _Tab + win.new-tab + action-disabled new-window New _Window app.new-window - ('default','') - + action-disabled
@@ -66,69 +64,81 @@ True 250 + + vertical + 0 + center + + + true + + + + + + true + Terms + - - true - + - - - Terms - - - - - - Menu - open-menu-symbolic - - - - main-menu - - - + + + Menu + open-menu-symbolic + + + + main-menu + + + + + - + + + + + + + + - - - - + - diff --git a/src/components/mod.rs b/src/components/mod.rs index 488b50f..bae5208 100644 --- a/src/components/mod.rs +++ b/src/components/mod.rs @@ -2,14 +2,14 @@ mod header_bar; mod preferences_window; mod process_manager; mod search_toolbar; -mod session; mod shortcut_dialog; mod shortcut_row; mod shortcuts_preferences_page; mod style_switcher; mod terminal; -mod terminal_frame; +mod terminal_panel; mod terminal_preferences_page; +mod terminal_tab; mod theme_thumbnail; mod window; @@ -17,13 +17,13 @@ pub use header_bar::*; pub use preferences_window::*; pub use process_manager::*; pub use search_toolbar::*; -pub use session::*; pub use shortcut_dialog::*; pub use shortcut_row::*; pub use shortcuts_preferences_page::*; pub use style_switcher::*; pub use terminal::*; -pub use terminal_frame::*; +pub use terminal_panel::*; pub use terminal_preferences_page::*; +pub use terminal_tab::*; pub use theme_thumbnail::*; pub use window::*; diff --git a/src/components/preferences_window/preferences_window.rs b/src/components/preferences_window/preferences_window.rs index ac1c20f..a18b8ce 100644 --- a/src/components/preferences_window/preferences_window.rs +++ b/src/components/preferences_window/preferences_window.rs @@ -19,6 +19,9 @@ pub struct PreferencesWindow { #[template_child] pub show_headerbar_switch: TemplateChild, + #[template_child] + pub headerbar_integrated_tabbar_switch: TemplateChild, + #[template_child] pub show_menu_button_switch: TemplateChild, @@ -87,6 +90,9 @@ impl PreferencesWindow { self.settings.bind_show_menu_button(&*self.show_menu_button_switch, "active").build(); self.settings.bind_show_headerbar(&*self.show_headerbar_switch, "active").build(); + self.settings + .bind_headerbar_integrated_tabbar(&*self.headerbar_integrated_tabbar_switch, "active") + .build(); self.settings.bind_floating_controls(&*self.floating_controls_switch, "active").build(); self.settings diff --git a/src/components/preferences_window/preferences_window.ui b/src/components/preferences_window/preferences_window.ui index 1141a20..6e1e5cd 100644 --- a/src/components/preferences_window/preferences_window.ui +++ b/src/components/preferences_window/preferences_window.ui @@ -45,6 +45,11 @@ Show Header Bar + + + Integrate tab bar in header bar + + // // // // // // // // // -// // // -// // // -// // // +// // // // // // // // // // // // diff --git a/src/components/terminal_frame/terminal_frame.ui b/src/components/terminal_panel/terminal_panel.ui similarity index 53% rename from src/components/terminal_frame/terminal_frame.ui rename to src/components/terminal_panel/terminal_panel.ui index 3a0b7fc..bfc77dc 100644 --- a/src/components/terminal_frame/terminal_frame.ui +++ b/src/components/terminal_panel/terminal_panel.ui @@ -2,16 +2,18 @@ -