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

fix(groups): enforce priority value constraint #9371

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion src/config/ConfigDescriptions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -907,7 +907,7 @@ inline static const std::vector<SConfigOptionDescription> CONFIG_OPTIONS = {
.value = "group:groupbar:priority",
.description = "sets the decoration priority for groupbars",
.type = CONFIG_OPTION_INT,
.data = SConfigOptionDescription::SRangeData{3, 0, 6}, //##TODO RANGE?
.data = SConfigOptionDescription::SRangeData{3, 0, 6},
},
SConfigOptionDescription{
.value = "group:groupbar:render_titles",
Expand Down
5 changes: 4 additions & 1 deletion src/render/decorations/CHyprGroupBarDecoration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ constexpr int BAR_PADDING_OUTER_HORZ = 2;
constexpr int BAR_TEXT_PAD = 2;
constexpr int BAR_HORIZONTAL_PADDING = 2;

constexpr int MIN_PRIORITY = 0;
constexpr int MAX_PRIORITY = 6;

CHyprGroupBarDecoration::CHyprGroupBarDecoration(PHLWINDOW pWindow) : IHyprWindowDecoration(pWindow), m_pWindow(pWindow) {
static auto PGRADIENTS = CConfigValue<Hyprlang::INT>("group:groupbar:enabled");
static auto PENABLED = CConfigValue<Hyprlang::INT>("group:groupbar:gradients");
Expand All @@ -40,7 +43,7 @@ SDecorationPositioningInfo CHyprGroupBarDecoration::getPositioningInfo() {
SDecorationPositioningInfo info;
info.policy = DECORATION_POSITION_STICKY;
info.edges = DECORATION_EDGE_TOP;
info.priority = *PPRIORITY;
info.priority = static_cast<int>(std::clamp(static_cast<int>(*PPRIORITY), MIN_PRIORITY, MAX_PRIORITY));
info.reserved = true;

if (*PENABLED && m_pWindow->m_sWindowData.decorate.valueOrDefault()) {
Expand Down
Loading