Feat: (Linux) Themes allow transparency on chat windows background (#6137)

This commit is contained in:
apa420
2025-04-13 10:34:25 +00:00
committed by GitHub
parent e1863d64ee
commit 3ba25dd33d
4 changed files with 33 additions and 8 deletions
+1
View File
@@ -6,6 +6,7 @@
- Minor: Add an option for the reduced opacity of message history. (#6121)
- Minor: Make paused chat indicator more visible, and fix its zoom behavior. (#6123)
- Minor: Added WebSocket API for plugins. (#6076)
- Minor: Allow for themes to set transparent values for window background on Linux. (#6137)
- Minor: Popup overlay now only draws an outline when being interacted with. (#6140)
- Bugfix: Don't create native messaging manifest file if browser directory doesn't exist. (#6116)
- Bugfix: Fixed scrolling now working on inputs in the settings. (#6128)
+6
View File
@@ -75,6 +75,12 @@ Window::Window(WindowType type, QWidget *parent)
if (type == WindowType::Main)
{
this->resize(int(600 * this->scale()), int(500 * this->scale()));
#ifdef Q_OS_LINUX
if (this->theme->window.background.alpha() != 255)
{
this->setAttribute(Qt::WA_TranslucentBackground);
}
#endif
}
else
{
+25 -8
View File
@@ -22,6 +22,7 @@
#include <QJsonObject>
#include <QMimeData>
#include <QPainter>
#include <QPainterPath>
#include <algorithm>
@@ -613,6 +614,29 @@ void SplitContainer::mouseReleaseEvent(QMouseEvent *event)
}
}
void SplitContainer::paintSplitBorder(Node *node, QPainter *painter)
{
switch (node->type_)
{
case Node::Type::Split: {
QRectF nodeRect = node->geometry_;
painter->setPen(this->theme->tabs.dividerLine);
QPainterPath p = QPainterPath();
p.addRect(nodeRect);
painter->strokePath(p, painter->pen());
}
break;
case Node::Type::VerticalContainer:
case Node::Type::HorizontalContainer: {
for (std::unique_ptr<Node> &child : node->children_)
{
paintSplitBorder(child.get(), painter);
}
}
break;
}
}
void SplitContainer::paintEvent(QPaintEvent * /*event*/)
{
QPainter painter(this);
@@ -643,14 +667,7 @@ void SplitContainer::paintEvent(QPaintEvent * /*event*/)
}
else
{
if (getApp()->getThemes()->isLightTheme())
{
painter.fillRect(rect(), QColor("#999"));
}
else
{
painter.fillRect(rect(), QColor("#555"));
}
this->paintSplitBorder(this->getBaseNode(), &painter);
}
for (DropRect &dropRect : this->dropRects_)
+1
View File
@@ -246,6 +246,7 @@ private:
void selectSplitRecursive(Node *node, SplitDirection direction);
void focusSplitRecursive(Node *node);
void setPreferedTargetRecursive(Node *node);
void paintSplitBorder(Node *node, QPainter *painter);
void addSplit(Split *split);