From f9eb012f770dab7f478283f09adad752732d00c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Lucas=20Golini?= Date: Sun, 28 Dec 2025 14:02:07 -0300 Subject: [PATCH] Added an option to open new terminals in status bar panel. --- src/tools/ecode/appconfig.hpp | 6 +++++- src/tools/ecode/settingsmenu.cpp | 27 +++++++++++++++------------ src/tools/ecode/terminalmanager.cpp | 13 +++++++++---- 3 files changed, 29 insertions(+), 17 deletions(-) diff --git a/src/tools/ecode/appconfig.hpp b/src/tools/ecode/appconfig.hpp index 3ec62a38c..1f7a20d1a 100644 --- a/src/tools/ecode/appconfig.hpp +++ b/src/tools/ecode/appconfig.hpp @@ -152,13 +152,15 @@ struct ProjectBuildConfiguration { class NewTerminalOrientation { public: - enum Orientation { Same, Vertical, Horizontal }; + enum Orientation { Same, Vertical, Horizontal, StatusBarPanel }; static NewTerminalOrientation::Orientation fromString( const std::string& orientation ) { if ( "same" == orientation ) return Orientation::Same; if ( "horizontal" == orientation ) return Orientation::Horizontal; + if ( "statusbar_panel" == orientation ) + return Orientation::StatusBarPanel; return Orientation::Vertical; } @@ -168,6 +170,8 @@ class NewTerminalOrientation { return "vertical"; case Orientation::Horizontal: return "horizontal"; + case Orientation::StatusBarPanel: + return "statusbar_panel"; case Orientation::Same: default: return "same"; diff --git a/src/tools/ecode/settingsmenu.cpp b/src/tools/ecode/settingsmenu.cpp index da5a6677e..bc3a7b9b3 100644 --- a/src/tools/ecode/settingsmenu.cpp +++ b/src/tools/ecode/settingsmenu.cpp @@ -47,8 +47,8 @@ void SettingsMenu::createSettingsMenu( App* app, UIMenuBar* menuBar ) { getKeybind( "open-file" ) ) ->setId( "open-file" ); mSettingsMenu - ->add( i18n( "open_folder_ellipsis", "Open Folder..." ), - findIcon( "document-open" ), getKeybind( "open-folder" ) ) + ->add( i18n( "open_folder_ellipsis", "Open Folder..." ), findIcon( "document-open" ), + getKeybind( "open-folder" ) ) ->setId( "open-folder" ); mSettingsMenu ->add( i18n( "open_file_from_web_ellipsis", "Open File from Web..." ), @@ -985,25 +985,33 @@ UIMenu* SettingsMenu::createTerminalMenu() { #endif UIPopUpMenu* newTerminalBehaviorSubMenu = UIPopUpMenu::New(); - auto currentOrientation = - NewTerminalOrientation::toString( mApp->getConfig().term.newTerminalOrientation ); + auto currentOrientation = mApp->getConfig().term.newTerminalOrientation; newTerminalBehaviorSubMenu ->addRadioButton( i18n( "open_in_same_tabbar", "Open In Current Tab Bar" ) ) - ->setActive( currentOrientation == "same" ) + ->setActive( currentOrientation == NewTerminalOrientation::Same ) ->setId( "same" ); newTerminalBehaviorSubMenu ->addRadioButton( i18n( "open_in_vertical_split", "Open In New Vertical Split" ) ) - ->setActive( currentOrientation == "vertical" ) + ->setActive( currentOrientation == NewTerminalOrientation::Vertical ) ->setId( "vertical" ); newTerminalBehaviorSubMenu ->addRadioButton( i18n( "open_in_horizontal_split", "Open In New Horizontal Split" ) ) - ->setActive( currentOrientation == "horizontal" ) + ->setActive( currentOrientation == NewTerminalOrientation::Horizontal ) ->setId( "horizontal" ); + newTerminalBehaviorSubMenu + ->addRadioButton( i18n( "open_in_statusbar_panel", "Open In Status Bar Panel" ) ) + ->setActive( currentOrientation == NewTerminalOrientation::StatusBarPanel ) + ->setId( "statusbar_panel" ); mTerminalMenu->addSubMenu( i18n( "new_terminal_behavior", "New Terminal Behavior" ), findIcon( "terminal" ), newTerminalBehaviorSubMenu ); + newTerminalBehaviorSubMenu->on( Event::OnItemClicked, [this]( const Event* event ) { + const std::string& id( event->getNode()->getId() ); + mApp->getConfig().term.newTerminalOrientation = NewTerminalOrientation::fromString( id ); + } ); + UIPopUpMenu* cursorStyleMenu = UIPopUpMenu::New(); mTerminalMenu->addSubMenu( i18n( "cursor_style", "Cursor Style" ), findIcon( "terminal" ), @@ -1158,11 +1166,6 @@ UIMenu* SettingsMenu::createTerminalMenu() { findIcon( "terminal" ), getKeybind( "configure-terminal-scrollback" ) ) ->setId( "configure-terminal-scrollback" ); - newTerminalBehaviorSubMenu->on( Event::OnItemClicked, [this]( const Event* event ) { - const std::string& id( event->getNode()->getId() ); - mApp->getConfig().term.newTerminalOrientation = NewTerminalOrientation::fromString( id ); - } ); - mTerminalMenu->on( Event::OnItemClicked, [this]( const Event* event ) { const std::string& id( event->getNode()->getId() ); if ( "close-terminal-tab-on-exit" == id ) { diff --git a/src/tools/ecode/terminalmanager.cpp b/src/tools/ecode/terminalmanager.cpp index 199a2211c..70858425d 100644 --- a/src/tools/ecode/terminalmanager.cpp +++ b/src/tools/ecode/terminalmanager.cpp @@ -25,7 +25,11 @@ UITerminal* TerminalManager::createTerminalInSplitter( UITerminal* term = nullptr; auto splitter = mApp->getSplitter(); auto& config = mApp->getConfig(); - if ( splitter && splitter->hasSplit() ) { + + if ( config.term.newTerminalOrientation == NewTerminalOrientation::StatusBarPanel ) { + mApp->getStatusTerminalController()->show(); + mApp->getStatusTerminalController()->createTerminal(); + } else if ( splitter && splitter->hasSplit() ) { if ( splitter->getTabWidgets().size() == 2 ) { UIOrientation orientation = splitter->getMainSplitOrientation(); if ( config.term.newTerminalOrientation == NewTerminalOrientation::Vertical && @@ -63,6 +67,8 @@ UITerminal* TerminalManager::createTerminalInSplitter( createNewTerminal( "", nullptr, "", program, args, env, fallback, keepAlive ); break; } + case NewTerminalOrientation::StatusBarPanel: + break; } } return term; @@ -598,9 +604,8 @@ UITerminal* TerminalManager::createNewTerminal( ? it->first : mTerminalColorSchemes.begin()->first ); } ); - term->setCommand( UITerminal::getExclusiveModeToggleCommandName(), [term] { - term->setExclusiveMode( !term->getExclusiveMode() ); - } ); + term->setCommand( UITerminal::getExclusiveModeToggleCommandName(), + [term] { term->setExclusiveMode( !term->getExclusiveMode() ); } ); term->setCommand( "move-tab-to-start", [this] { auto widget = mApp->getSplitter()->getCurWidget(); if ( widget == nullptr || widget->getData() == 0 )