Files
hyprland-plugins/hyprbars/globals.hpp
Justin Dickey 1cb37fad68 hyprbars: add bar_text_weight config option (#669)
Hyprland's renderText() accepts a Pango weight parameter, but hyprbars
never passed one, so titles always rendered at weight 400. The font
family alone cannot disambiguate weight for variable fonts (e.g.
Adwaita Sans) where every weight shares the same family name and
pango_font_description_set_family_static() ignores style tokens in
the family string.

Add a bar_text_weight config (default 400 = Regular) and plumb it
through to renderText().
2026-05-19 17:46:45 +01:00

45 lines
1.7 KiB
C++

#pragma once
#include <hyprland/src/plugins/PluginAPI.hpp>
#include <hyprland/src/render/Texture.hpp>
#include <hyprland/src/config/values/types/BoolValue.hpp>
#include <hyprland/src/config/values/types/IntValue.hpp>
#include <hyprland/src/config/values/types/StringValue.hpp>
#include <hyprland/src/config/values/types/ColorValue.hpp>
#include <hyprland/src/config/values/types/FontWeightValue.hpp>
inline HANDLE PHANDLE = nullptr;
struct SHyprButton {
std::string cmd = "";
bool userfg = false;
CHyprColor fgcol = CHyprColor(0, 0, 0, 0);
CHyprColor bgcol = CHyprColor(0, 0, 0, 0);
float size = 10;
std::string icon = "";
SP<Render::ITexture> iconTex;
};
class CHyprBar;
struct SGlobalState {
std::vector<SHyprButton> buttons;
std::vector<WP<CHyprBar>> bars;
uint32_t nobarRuleIdx = 0;
uint32_t barColorRuleIdx = 0;
uint32_t titleColorRuleIdx = 0;
struct {
SP<Config::Values::CColorValue> barColor, textColor, inactiveButtonColor;
SP<Config::Values::CIntValue> barHeight;
SP<Config::Values::CIntValue> barTextSize;
SP<Config::Values::CFontWeightValue> barTextWeight;
SP<Config::Values::CIntValue> barPadding;
SP<Config::Values::CIntValue> barButtonPadding;
SP<Config::Values::CBoolValue> barBlur, barTitleEnabled, barPartOfWindow, barPrecedenceOverBorder, enabled, iconOnHover;
SP<Config::Values::CStringValue> barTextFont, barTextAlign, barButtonsAlignment, onDoubleClick;
} config;
};
inline UP<SGlobalState> g_pGlobalState;