diff --git a/src/ColorScheme.h b/src/ColorScheme.h --- a/src/ColorScheme.h +++ b/src/ColorScheme.h @@ -153,6 +153,17 @@ */ qreal opacity() const; + /** + * Enables blur behind the transparent window + * + * Defaults to false. + */ + void setBlur(bool blur); + /** + * Returns whether blur is enabled for this color scheme, see setBlur() + */ + bool blur() const; + void setWallpaper(const QString &path); ColorSchemeWallpaper::Ptr wallpaper() const; @@ -222,6 +233,9 @@ qreal _opacity; + // enables blur behind the terimnal window + bool _blur; + ColorSchemeWallpaper::Ptr _wallpaper; static const quint16 MAX_HUE = 340; diff --git a/src/ColorScheme.cpp b/src/ColorScheme.cpp --- a/src/ColorScheme.cpp +++ b/src/ColorScheme.cpp @@ -164,6 +164,7 @@ _table(nullptr), _randomTable(nullptr), _opacity(1.0), + _blur(false), _wallpaper(nullptr) { setWallpaper(QString()); @@ -175,6 +176,7 @@ _table(nullptr), _randomTable(nullptr), _opacity(other._opacity), + _blur(other._blur), _wallpaper(other._wallpaper) { setName(other.name()); @@ -358,14 +360,25 @@ return _opacity; } +void ColorScheme::setBlur(bool blur) +{ + _blur = blur; +} + +bool ColorScheme::blur() const +{ + return _blur; +} + void ColorScheme::read(const KConfig &config) { KConfigGroup configGroup = config.group("General"); const QString schemeDescription = configGroup.readEntry("Description", i18nc("@item", "Un-named Color Scheme")); _description = i18n(schemeDescription.toUtf8().constData()); _opacity = configGroup.readEntry("Opacity", 1.0); + _blur = configGroup.readEntry("Blur", false); setWallpaper(configGroup.readEntry("Wallpaper", QString())); for (int i = 0; i < TABLE_COLORS; i++) { @@ -402,6 +415,7 @@ configGroup.writeEntry("Description", _description); configGroup.writeEntry("Opacity", _opacity); + configGroup.writeEntry("Blur", _blur); configGroup.writeEntry("Wallpaper", _wallpaper->path()); for (int i = 0; i < TABLE_COLORS; i++) { diff --git a/src/ColorSchemeEditor.h b/src/ColorSchemeEditor.h --- a/src/ColorSchemeEditor.h +++ b/src/ColorSchemeEditor.h @@ -77,6 +77,7 @@ private Q_SLOTS: void setTransparencyPercentLabel(int percent); + void setBlur(bool blur); void setRandomizedBackgroundColor(bool randomized); void editColorItem(QTableWidgetItem *item); void wallpaperPathChanged(const QString &path); diff --git a/src/ColorSchemeEditor.cpp b/src/ColorSchemeEditor.cpp --- a/src/ColorSchemeEditor.cpp +++ b/src/ColorSchemeEditor.cpp @@ -93,6 +93,10 @@ connect(_ui->transparencySlider, &QSlider::valueChanged, this, &Konsole::ColorSchemeEditor::setTransparencyPercentLabel); + // blur behind window + connect(_ui->blurCheckBox, &QCheckBox::toggled, this, + &Konsole::ColorSchemeEditor::setBlur); + // randomized background connect(_ui->randomizedBackgroundCheck, &QCheckBox::toggled, this, &Konsole::ColorSchemeEditor::setRandomizedBackgroundColor); @@ -248,6 +252,11 @@ _colors->setOpacity(opacity); } +void ColorSchemeEditor::setBlur(bool blur) +{ + _colors->setBlur(blur); +} + void ColorSchemeEditor::setRandomizedBackgroundColor(bool randomized) { _colors->setRandomizedBackgroundColor(randomized); @@ -279,6 +288,9 @@ _ui->transparencySlider->setValue(transparencyPercent); setTransparencyPercentLabel(transparencyPercent); + // blur behind window checkbox + _ui->blurCheckBox->setChecked(scheme->blur()); + // randomized background color checkbox _ui->randomizedBackgroundCheck->setChecked(scheme->randomizedBackgroundColor()); diff --git a/src/ColorSchemeEditor.ui b/src/ColorSchemeEditor.ui --- a/src/ColorSchemeEditor.ui +++ b/src/ColorSchemeEditor.ui @@ -41,6 +41,13 @@ + + + + Blur background + + + diff --git a/src/MainWindow.h b/src/MainWindow.h --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -158,6 +158,7 @@ void profileListChanged(const QList &sessionActions); void configureNotifications(); + void setBlur(bool blur); void updateWindowIcon(); void updateWindowCaption(); diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include #include @@ -98,6 +99,8 @@ &Konsole::MainWindow::disconnectController); connect(_viewManager, &Konsole::ViewManager::viewPropertiesChanged, bookmarkHandler(), &Konsole::BookmarkHandler::setViews); + connect(_viewManager, &Konsole::ViewManager::blurSettingChanged, + this, &Konsole::MainWindow::setBlur); connect(_viewManager, &Konsole::ViewManager::updateWindowIcon, this, &Konsole::MainWindow::updateWindowIcon); @@ -876,6 +879,11 @@ KNotifyConfigWidget::configure(this); } +void MainWindow::setBlur(bool blur) +{ + KWindowEffects::enableBlurBehind(winId(), blur); +} + void MainWindow::setMenuBarInitialVisibility(bool visible) { _menuBarInitialVisibility = visible; diff --git a/src/ViewManager.h b/src/ViewManager.h --- a/src/ViewManager.h +++ b/src/ViewManager.h @@ -222,6 +222,8 @@ void setMenuBarVisibleRequest(bool); void updateWindowIcon(); + void blurSettingChanged(bool); + /** Requests creation of a new view with the default profile. */ void newViewRequest(); /** Requests creation of a new view, with the selected profile. */ diff --git a/src/ViewManager.cpp b/src/ViewManager.cpp --- a/src/ViewManager.cpp +++ b/src/ViewManager.cpp @@ -874,6 +874,8 @@ view->setOpacity(colorScheme->opacity()); view->setWallpaper(colorScheme->wallpaper()); + emit blurSettingChanged(colorScheme->blur()); + // load font view->setAntialias(profile->antiAliasFonts()); view->setBoldIntense(profile->boldIntense());