mirror of
https://github.com/hyprwm/hyprland-plugins.git
synced 2024-12-23 07:19:49 +01:00
fixd
This commit is contained in:
parent
be5f741eb7
commit
ac13c3350e
3 changed files with 10 additions and 6 deletions
|
@ -399,14 +399,14 @@ void CHyprBar::renderBarButtonsText(CBox* barBox, const float scale, const float
|
||||||
// render icon
|
// render icon
|
||||||
const Vector2D BUFSIZE = {scaledButtonSize, scaledButtonSize};
|
const Vector2D BUFSIZE = {scaledButtonSize, scaledButtonSize};
|
||||||
|
|
||||||
auto fgcolor = button.fgcol;
|
auto fgcol = button.fgcol;
|
||||||
|
|
||||||
if (fgcolor == CHyprColor(0, 0, 0, 0)) {
|
if (!button.userfg) {
|
||||||
const bool LIGHT = button.bgcol.r + button.bgcol.g + button.bgcol.b < 1;
|
const bool LIGHT = button.bgcol.r + button.bgcol.g + button.bgcol.b < 1;
|
||||||
fgcolor = LIGHT ? CHyprColor(0xFFFFFFFF) : CHyprColor(0xFF000000);
|
fgcol = LIGHT ? CHyprColor(0xFFFFFFFF) : CHyprColor(0xFF000000);
|
||||||
}
|
}
|
||||||
|
|
||||||
renderText(button.iconTex, button.icon, fgcolor, BUFSIZE, scale, button.size * 0.62);
|
renderText(button.iconTex, button.icon, fgcol, BUFSIZE, scale, button.size * 0.62);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (button.iconTex->m_iTexID == 0)
|
if (button.iconTex->m_iTexID == 0)
|
||||||
|
|
|
@ -7,6 +7,7 @@ inline HANDLE PHANDLE = nullptr;
|
||||||
|
|
||||||
struct SHyprButton {
|
struct SHyprButton {
|
||||||
std::string cmd = "";
|
std::string cmd = "";
|
||||||
|
bool userfg = false;
|
||||||
CHyprColor fgcol = CHyprColor(0, 0, 0, 0);
|
CHyprColor fgcol = CHyprColor(0, 0, 0, 0);
|
||||||
CHyprColor bgcol = CHyprColor(0, 0, 0, 0);
|
CHyprColor bgcol = CHyprColor(0, 0, 0, 0);
|
||||||
float size = 10;
|
float size = 10;
|
||||||
|
|
|
@ -75,14 +75,17 @@ Hyprlang::CParseResult onNewButton(const char* K, const char* V) {
|
||||||
}
|
}
|
||||||
|
|
||||||
auto bgcolor = configStringToInt(vars[1]);
|
auto bgcolor = configStringToInt(vars[1]);
|
||||||
auto fgcolor = configStringToInt("");
|
|
||||||
|
|
||||||
if (!bgcolor) {
|
if (!bgcolor) {
|
||||||
result.setError("invalid bgcolor");
|
result.setError("invalid bgcolor");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool userfg = false;
|
||||||
|
auto fgcolor = configStringToInt("");
|
||||||
|
|
||||||
if (vars.size() == 5) {
|
if (vars.size() == 5) {
|
||||||
|
userfg = true;
|
||||||
fgcolor = configStringToInt(vars[4]);
|
fgcolor = configStringToInt(vars[4]);
|
||||||
if (!fgcolor) {
|
if (!fgcolor) {
|
||||||
result.setError("invalid fgcolor");
|
result.setError("invalid fgcolor");
|
||||||
|
@ -90,7 +93,7 @@ Hyprlang::CParseResult onNewButton(const char* K, const char* V) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g_pGlobalState->buttons.push_back(SHyprButton{vars[3], *fgcolor, *bgcolor, size, vars[2]});
|
g_pGlobalState->buttons.push_back(SHyprButton{vars[3], userfg, *fgcolor, *bgcolor, size, vars[2]});
|
||||||
|
|
||||||
for (auto& b : g_pGlobalState->bars) {
|
for (auto& b : g_pGlobalState->bars) {
|
||||||
b->m_bButtonsDirty = true;
|
b->m_bButtonsDirty = true;
|
||||||
|
|
Loading…
Reference in a new issue