-
-
Notifications
You must be signed in to change notification settings - Fork 961
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -100,7 +100,8 @@ 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 PROUNDING = CConfigValue<Hyprlang::INT>("group:groupbar:rounding"); | ||
static auto PBOTTOMBAR = CConfigValue<Hyprlang::INT>("group:groupbar:bottom_bar"); | ||
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"); | ||
|
@@ -126,9 +127,9 @@ void CHyprGroupBarDecoration::draw(CMonitor* pMonitor, float a) { | |
for (int i = 0; i < barsToDraw; ++i) { | ||
const auto WINDOWINDEX = *PSTACKED ? m_dwGroupMembers.size() - i - 1 : i; | ||
|
||
CBox rect = {ASSIGNEDBOX.x + floor(xoff) - pMonitor->vecPosition.x + m_pWindow->m_vFloatingOffset.x, | ||
CBox rect = {ASSIGNEDBOX.x + floor(xoff) - pMonitor->vecPosition.x + m_pWindow->m_vFloatingOffset.x + *PROUNDING, | ||
ASSIGNEDBOX.y + ASSIGNEDBOX.h - floor(yoff) - BAR_INDICATOR_HEIGHT - BAR_PADDING_OUTER_VERT - pMonitor->vecPosition.y + m_pWindow->m_vFloatingOffset.y, | ||
m_fBarWidth, BAR_INDICATOR_HEIGHT}; | ||
m_fBarWidth - (*PROUNDING * 2), BAR_INDICATOR_HEIGHT}; | ||
|
||
if (rect.width <= 0 || rect.height <= 0) | ||
break; | ||
|
@@ -151,19 +152,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; | ||
|
||
if (*PBOTTOMBAR) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the thin bottom bar looks bad with rounding, I added an option to disable the thin bottom bar, rounding the thin bar is tricky because the height is very small and sometimes opengl throws an error for rendering a negative height. A problem that arises because of this is that the gap between the main group bar and the window is kinda awkward without the thin bar, I want the extra space to be taken up by the application open and am open to suggestions on how to implement this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. like I said before rounding has to be less or equal to max(width/2, height/2) to remove the space from the indicator set I am not sure there is a point to the thin bar anymore maybe it can be removed altogether, but ask vaxry |
||
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); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Found out its cleaner to leave this where it originally was, the first |
||
|
||
|
||
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, *PGROUPROUNDING); | ||
g_pHyprOpenGL->renderTexture(GRADIENTTEX, &rect, 1.0, *PROUNDING); | ||
} | ||
|
||
if (*PRENDERTITLES) { | ||
|
@@ -181,7 +183,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, *PGROUPROUNDING); | ||
g_pHyprOpenGL->renderTexture(pTitleTex->tex, &rect, 1.f); | ||
} | ||
|
||
if (*PSTACKED) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This
rect
is responsible for the thin bottom bar, I offset its x and width values to reflect the rounding so that it's consistent.