diff --git a/src/MainWindow.h b/src/MainWindow.h --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -100,6 +100,14 @@ */ void setMenuBarInitialVisibility(bool visible); + + /** + * @brief Set the framless state + * + * @param frameless + */ + void setRemoveWindowTitleBarAndFrame(bool frameless); + Q_SIGNALS: /** diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -758,7 +758,7 @@ void MainWindow::applyKonsoleSettings() { setMenuBarInitialVisibility(KonsoleSettings::showMenuBarByDefault()); - + setRemoveWindowTitleBarAndFrame(KonsoleSettings::removeWindowTitleBarAndFrame()); if (KonsoleSettings::allowMenuAccelerators()) { restoreMenuAccelerators(); } else { @@ -812,6 +812,23 @@ _menuBarInitialVisibility = visible; } +void MainWindow::setRemoveWindowTitleBarAndFrame(bool frameless) +{ + // This is used to check if the window is in "opening" state + // And avoid the visibility change when we change the window flag + bool oldVisibility = isVisible(); + + if(frameless) { + setWindowFlags(Qt::FramelessWindowHint); + } else { + setWindowFlags(Qt::Widget); + } + + if (oldVisibility & !isVisible()) { + setVisible(true); + } +} + void MainWindow::showEvent(QShowEvent *event) { // Make sure the 'initial' visibility is applied only once. diff --git a/src/settings/GeneralSettings.ui b/src/settings/GeneralSettings.ui --- a/src/settings/GeneralSettings.ui +++ b/src/settings/GeneralSettings.ui @@ -112,6 +112,13 @@ + + + + Remove window titlebar and frame + + + diff --git a/src/settings/konsole.kcfg b/src/settings/konsole.kcfg --- a/src/settings/konsole.kcfg +++ b/src/settings/konsole.kcfg @@ -10,6 +10,10 @@ Show menubar by default in each Konsole window true + + + false + Show window title set by escape sequence on the titlebar