Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added rounded corners to group bar #6839

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/config/ConfigManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ CConfigManager::CConfigManager() {
m_pConfig->addConfigValue("group:groupbar:enabled", Hyprlang::INT{1});
m_pConfig->addConfigValue("group:groupbar:font_family", {STRVAL_EMPTY});
m_pConfig->addConfigValue("group:groupbar:font_size", Hyprlang::INT{8});
m_pConfig->addConfigValue("group:groupbar:group_rounding", Hyprlang::INT{0});
Swefton marked this conversation as resolved.
Show resolved Hide resolved
m_pConfig->addConfigValue("group:groupbar:gradients", Hyprlang::INT{1});
m_pConfig->addConfigValue("group:groupbar:height", Hyprlang::INT{14});
m_pConfig->addConfigValue("group:groupbar:priority", Hyprlang::INT{3});
Expand Down
9 changes: 6 additions & 3 deletions src/render/decorations/CHyprGroupBarDecoration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ void CHyprGroupBarDecoration::draw(CMonitor* pMonitor, float a) {

static auto PENABLED = CConfigValue<Hyprlang::INT>("group:groupbar:enabled");
static auto PRENDERTITLES = CConfigValue<Hyprlang::INT>("group:groupbar:render_titles");
static auto PGROUPROUNDING = CConfigValue<Hyprlang::INT>("group:groupbar:group_rounding");
static auto PTITLEFONTSIZE = CConfigValue<Hyprlang::INT>("group:groupbar:font_size");
static auto PHEIGHT = CConfigValue<Hyprlang::INT>("group:groupbar:height");
static auto PGRADIENTS = CConfigValue<Hyprlang::INT>("group:groupbar:gradients");
Expand Down Expand Up @@ -149,18 +150,20 @@ void CHyprGroupBarDecoration::draw(CMonitor* pMonitor, float a) {

CColor color = m_dwGroupMembers[WINDOWINDEX].lock() == g_pCompositor->m_pLastWindow.lock() ? PCOLACTIVE->m_vColors[0] : PCOLINACTIVE->m_vColors[0];
color.a *= a;
g_pHyprOpenGL->renderRect(&rect, color);

rect = {ASSIGNEDBOX.x + floor(xoff) - pMonitor->vecPosition.x + m_pWindow->m_vFloatingOffset.x,
ASSIGNEDBOX.y + ASSIGNEDBOX.h - floor(yoff) - ONEBARHEIGHT - pMonitor->vecPosition.y + m_pWindow->m_vFloatingOffset.y, m_fBarWidth,
(*PGRADIENTS || *PRENDERTITLES ? *PHEIGHT : 0)};

g_pHyprOpenGL->renderRect(&rect, color, *PGROUPROUNDING);
Swefton marked this conversation as resolved.
Show resolved Hide resolved

rect.scale(pMonitor->scale);

if (*PGRADIENTS) {
const auto GRADIENTTEX = (m_dwGroupMembers[WINDOWINDEX] == g_pCompositor->m_pLastWindow ? (GROUPLOCKED ? m_tGradientLockedActive : m_tGradientActive) :
(GROUPLOCKED ? m_tGradientLockedInactive : m_tGradientInactive));
if (GRADIENTTEX->m_iTexID != 0)
g_pHyprOpenGL->renderTexture(GRADIENTTEX, &rect, 1.0);
g_pHyprOpenGL->renderTexture(GRADIENTTEX, &rect, 1.0, *PGROUPROUNDING);
}

if (*PRENDERTITLES) {
Expand All @@ -178,7 +181,7 @@ void CHyprGroupBarDecoration::draw(CMonitor* pMonitor, float a) {
rect.x += (m_fBarWidth * pMonitor->scale) / 2.0 - (pTitleTex->textWidth / 2.0);
rect.round();

g_pHyprOpenGL->renderTexture(pTitleTex->tex, &rect, 1.f);
g_pHyprOpenGL->renderTexture(pTitleTex->tex, &rect, 1.f, *PGROUPROUNDING);
Swefton marked this conversation as resolved.
Show resolved Hide resolved
}

if (*PSTACKED)
Expand Down