This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Better highlight for active TerminalHeaderbar when using spl

Tags: None
(comma "," separated)
q4ux
Registered Member
Posts
4
Karma
0
The colors used for drawing active and inactive TerminalHeaderbars for splits in Konsole are - at least for me - very hard to distinguish.

Here's a screenshot using the Oxygen Cold default color scheme that comes with Plasma 5.27 on Konsole 22.12.3 where the bottom right split is active.

Image

What I'd like to accomplish is something like this where the top right split is active.

Image

Achieving this via changing the source change is quite simple:

Code: Select all
diff --git a/src/widgets/TerminalHeaderBar.cpp b/src/widgets/TerminalHeaderBar.cpp
index bb0ee1870..21ab34d5c 100644
--- a/src/widgets/TerminalHeaderBar.cpp
+++ b/src/widgets/TerminalHeaderBar.cpp
@@ -221,6 +221,15 @@ void TerminalHeaderBar::paintEvent(QPaintEvent *paintEvent)
         painter.setPen(Qt::NoPen);
         painter.setBrush(shadowColor);
         painter.drawRect(rect());
+    } else {
+        auto p = qApp->palette();
+        auto highlightColor = p.color(QPalette::ColorRole::Highlight);
+        highlightColor.setAlphaF(qreal(0.8) * highlightColor.alphaF());
+
+        QPainter painter(this);
+        painter.setPen(Qt::NoPen);
+        painter.setBrush(highlightColor);
+        painter.drawRect(rect());
     }
 }


While looking through Konsole's settings searching for a way to change the default highlight style I've seen that there's a way to specify a user-defined stylesheet in Konsole's "Tab Bar / Splitters" settings dialog. However knowing nothing about how styling works in QT applications I couldn't figure out whether there's a way to achieve a result similar to the one above via CSS.

Does anyone know whether this is possible?
dzon
Registered Member
Posts
493
Karma
3
I don't use the terminal titlebars myself but I haven't found a way yet to change it with css. I think the css only applies to the tabs/tabbar/qwidget. You'll find plenty on changing that. But as far as the terminal titlebars....zero. Konsole uses some kind of dimming for inactive. And as for changing colors of active/inactive backgrounds...nothing.
Screenshot shows regular, active and hovered tabs. https://imgur.com/a/UuK9vPQ

Now, that lame custom highlight color scheme thing should allow to use the same titlebar and toolbar colors. So, in theory setting the active titlebar color in some color scheme should also apply to the active toolbar. Whenever I tried it, I never got it to work. You might have more luck and I don't use breeze application style anyway.


This realm's name is Maya. And she speaks Hertz. But Ahamkara makes a fuzz about it.
q4ux
Registered Member
Posts
4
Karma
0
Thank you for your response and explanation.

In the meantime I filed a wishlist bug about this issue on bugs.kde.org and included a slightly extended version of the patch above which allows using either the currently selected highlight color to highlight the active header bar or the current way of dimming the header bars of inactive splits via a configuration option: https://bugs.kde.org/show_bug.cgi?id=468497


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], kesang, Yahoo [Bot]