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

Added rounded corners to group bar #6839

wants to merge 4 commits into from

Conversation

Swefton
Copy link

@Swefton Swefton commented Jul 11, 2024

Describe your PR, what does it fix/add?

  • added group_rounding under group:groupbar in config

group_rounding lets the user configure a rounding value for the groupbar making the theme between windows and groups more consistent.

fixes part of #2415

Is there anything you want to mention? (unchecked code, possible bugs, found problems, breaking compatibility, etc.)

This code now recalculates rect before rendering it instead of rendering it and then recalculating dimensions, this shouldn't be an issue unless there is some performance penalty or marginal use case that didn't come up in my testing.

Is it ready for merging, or does it need work?

Ready for merging.

@Swefton Swefton marked this pull request as ready for review July 11, 2024 07:11
src/render/decorations/CHyprGroupBarDecoration.cpp Outdated Show resolved Hide resolved
src/render/decorations/CHyprGroupBarDecoration.cpp Outdated Show resolved Hide resolved
src/config/ConfigManager.cpp Outdated Show resolved Hide resolved
src/render/decorations/CHyprGroupBarDecoration.cpp Outdated Show resolved Hide resolved
@@ -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,
Copy link
Author

@Swefton Swefton Jul 13, 2024

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.

Copy link
Author

@Swefton Swefton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still not ready to merge, but kind of close, just need to figure out some conflicts and inconsistencies with the thin bottom bar.

@@ -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)
Copy link
Author

Choose a reason for hiding this comment

The 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.

Copy link
Contributor

Choose a reason for hiding this comment

The 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 BAR_INDICATOR_HEIGHT to zero wherever it appears)
specially in const auto ONEBARHEIGHT = BAR_PADDING_OUTER_VERT + BAR_INDICATOR_HEIGHT + (*PGRADIENTS || *PRENDERTITLES ? *PHEIGHT : 0);

I am not sure there is a point to the thin bar anymore maybe it can be removed altogether, but ask vaxry

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);
Copy link
Author

Choose a reason for hiding this comment

The 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 renderRect is to render the thin bar, the rect is then recalculated as the main bar and gets rendered under the if (*PGRADIENTS) conditional, its better to keep them separated.

@vaxerski vaxerski force-pushed the main branch 2 times, most recently from 1184395 to b16fb97 Compare July 24, 2024 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants